changeset 184:022f1e506033

Merge from eCos master repository on 2001-10-02-17:59:22-BST
author jlarmour
date Tue, 02 Oct 2001 18:28:24 +0000
parents 9160a8005d76
children 298031b410a6
files host/tools/configtool/ChangeLog host/tools/configtool/common/common/build.cxx host/tools/configtool/standalone/wxwin/CHANGES.txt host/tools/configtool/standalone/wxwin/appsettings.cpp host/tools/configtool/standalone/wxwin/configtool.cpp host/tools/configtool/standalone/wxwin/setup/configtool.bin host/tools/configtool/standalone/wxwin/symbols.h packages/ChangeLog packages/NEWS packages/compat/posix/current/ChangeLog packages/compat/posix/current/cdl/pthread.cdl packages/compat/posix/current/src/mqueue.cxx packages/devs/eth/amd/pcnet/current/ChangeLog packages/devs/eth/amd/pcnet/current/src/amd_pcnet.h packages/devs/eth/arm/ebsa285/current/ChangeLog packages/devs/eth/arm/edb7xxx/current/ChangeLog packages/devs/eth/arm/edb7xxx/current/src/cs8900.h packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c packages/devs/eth/intel/i82559/current/ChangeLog packages/devs/eth/intel/i82559/current/cdl/intel_i82559_eth_drivers.cdl packages/devs/eth/intel/i82559/current/src/if_i82559.c packages/devs/eth/ns/dp83902a/current/ChangeLog packages/devs/eth/ns/dp83902a/current/src/if_dp83902a.c packages/devs/flash/amd/am29xxxxx/current/ChangeLog packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl packages/devs/flash/arm/ebsa285/current/ChangeLog packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c packages/devs/flash/arm/iq80310/current/ChangeLog packages/devs/flash/arm/iq80310/current/src/iq80310_flash.c packages/devs/flash/arm/sa1100mm/current/ChangeLog packages/devs/flash/arm/sa1100mm/current/src/sa1100mm_flash.c packages/devs/flash/atmel/at29cxxxx/current/ChangeLog packages/devs/flash/atmel/at29cxxxx/current/include/flash_at29cxxxx.inl packages/devs/flash/sh/edk7708/current/ChangeLog packages/devs/flash/sh/edk7708/current/cdl/flash_sh_edk7708.cdl packages/devs/flash/sh/edk7708/current/src/sh_edk7708_flash.c packages/devs/serial/arm/at91/current/ChangeLog packages/devs/serial/arm/at91/current/src/at91_serial.c packages/devs/serial/mips/vrc437x/current/ChangeLog packages/devs/serial/mips/vrc437x/current/cdl/ser_mips_vrc437x.cdl packages/devs/serial/mips/vrc437x/current/src/vrc437x_serial.c packages/devs/serial/mips/vrc437x/current/src/vrc437x_serial.h packages/devs/usb/sa11x0/current/ChangeLog packages/devs/usb/sa11x0/current/src/usbs_sa11x0.c packages/devs/wallclock/i386/pc/current/ChangeLog packages/devs/wallclock/i386/pc/current/cdl/i386_pc_wallclock_drivers.cdl packages/devs/wallclock/i386/pc/current/include/devices_wallclock_i386_pc.inl packages/ecos.db packages/hal/arm/aeb/current/ChangeLog packages/hal/arm/aeb/current/cdl/hal_arm_aeb.cdl packages/hal/arm/arch/current/ChangeLog packages/hal/arm/arch/current/cdl/hal_arm.cdl packages/hal/arm/arch/current/src/arm.ld packages/hal/arm/e7t/current/ChangeLog packages/hal/arm/e7t/current/cdl/hal_arm_e7t.cdl packages/hal/arm/edb7xxx/current/ChangeLog packages/hal/arm/edb7xxx/current/cdl/hal_arm_edb7xxx.cdl packages/hal/arm/edb7xxx/current/include/hal_platform_setup.h packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c packages/hal/arm/edb7xxx/current/support/Makefile packages/hal/arm/edb7xxx/current/support/dl_edb7xxx.c packages/hal/arm/edb7xxx/current/support/io.c packages/hal/arm/sa11x0/ipaq/current/ChangeLog packages/hal/arm/sa11x0/ipaq/current/include/hal_platform_setup.h packages/hal/common/current/ChangeLog packages/hal/common/current/cdl/common.cdl packages/hal/common/current/src/generic-stub.c packages/hal/common/current/tests/vaargs.c packages/hal/i386/pc/current/ChangeLog packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl packages/hal/i386/pc/current/include/platform.inc packages/hal/i386/pcmb/current/ChangeLog packages/hal/i386/pcmb/current/include/pcmb_io.h packages/hal/mips/arch/current/ChangeLog packages/hal/mips/arch/current/include/hal_arch.h packages/hal/mips/arch/current/src/hal_misc.c packages/hal/mips/vr4300/current/ChangeLog packages/hal/mips/vr4300/current/cdl/hal_mips_vr4300.cdl packages/hal/mips/vrc4373/current/ChangeLog packages/hal/mips/vrc4373/current/cdl/hal_mips_vr4300_vrc4373.cdl packages/hal/mips/vrc437x/current/ChangeLog packages/hal/mips/vrc437x/current/include/platform.inc packages/hal/mips/vrc437x/current/include/plf_io.h packages/hal/mips/vrc437x/current/src/platform.S packages/hal/mips/vrc437x/current/src/plf_misc.c packages/hal/sh/arch/current/ChangeLog packages/hal/sh/arch/current/cdl/hal_sh.cdl packages/hal/sh/arch/current/src/sh.ld packages/hal/sh/arch/current/src/vectors.S packages/hal/sh/edk7708/current/ChangeLog packages/hal/sh/edk7708/current/cdl/hal_sh_edk7708.cdl packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.h packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.ldi packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.mlt packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.h packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.ldi packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.mlt packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.h packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.ldi packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.mlt packages/hal/sh/edk7708/current/misc/redboot_RAM.ecm packages/hal/sh/edk7708/current/misc/redboot_ROM.ecm packages/hal/sh/sh3/current/ChangeLog packages/hal/sh/sh3/current/include/var_intr.h packages/hal/sh/sh3/current/src/var_misc.c packages/hal/sh/sh3/current/src/var_mk_defs.c packages/hal/sh/sh3/current/src/variant.S packages/hal/sh/sh4/current/ChangeLog packages/hal/sh/sh4/current/cdl/hal_sh_sh4.cdl packages/hal/sh/sh4/current/include/var_intr.h packages/hal/sh/sh4/current/src/var_misc.c packages/infra/current/ChangeLog packages/infra/current/src/eprintf.c packages/io/common/current/ChangeLog packages/io/common/current/cdl/io.cdl packages/io/common/current/src/io_diag.c packages/io/eth/current/ChangeLog packages/io/eth/current/cdl/eth_drivers.cdl packages/io/eth/current/src/net/eth_drv.c packages/io/eth/current/src/stand_alone/eth_drv.c packages/io/flash/current/ChangeLog packages/io/flash/current/include/flash.h packages/io/pci/current/ChangeLog packages/io/pci/current/include/pci.h packages/io/pci/current/src/pci.c packages/io/usb/slave/current/ChangeLog packages/io/usb/slave/current/doc/io-usb-slave.html packages/io/usb/slave/current/doc/usbs-control.html packages/io/usb/slave/current/doc/usbs-data.html packages/io/usb/slave/current/doc/usbs-devtab.html packages/io/usb/slave/current/doc/usbs-enum.html packages/io/usb/slave/current/doc/usbs-halt.html packages/io/usb/slave/current/doc/usbs-intro.html packages/io/usb/slave/current/doc/usbs-start-rx.html packages/io/usb/slave/current/doc/usbs-start-tx.html packages/io/usb/slave/current/doc/usbs-start.html packages/io/usb/slave/current/doc/usbs-writing.html packages/io/usb/slave/current/doc/usbs.sgml packages/io/usb/slave/current/include/usbs.h packages/io/usb/slave/current/src/usbs.c packages/isoinfra/current/ChangeLog packages/isoinfra/current/cdl/isoinfra.cdl packages/isoinfra/current/include/limits.h packages/isoinfra/current/include/netdb.h packages/kernel/current/ChangeLog packages/kernel/current/host/instr/dump_instr.c packages/language/c/libm/current/ChangeLog packages/language/c/libm/current/src/double/portable-api/s_expm1.c packages/net/snmp/lib/current/ChangeLog packages/net/snmp/lib/current/include/config.h packages/net/tcpip/current/ChangeLog packages/net/tcpip/current/cdl/net.cdl packages/net/tcpip/current/include/net/netdb.h packages/net/tcpip/current/include/netdb.h packages/net/tcpip/current/include/sys/socketvar.h packages/net/tcpip/current/src/ecos/timeout.c packages/net/tcpip/current/src/lib/gethost.c packages/net/tcpip/current/src/lib/getserv.c packages/net/tcpip/current/src/sys/kern/uipc_socket2.c packages/net/tcpip/current/src/sys/kern/uipc_syscalls.c packages/net/tcpip/current/src/sys/net/if_bridge.c packages/redboot/current/ChangeLog packages/redboot/current/cdl/redboot.cdl packages/redboot/current/include/fis.h packages/redboot/current/include/net/net.h packages/redboot/current/include/redboot.h packages/redboot/current/src/flash.c packages/redboot/current/src/load.c packages/redboot/current/src/net/bootp.c packages/redboot/current/src/net/inet_addr.c packages/redboot/current/src/net/net_io.c packages/redboot/current/src/net/ping.c packages/redboot/current/src/net/udp.c packages/redboot/current/src/version.c packages/redboot/current/src/xyzModem.c packages/redboot/current/src/xyzModem.h packages/services/loader/current/ChangeLog packages/services/loader/current/cdl/loader.cdl packages/services/loader/current/docs/i386.default.ld packages/services/loader/current/docs/notes.txt packages/services/loader/current/include/arm_elf.h packages/services/loader/current/include/dlfcn.h packages/services/loader/current/include/elf.h packages/services/loader/current/include/i386_elf.h packages/services/loader/current/include/loader.hxx packages/services/loader/current/include/mips_elf.h packages/services/loader/current/include/ppc_elf.h packages/services/loader/current/src/crtbeginS.c packages/services/loader/current/src/crtendS.c packages/services/loader/current/src/dlforce.c packages/services/loader/current/src/dload.cxx packages/services/loader/current/src/dynamic.ld packages/services/loader/current/src/loader.cxx packages/services/loader/current/tests/entable.c packages/services/loader/current/tests/foo.c packages/services/loader/current/tests/loadfoo.cxx packages/services/memalloc/common/current/ChangeLog packages/services/memalloc/common/current/tests/heaptest.c packages/templates/all/ChangeLog packages/templates/all/current.ect packages/templates/net/ChangeLog packages/templates/net/current.ect packages/templates/redboot/ChangeLog packages/templates/redboot/current.ect
diffstat 204 files changed, 11124 insertions(+), 4796 deletions(-) [+]
line wrap: on
line diff
--- a/host/tools/configtool/ChangeLog
+++ b/host/tools/configtool/ChangeLog
@@ -1,3 +1,11 @@
+2001-09-13  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* common/common/build.cxx: Test for active properly in below change.
+
+2001-09-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* common/common/build.cxx: Only use tests value if enabled/active.
+
 2001-07-08  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* common/common/flags.cxx: Include <cctype> for isspace()
--- a/host/tools/configtool/common/common/build.cxx
+++ b/host/tools/configtool/common/common/build.cxx
@@ -262,7 +262,8 @@ std::string tab_indent (const std::strin
 // return the tests of the specified loadable
 std::string get_tests (const CdlConfiguration config, const CdlBuildInfo_Loadable & build_info) {
 	CdlValuable tests = dynamic_cast <CdlValuable> (config->lookup (build_info.name + "_TESTS"));
-	if (tests) { // if there are tests
+    // check if there are tests active and enabled
+	if (tests && tests->is_active() && tests->is_enabled()) {
 		return tests->get_value ();
 	} else { // there are no tests
 		return "";
--- a/host/tools/configtool/standalone/wxwin/CHANGES.txt
+++ b/host/tools/configtool/standalone/wxwin/CHANGES.txt
@@ -1,6 +1,13 @@
 Release History for eCos Configuration Tool 2
 =============================================
 
+*** Version 2.08, September 25th 2001
+
+- Looks in PATH for gcc locations on UNIX.
+- Uses current directory for initial save directory, instead of configtool
+  directory.
+
+
 *** Version 2.07, September 5th 2001
 
 - Image (png) files and about.htm now incorporated into configtool.bin,
--- a/host/tools/configtool/standalone/wxwin/appsettings.cpp
+++ b/host/tools/configtool/standalone/wxwin/appsettings.cpp
@@ -30,7 +30,7 @@
 // Author(s):   julians
 // Contact(s):  julians
 // Date:        2000/08/29
-// Version:     $Id: appsettings.cpp,v 1.24 2001/09/05 14:35:53 julians Exp $
+// Version:     $Id: appsettings.cpp,v 1.25 2001/09/25 09:50:23 julians Exp $
 // Purpose:
 // Description: Implementation file for the ecSettings
 // Requires:
@@ -206,7 +206,8 @@ wxString ecSettings::GenerateFilename(co
     if (!m_lastFilename.IsEmpty())
         path = wxPathOnly(m_lastFilename);
     else
-        path = wxGetApp().GetAppDir();
+	//        path = wxGetApp().GetAppDir();
+        path = wxGetCwd();
     
     wxString filename(path);
     if (filename.Last() != wxFILE_SEP_PATH )
@@ -352,6 +353,39 @@ bool ecSettings::LoadConfig()
         }
     }
 #endif
+
+#ifndef __WXMSW__
+    // Look in the PATH for build tools, under Unix
+    {
+        wxString strPath;
+        if (wxGetEnv(wxT("PATH"), & strPath))
+        {
+	    wxString gccExe(wxT("*-gcc"));
+
+	    wxArrayString arstrPath;
+            ecUtils::Chop(strPath, arstrPath, wxT(':'));
+            
+            for (int i = arstrPath.GetCount()-1;i >= 0; --i)
+            { // Reverse order is important to treat path correctly
+                wxLogNull log;
+                wxDir finder(arstrPath[i]);
+                wxString filename;
+            
+                if (finder.IsOpened())
+                {
+                    bool bMore = finder.GetFirst(& filename, gccExe);
+                    while (bMore)
+                    {
+                        wxString targetName = filename.Left(filename.Find(wxT("-gcc")));
+                        m_arstrBinDirs.Set(targetName, arstrPath[i]);
+                    
+                        bMore = finder.GetNext(& filename);
+                    }
+                }
+            }
+        }
+    }
+#endif
     
     // Read build tools directories (current user)
     
--- a/host/tools/configtool/standalone/wxwin/configtool.cpp
+++ b/host/tools/configtool/standalone/wxwin/configtool.cpp
@@ -30,7 +30,7 @@
 // Author(s):   julians
 // Contact(s):  julians
 // Date:        2000/08/24
-// Version:     $Id: configtool.cpp,v 1.46 2001/09/05 14:35:53 julians Exp $
+// Version:     $Id: configtool.cpp,v 1.47 2001/09/25 09:50:23 julians Exp $
 // Purpose:
 // Description: Implementation file for the ConfigTool application class
 // Requires:
@@ -254,13 +254,7 @@ bool ecApp::OnInit()
 #endif
 */
 
-    if (m_splashScreenBitmap.Ok() && GetSettings().m_showSplashScreen)
-    {
-        m_splashScreen = new ecSplashScreen(m_splashScreenBitmap, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
-            6000, NULL, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP);
-    }
-
-    wxYieldIfNeeded();
+    //    wxYieldIfNeeded();
 
     // create the main application window
     ecMainFrame *frame = new ecMainFrame(m_docManager, GetSettings().GetAppName(),
@@ -277,8 +271,14 @@ bool ecApp::OnInit()
 
     InitializeWindowSettings(FALSE /* beforeWindowConstruction */) ;
 
-    if (m_splashScreen)
-        m_splashScreen->Raise();
+    if (m_splashScreenBitmap.Ok() && GetSettings().m_showSplashScreen)
+    {
+        m_splashScreen = new ecSplashScreen(m_splashScreenBitmap, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
+            5000, NULL, -1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP);
+    }
+
+    //    if (m_splashScreen)
+    //        m_splashScreen->Raise();
 
     wxYieldIfNeeded();
 
@@ -603,7 +603,10 @@ bool ecApp::VersionStampSplashScreen()
         wxString verString;
         verString.Printf("%.2f", ecCONFIGURATION_TOOL_VERSION);
 
-        int x = 339; int y = 236;
+        int x = 339; int y = 231;
+#ifdef __WXMSW__
+	y += 6; // For some reason
+#endif
         int w, h;
         dc.GetTextExtent(verString, & w, & h);
         dc.DrawText(verString, x, y - h);
new file mode 100644
index 0000000000000000000000000000000000000000..92c7ed609831b5a5baa14b59c1193b01f290745e
GIT binary patch
literal 10190
zc$}qrV{m3o+wC3Owr$&(*tTs=?j#f2$;6pxVohw@wvCBxoO#}-&ig%|>ijsp>*}uV
z>RPpb>|V9k>ZK$L1`Z4OtBvc@(TJ{gP3waL0Dl!c00Urd>ga0cXz9r4<Y1|;1_J;S
zs&D7%B2VE{_XG#rfe?d6C@FkFfW`d_0YO?yT;<PL^QT0?!T$6oAhaTX1`Ia|EjKY2
zb7MDaM+agxYkPA5)HDnn9050MPt@6;4Nz{<@)G}ABE&M}hlKpI1mh&7?Fs-O_WxBN
z$#jT#e-@dQ<kTeojPUT-=@f*Q5~OG>IttqMrJ)J46DyD2W{<gv@8i9nr>B>fpSO>%
zpO259pPw5)2-*PvupDV|5jD@%^E5?UToLqcuG|rdupeHqcVgorA;KMZm?dE)sev^6
zQ-#P;*m%hNp40)tNQ8-j@l&XFWxc(=N#Kb#!Fh98D?qkO`P%Y4TgAzN4fn$)$IVY|
zMSAOXZ@QbvH@^`-W}v55EZ)M^B~B*S<Tv>YwYbcbaisRAnoi{On$FOLQK+xNhZIZ@
zthu%eVq~{eOc<=E)H=l*pf{DNs4d7!TiXNm!;%XbZ*#ISdb#^5US^fn^4VIFMJ{gj
zkBa*Qa-A&UWvt!5F?TwJcq#XNxg+9G=(iBx*p@;g?UIy3h((XbkB-wxn%swZKf3W=
zFcWx$H`An=44NUmz-n1KMQqV?s~CX0qP;ap`*DGZu7kz{{<Io*!yV*8Hp7gg>Z<Sb
zboi`Ze8q})3}f0i@2&|k(;Q(x`dpKypZz;C4ssH>u1K%>SaY0)zww7<PQ3a8Mvc#K
zv?CtN3j~7c9+x$~ztMT%j8`;-cK8SZCS-2dljbi65|;MYf2Sxns|-b;FmQ2>DrsWn
z#(sTi>fRk@ofO}&d4t>>Br~222!qEO9qrU*iXd?$jayzI=~56C--BF)X!h7LyMZ!x
z-E8$83w25vX}<Ug_$|qLYk;a<=C(X5_JL9M#^9prR6?^ZWsH}Q4bde-jOLh<kKO`D
zIkx{A{C%}Mc)hxf8z{62rBPSF&utb?(1rH}6D|?T6AX!yB;wk31nG7dt2*~u=4Otc
zmE4X+X4)04NpFB>bvPYCBG19@9ku0RzDvSK3~0(1;X~>qawm7!Y_>N=UV*_Is)tq(
zo*B*+8h{;q8p~`h-h{)lFHb<=BE@kjvWczC+Fptr|4tr{aj>}P|3&JJSGj~9XumKM
zHdY7RFYy`9W-srpaR5~f5%z`Gh)OD_t!%x))4_AbjIM3xX3+e}&9wRxPZaJ0UXA!k
zbFdS_DDX$CBUM6^^bffovz6}|W>~sVGtpSX>42)Ty_jWpKF`VUPPiXyiFsQkc@lFB
zO}SGQU;T##ZUD1FCtTf8byf?h&4e&80<0NOw%a%bRdw=-2<dWRiSi#HK_Yw>Wy=i|
znFekM^^uA?E1VQZ-&&ui?S~mIB<x$K3C@$UL1>2<#20@LaWY1~U)jIPy;>$Q(pKg!
z(DVN8JAZ~tHPuu8O)T(vGf7jLT?r~`unBYmS}xa5ZKVCUXabc}czlH<DSnn8q$uXs
z*vH^WdBY0l41Tje;STwWiKHbI#D9qz1uFgFCiFjZXaGlo6D<*->;)1U04Rq608swH
zO|JIFc6R?Js6&lf-hUF*!Q!VO{3{{U6$uSW%ZZd4X?;S4(|w3mThr>?VxzsWgkcfk
zf&+S+8+MqPtj$;x&HQMp4#n5tRnoYG5@!{82@Pf0lX}{t==}TyG;g8P^;gaHrM+k1
zx6NDNxFzB19^nzxQ(ERqnh3Jl#nBk1|2HPBDES!SCVnR$5KcNA%P70K>@+EDpWR>2
zy-!&z@zQMx1443#8J752NCwOa&)3{raYfuy7u)wi`83j<x`oK>`W9Mf<gpmI(5!(^
zAEJn6;WTD8&}KHqHZ~xj={lL9n14Q^hK3-HGy?kWi|wm#0brp)U_l_v*qDfNwopZ2
z-A1g~a+F~37w|=VQNJgd(W4-$ySv>jowYCYFr&sGn)L$mAV7Z!_hWSX1H{35cR$|2
zqr{ovyQ}#$L8Hh~wMauKKoiu!WsQYNlVu7(u~B-U=|#x>(Uqi-0m-DtkCxyf`_Mmy
z_x)8E6Gl;5^a5ywN0cG3(PbcDOOzlYf6AZ_C>6r0o5-k@s+DyYfY!mPmNLtQlp-L=
z#2DLf6b&MP{o({4THwxuWTQ^(c5X*xm&O)N+=ix-0!<1fW+%5&5yQ2Tjyd#0GMcri
z*E#p&Le5fvJw=XCU|gU<&Jz74hQV8?QVgob3*YT#BV5_%Odx$C6@$1A(gdI9hAvTq
zPtDk!3l8{>+N?_IFVUkXLz-Ja3L8KpE;>?}1e&MB6GBT(AyW#V2q~q8&!4B2LC}%k
z;g&#7k`%M<DgON6g_c+L${5Rqkki>#hyq|Dfa&Rw<`(*gr}VOeN?Gv`7h(WJ^ZkEF
zV$`cB(23;N!z#^U=l)#4uGE<0_MZb6o(7lxPF@MZUN0$Y3qnu{2H)jhbbL8;%2H@h
zIa|&m@M{sRIh*_rSEXv^xWQke3e3$5Huny_5(=vuqeF0gMgmC$jX0f{SnKnXfI5v+
z8(d_N?R^<9M5x1#o9Y^APpfDgapCF~OOaM8ZdV}HP=2Do#P32X`*k(s@k2SAd-F$n
zx=o$c#LsB+QiasY2lb~<-!%^4?fG{ku^gX#3x3^A!pD=Wn1^7?N=M!6gdI4C5ioM!
z%R@*HTVSf%7fK}dwxPteIzht8?d7h@=VoSu0fZQezOD<d&AKg@r~UMGibf5YxG8s@
zz1zl+NNkT-0vgmkwV}oS&QeZ_>JP7$$I%<&%Z#DjN+8T;gYqOBSpJ-9zDp(Js=kDa
z<sFldv!)*Bf+q|a`{g40&eNQtyfxQN*aLH_xqe97>|8Ym1jDmm5)_m=JsSAK_~%#O
z;iK4BF)=ZT%C?N=&(#Ar%d4eb?nRW&RQ<|>AyBFwN~*E7Ve;%pq{8f*js;+LVHoL_
zj{`|A?0G;YQJo|e`;$xU+Fp|!Tm>#4&dfYAjti;Bw#<_Q{o8Ekq)^@E<;o5onnoR&
zIo965z}H^!9i|^a9NH1dJ4}cIla&M)PtQK0m)>s=f#X4NvG%yvoAldNQ5`Fp1Ux(r
z7QN`DBW02YAeZ|FZ6UquC$10bxR#Q?J=OwNeh0Nh2QsjwWu6Y&PU*?k`Lw($I6Jd{
z)6jUodE>l%cnslyf;2p{Wjs$vUUzxjt8KTb{@wQ$VQEmfC{fKjmZ6bj-lUf)b&-8K
zjOXsUo_K0}yV_7$<7n#qV&)v0JN{7CrO4&&G~G;H^fp$AQpdC9LzEE<%w|~3sObDv
zA44KZ+R11rjY}jEboPb*u`~J-esufn2kv#*9_x*mb-p)9+W;7;?XP0?i}f+YU38s>
z+i2i*z{LG&dz#OyD_DX%2i+kBM&-#9_yUBTAMq{CTjG`C=h>Te1Ku>-Y11R)Y<9+)
zds9W#*rci(ub&pRRnkW7v$J&n>M>n@1!vvR@6LB+M@1CZ&Tp?UE-TBbIzH;&VpqK9
zHya;{NA_z)``ewrYjWCQ2XxscB!9*|BbZmd_un`jQYO25R$6zA%y*qbyLu_9xHDF+
z4N<A+O?}wkL=#cz$UlxnHjS(Gha}-|GEfpdrh>N#O5fkm*wpj$7@r4wa|tqUhLuvq
zs1b2wBx6LEKK1dvScI*-vjWW@_v=bG2(ItNCDkv=A@I5mhKrgP;Q0^QoE$V{Qn#x#
zUB>!x43HTN=6y(d`)l+$Iq8h$?v5j~tiSH!<wWxP4j5UdCOesJ2VQ@?FWknO@#)(s
z62aE;5Ui_KY<xoh(z~J%%uKw}EzbZQWzzZDStGCGTDdCWBjiYY_N>HnWUzb~|1*1Q
z-J%`}ex6(t@qxhd%Rw;y2in-0fphz2eaO}X+wP8iOmD3<Md~72p(|+dQ4ZpaAnn_I
z=jrsaX6AyY4BZ$OOU~$P{9QoP7k(<`v~3%)ftUv1GRk1w_wi8!b9Q`(y-ah2*RHkY
zd?%zC;*JT~(ET8uAzWxk)F_%260CN$I!vNiZq!@Soa?u$T$i>7(mGU2a(mzbo@>lT
z{g!?vU1k24D^v5n>=}ftWo*=~4R2qX@`P{XG^0g|I^NUjo+m0tqH*Id{sr0jl=7Qn
zDVt(}Y+wxYJ&#xhbx8N2a}rWpFOnp$W`5aZx5`LAT1dp(Eo`&L+)wgo*>@7z7F;dW
ztX6dGKbJ@<%C9g<<OD$m+8L*S8Tt*aX{X<M<U`{eb-8$7D)Nl>SH5=^dO2_QZ>CrG
zMPAF(H3nk^59;HkisMzuIg}a>EIHz`{T7t`p$OBKVDnV9KLlg6Wh7DX0j2bBmGj%$
zm9_#j^c@)j0Qjq5|NKd~Sp6rBV*%O7`~T25`G1Q2Um6FUBw6Zz*EsM5aMcEHe*e}u
zGhk>4NGSI*QV0LgIBtIxh%I^D;{Tt<0ay83<7}j`IIc;e`(KhO<Emisi=#pne~N^D
z_=A>AqKcs+kH}_d35zqjQ-G#47aSPMgel0Axt*9b2iYS8jMMy%FVI1CRw`Zk`h^f^
zmQY5mUvQ4VDG^E3^|;wVg?dAzmE&s{@Hs>KQRlh(733|?H>UTOkX?h^lH=hXd1lG6
zLNJlQ_*is4Vb*Y8TluNTW`|U4SM_bY4C@(><eF8rq$!dRx2{-mbPa<ck8q7B7#7Vu
z3`?VpMivR#*%T*~yBlLf`DDWUO6YvM(G`d??gw4Ycjyrb<rk~WLMT%Ui-a=wOsXo8
zJJI0zP5TD$OvcvV!|53?C{{t!%pO3K%mZsKR~5HSsvWi#^yGl0LXR7_K?o~55$$B%
zY>#|573VA*x(^odlsM#Oss!)1ac(g)UW6VJ;##vnnqSPL9-7iUtMYQY1|p@3%F-4M
zOXiE<ESMMgX0@HBk|`M9bBrq-NjqxW%IeKH;|8+HL%^kzELeRz*tapteG!nCvHi~B
zInnCH_fxMt0$=A^SI67VMsBxP6ob#i7k1dQq^tzgb66|%#03F*f_=|{pFtGM`*+Mv
zo!VdB?SFGyV&Ol(>uuJPx;*x0r<lM9c9%y&Rn5#5L3Ue2sMY&8pxIk|KM7Vct<;2v
z=Wh+8VyungSSzFGj=F@0hNON<i~$tAvmxeOC){6|bE8c`7PRk%@uA|>I7rKzW96mz
zeNK`^XKf4)TW+I8YGc>oY+;5HIlz9EbD&gJPHIZfp+#kIj&3$$(+G0M*w)QT3O)c-
zrTEmCt_({SWQ!K1-Pa!!i5<fi6<LcYi3zO;5VY&)=9?8d{xsLt+LVe9K_VGLUMG=2
z>W5`U2r3zp5KCF)trTq8MH<z?JZeg6Ubrzb&d{Ti^k7Xn<8~T%V;u4RVE2ihJs8?Y
zN@2=oz>MM{ZL^lO06&gtfu|$<5LIX?Jj(gfbK7EUP7lLM+hK4icz8o?KSF45mD5*W
zsLoz_7|^V$@F_irO7}sgfS6^4oMKSpW*;GUXzoq4-45-vvg)_~*`AJrmv;c&RDdl-
zxZMpTZl$UfCqH<dRf=yH>JG5FW-D}Fyy4`Oud+l?`ika(lz{P7xo!7azF(}J#(`EE
zS5HCT(DQ3;3dPy!0I01elJ|O$xry`_tY{q1!ZWJdL@!jJs9u6;A@6$P(XN)yj-`R!
znUWo)3x@W^2j`h#i(*704keRyoQXWtW<n>An%`vf1YYdC6Jn2UMgI<J;P<K&(;Kj+
zdEXxE`hc;l;`U%{6A@{Pdfs;BBsJ6t_JKN%G3QWz%CYoaQ@(!mkbc$I$$Hh^4sF+>
zk?n9YsGPXvZCnG^HI|z<wht;OnNBTR7MIB0pZI=XH{zk7WH?==X<Hpc?_AAUfi;V}
zun<}J-ScG<*}hytbg>(#2iAuJ1wsuvz<_JI(=MNLAG?6AMqem-_Xu8RH1fUwS(ceQ
zP|%&_2w0<{004t1e_KYbPIktwRxF(VrqfQM6uy7bX`$Lzc09y3L}>~Z(?x33f(MN{
z3KO(K3E7ER4P{+>nf{`A4ISN>)qI&qEkkvTN)(d9hA-y=j($h4r<<;qL|ZLWJeR=9
z+xAPp%iGSH!6x_P5}r~J03a*-*P%YZ9~Bg!R1)a#N1zb<9^VE2FvB(v8Yf&eJ)$yp
zLtppSkW1K#xd{MtObJQskWMpyEG4lHrrErk>*ze#kxvz264l)WtzrH;P_F7kQXqsB
z;2l@w`CN5xX>4o(ws?Db0X;o|K<UYYK`=mcuUE!N(MN%hBjiTQ$G|F%K3%_jtz#r`
z{Jrf8Rd(nW-m?&txD|9y2IRO2)@=IsB-Rrt3{Ah!x6evYXnLaYOi^ifO6_Q`iSIud
z2G~jBTK!I~7}J+&n^ba_g1sow3eCBLgt8@JAB!jAHa5ts%||(hFG4RE5f8QcSE#l>
z@FK-tSgd6@g1nbTq(Lc?HF%WhU-Erw<CI79SFxY>&oVtR(;+j^s#2B&V`*r*x}m82
zVxxjo(0m-6S0l_Xy!_-gXp_qu1QnL~7x>_@b($r;uTOBr2jFzS?$~H4k#SM2&2*;(
z(sWHJJmbg&Fq7DeR|;`A`3>c<psT=!aRXX)ZJ>UO>IHU5KM+S2o7I;J=Ux-b-%pk8
z50to1w&!K?Ur+jNLWCR=F{Ru31+|yPjDJyZ9UzlUmKN9%8>4gb?3|lBAMW7RaNjvQ
zS6$yKiohe?<-Qw;5y|YOkZCsIAx)K7*3F=u*KcFi7N0jd#W>hS89L}Jh2(?ko-w7e
zh|ND=Z8L^g7%10VXnNip%7+GuR#*?)?y}Ic0Y&`_erCK%tI;_crO&Q<@S5aGDBV1p
zBRiLvKHeRH8YJiKa4DM&!kPj6%?Mfg`^dF#vP)eqEIg7rpw*pO$;??RC*g-BSlAFz
z+USVF>}vwX;%xnls1%ZJ@sX;klJQr`&xF#Msd2zmJ$NV!*XdwrQlH7EtZBqE5F66@
zZ0THhPOI}*CJ^6?m{AbfFI!vb7Ae`>dM%W_N*j1kGbE}spF40sC$Ub)Pa<*FbEVFj
zos`RKAg+mGju^oCRx&3t*c1>hCVh4Ubrx{BSSn^jMD7%+a6>Tk!L7vlnO?OzMHw-=
zB<ohWoy?qphW+XJih5R6l$UyZ4W8e)*Lqo}9`O*Eq4U|s2zfi=JE`SX&zH-;+V&4n
zDQbTeYrWa@C+Q_}5=|KY3Lm~iXj#{o30njHqYkalp!Sp)F@jyCne>pZp}8qPMGKA_
z%g6CF__RaTWae0miEfUV*<K;@eDnMFX#Vi^Q7F9zg%}mE9bhj#TC-&uoC>*pH3g3`
z@`@)cZ*IrcDW`@*6k&Xq;|fPYF{YPCf4E7UpMO>jgd)gIqUKQV08HwFd_g?kFrgO;
zWe;<~{ME?KOoEW2lcpKYja38}W#GJ3#IJJp&LZrMR@$}PWV9TRk~2<no3o`TbHr`@
zTsRQ7@E&-Y^z1#?2*-9cT%j~FYO=LnRn`J4<RphBD)gM13Acgunq2X3vC8yHctO@C
zf_Pd3C%@Y7A7aG~q9lQkd+#_b50tAgX}B*#DiIQl4>f5U32j7!xAPU^yCfqKFywSp
z)GdpPpV0(eW+H09uJ?6_3;`I29Al-{1@cs?Co4U~uLs!=hr0=jV${Uzt#LPr5s=Gl
zpkfPfzQ(obBcl&p-U;_wJ=fk&#c!r^B8mpz>@-EEnM?PcRJC0883JS@w^x7%xFc*$
z@u^3PhsR(ItMk8sp;&9~gpQe!j&hP0z;MiKninl)#A;=_M#a_CF%a9@^Q_#Gey@s+
zI65y}3JNj@mI|ghHkCml{r3+~6fLy!1YB&*1>9Z|gtg{&@1nIb%yPb1)?#|m-%nzg
zE=O9w$52#2dNB5X1qwj7b}Aa{4NWcH^oVMFBadjVDKgya<0X}65>}v1fkYuZ$({b}
zrnB(%3{rU{if8S@(nB~kdjbbDR%V7S<i!Vt4f`Al%zQ8gOSdKEm?b-g5hMr_T+Vvf
zfLXw0`$k4tGehDG>v@cf?I?b=5u8i$Rxz>fSdz$P@{3QTg`Vl;(Sa;mC9_~OdlCL^
z-s;&0AgW2lUTBG1Vz)lP%&|+KL(${PFw7JWHT|no0neSL3Dma3QSSUfM6IjSAbb(0
zCquE+l&$aP`nWWSzTjsi@%11<9<Yn9i&DYXYfYI!A;yuNFGG8Bs1td5HmNH~TZ+MU
zj3fX=p05e462F~9ai0Yvw{MQl9`)U&I}G!jU_B-JX2G0D!>Iw{wJE!xqSy@X5;owF
z@%UE~d$QLRA4zfbV1zB$nr$n^6Dk_!j|fNKFM%q}QPorpBql8ulIE43g%<5S9!5lp
z+#XBpI9VBtObULIL6m|acQr|?eNWtQA+GkQ+PzK#zvtYVn_9cfHMR8HJYIYGTPF;Y
z<~6xbq|7*r>O*8n%9#r322GDEwwVZeyN-R#nsY2^j{RhGv~M5T)tJceH>!LQyD6~o
zf(>?5AdgtteIOZ8D$H9NH3G7w%49<pzR7VQ3zjoqPngX0k(;n;?^V1L0{K>Bck?rf
zGs!Z7xyQ0v^Rh!Yqpp7FmJspDyq;?(!Nw)%5!j!8Z3Bg+DW&%}TcDQp<9cnYfH6nr
zJl*Z<G?RQILkf-E>KsB#ZVV+LqFFC@zvabH)3hdm``|OzP|=9rYN!kJwf{n)l-71m
zq(8i{d&GcxB5H|Pul2&8@Jb7)55+?0Z@eGzP!59gjRe4D6<vbnh(~nhJ>Op-`QS)l
z(0U@i?#|R#;Py-S{QU7sa7ckh!9;Qtd>4c|nfxx;LDDL4Nq_xO0ut9U*MmZGPY@hq
zez=y>QeGa4cBp)l%w)CxpxQ{3<#{HV!^?}+P#h46@2&nD1mS6asTV)pFy1!7>eo@Y
zs6?ycWMLOyk5x-8P!00SKEAisTH~iu*aVr%Tk=-;kR~mQ?ONT_54BgxZ<aq0uo_s(
z8Fg`rJb__Ue&uF(ycuJ{cFjUQ5!z2rnArSZpPVz6=HTNn7_KkVB)bhxnAI2Eg^ZKs
z$j0!=qoKQ8g0#A3XRd!CGFu*48f{Eh=uUolLo0dX$B0gx8#!bk{k%zZ3}-Q%-SC#U
z5K<^waPP+C4c_yXd|r~%!N1CF&e17so300NQW@Nj)PAs0ELXOSi)bFLypwLkH+?D;
zZ|Hs-lB^C}6%M_Ztv5-wS(tOI5G(Szprk4y=ZaMh%ZKtV{W;!2BYZD}bBchYfhSf`
zyw*IUq~2QqPkEj#!e6bRcT2C{uZ+<(cx&LDSBEf!`X;UggX-2k3$C`;+EzHvg+zqu
z<8-v0Ym96sUBR!wM^R0{9X9z^n-3%Ef$!}u87pOi^Jyq_utnN(?Z?~4&z+UnSNZKR
z@s73$t0*8Wj;LNcs=2t$1>zoxFtF{+I9IMP<D%j1jThVAJR1enu1?Gd1)1y&%dfoX
zXNmIVs8EKf6y|i3ZjGrTP6-heycx}%RR;rGdQoC}YFnoV<K$qTVjQPyELtC`87;1K
zykU5dER)XYEJN|5)2N}{c~!=23$pgNq8!{@Ty31H`#BDKxT2Ki?R@t`6$ZPRE9$xj
z%(RI&yjd=wn!O3o$W4a)P5c4l(u8m{TxZKD81JQeQ7as&-p4pBKKcb0ri)L|mZ?A6
z{~>G$114XO?AT}uKf@1}xCo~j(i2FX?6!9gep}p2Yje3qzWr>0rsYj^kOq^^_TVVd
z{^ccZ@NmS#7QP$cYbjClL&hc`L2yFRW7o^-Rv{C)%+>D~xc26HczveEXQ1gJrsumg
zO;*qXx=?oxyTqc4|2kZG8=M$}YE7NXjrtSAp6D{!NJ<t4?k>@>3y;DmdYe(83?@X2
zs;Y2c&382`XVX1uy^;+Og7JBh;zF-6mgfclqgJFM#1ET@Jfi1(rTA5<_Y{ok$Y1O~
z1GWN~@0vf9gbtClMc^V5SG+1}(PkPVauV@4X6~z1FsC07;Ydm7h0(6%!m;#BAkt4y
zAP<Y9xch#_%o*1;3QudLK#SL+@(&l-LyfR}x!qH$lt0PN@%6PF-D+iG)Yzt@c!;0l
z9kWa&Pn%vDNp7O(!Rc!Mcr6)-im9Z_6(+B=wNX&dihDiMtgfIc_<0dr4Ur7=Gw>3i
z=HSJLw-$L^k9uG{4TLDG5aN<Ej&v**%p0I->a<dcHTENK==oR&IlF3?NSxvf1rGUA
zsFl#7tKF^gYnG*X7)w$TA>hz9E~x381btAmbDDhy#>^c)_A8iEFn{(}8^s8b8y;Bp
zg_kmMnHqbzNgp%6Zhp%*2&cWpsJnln0>aKVB>0bZ?z4)~+FD+QL7Nyt<TyGEHqx}`
zgGqyou<+*|`SA`x0}X0%sdlDPo>w9`IaJv<W<N5xhvm3jAj_e8IiDylO^H${PHuY+
z4;&qz&KlZ+R=Im`Gs(`QWTEJcSl+#RE2*mDejw-Q!)>)?#4&tK?31sQB5SNAtn5)4
zWK+jTQZVF3Xjlu=PC}UNo~BkPGkhJ{aq?QNte9+S(lx>kdjSNtLx3~I@3%$5AFr~_
z!^V;m6m>02zq!!0J$U)NXuJdqx_Hyu8ycR<Rk0|Hv*X(nt}0<)Dya{vp7$0^D~efk
zorJI8{2VVcf_<d!dxv7mO~EQE*QMXim{z>?lP8+ai)acEf;!A67trsg=fm%p(7W1~
zAOOF>!^%{RYjS;o@^hWA4hE6V6UJZizRg-aFWVU`#Msi^pV(PwF_?u%*R*{|OMovM
z_TSL+D$i2!n;Q3iCdp5r(H)qi&H8FC0Pj~H(k3utznOP^3x^h}fKQ@H@sLXZLmR_d
z)b-*juqb@2*zIWJisPfu70kK5clSaKZ<^A+tSB-e0Kq`=x-^B(4qM^pw8(K<q29S!
z<(&D>an5?r?Vs7`a9ci>bq32$W3rG=Wa-m!L+illlH5eX26P{o%U)bK7R{H&zoUH-
zOXpw3(Ah5FrFEd{9Ils?H)y9gJxunK4ItsLO?NL6l_a&YZi6L}C^m?%*QACob2!-l
zaf?A#u<68ET^`s6XLJBUUI8IwC2*eMPWFbeJCM3)7dtuN#?Y+xB8N1`R+!h}98<{`
zFML4Hl!!zGUwIdeOSc`|t!%vYTl^qc5-&1DQJJ$%&Xrg{H<a|cS5^i$x^0>%hZgK<
zOMMY2cDraIyVt4J4<VD>sk&m%zUt+OZo$F6G|CxF$he#6yze$`G#<o*Hy#<I(O|X@
zl^@}mt~WXB&bfTb{lz6~?~qATKz2%SD}fPj&dU*6jV`}vI*=DCk~82b5fnk5J|Qzh
z|B-V>I+HA4ayB>5dv3l1%g32|SWVoX>-k6k+d$84R-fG?3y(1cC$=F{;>u^)A-1r;
zz5aR$`Ap6?#Ie{3`h$N{x0pZFcNN}_1|bn;ZSifU%qo#^>^E4|zA7;uCmiG&RDgEh
zYu_%FDQY{!``%K5U=N+n8`pKP*5`%!Mc|I}+$d=wOABPHK~-EqPx6b94nOUVhj163
zIL^aU2PtAaj)s?c$h&*RxGS9GcXjL7V41z0S{I|-87&c5hHwV{X#Ol!mE@Q^0P3*$
zFQeX=aN{{Y1P7luKO-fN?l$92NyZmzarW%z9t_lNtsiLMg#f`L($TVD-~a?fErK4~
ziT+KQ(uhAC=k@{=*j9%l=(k-3K@66Y4MT>(l<$2TysikQ88bo^g5OcS7-srid<0H`
zF9`D3G$!1D_pUA6Y>58;;AU{Hxzwi1ss~oE4^hR_MhlKr#8<=rFjS&kDCl0H{RWdk
z0e}?<000Jn0Wdakba!L4a<l)Jo03AA!Z%C#A8tyPnzG|6GqP{h{HK$N+-iM;a9db|
zOuSBR{hAd@ZYSReM~#!uu!rcJp%4|PzP~jR9O}r%^VwzR<)ny(3k$yh45<ul_-q<@
zY4z>SFCZ_ci768~!WrrN;WbJhX#jFQvR9u8<J?tk4JW;{%_*K8(4@AS?f6k>ktaZT
z!f%$hyo1bt&GlF?*^lbtojEg5!+Cjxg-Tt&Tuw>m2ru2kA0~TLX*(*Q7BXljMD~PZ
z#W!cMCdl{wv{`~hCg`KSNN-|``E54LRP-#;Dx7SVne@4LPL!ojx;Ij)n~hc<Z{ujh
z<oW7u8Nq9YxmlkbxN$vUGrOTpwyG9coF1TfZHcX?|4pdv_z_BE--w<$z}up;Hz;~a
zpM-<iP!-S7@r&YAyElJWiVfC%O&46XX6E-h;l?b?A^I0R#jYTTgKYCu9T79n7Ba_V
z5_a&PaxLO&jq2URV*#h98P$)qx#~+IU(OI&>aDH)N{o&wl)2L`tJ3R4yBSV6e!6+R
z<;wM@!Spm%xcq{UD1n!o*U?RyY}#*8e~is+!l6Tt>+l|&$1Rd$u57vGziED;ju_;g
ziacVbkZD{eYGH?v!?4a`yG%!?kqOQT5zeY1U>=bhB!4rZEf(duOiShuz)84)9)xXL
zT%?}vL-M-aQQmsea3-i`Qe7*VLkdGMoxN|?ZWgV#yigqdD0xp6o)Bk;kckB)OrR*y
z7fG3b%?4+(?~8YhVIANY$4I8$N-Idgm8GOF`$|!%uW~Tbit+?I#!c5OjDtaYua>{5
zMVewu+mVmF&e}De&Uy}}DQ91XS)wk<b4z_0m1LxDeUq`ds^`s+`_e=z{~hcs?sDep
z0-<rM;G@Fv(ju>GQc=+tOi3056cg-!i<Kb&{%<P?_^bcVAv1`-LuTrp0Knfc|62m&
zpD;hb0sm7T1mf>J$bVq{Z+Afd#5#lr{HGfsh`(=y{_6|<cklC`AZ)0B|Kfx~{OyGP
rSD62P;{S#L`4>zu8Q`DiAL8%x|2GE2UpYAd#Gl9X&t`SXzh?gjhkw_L
--- 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.10 2001/09/05 14:35:53 julians Exp $
+// Version:     $Id: symbols.h,v 1.11 2001/09/25 09:52:56 julians Exp $
 // Purpose:
 // Description: Some important symbols, such as the version
 // Requires:
@@ -43,5 +43,5 @@
 //
 //===========================================================================
 
-#define ecCONFIGURATION_TOOL_VERSION        2.07
+#define ecCONFIGURATION_TOOL_VERSION        2.08
 
--- a/packages/ChangeLog
+++ b/packages/ChangeLog
@@ -1,3 +1,12 @@
+2001-09-18  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* ecos.db: Add i386 PC wallclock driver package, and include it
+	in the PC target.
+
+2001-09-13  Jesper Skov  <jskov@redhat.com>
+
+	* ecos.db: Added flash support to EDK7708.
+
 2001-09-10  Nick Garnett  <nickg@redhat.com>
 
 	* ecos.db:
@@ -219,6 +228,10 @@ 2000-11-30  Jesper Skov  <jskov@redhat.c
 	* ecos.db: Added Ocelot packages.
 
 
+2000-11-28  Nick Garnett  <nickg@cygnus.co.uk>
+
+	* ecos.db: Added entry for loader package.
+	
 2000-11-25  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* pkgconf/rules.mak (mlt_headers): Rewrite to work under Solaris,
--- a/packages/NEWS
+++ b/packages/NEWS
@@ -1,3 +1,6 @@
+* Added rudimentary ELF loader, including support for dynamic objects under
+  services/loader.
+* Dallas wallclock driver implemented for x86 PC.
 * AMD PCNet ethernet driver added.
 * Generic SMP support added.
 * RedBoot support added to AM33-STB port.
--- a/packages/compat/posix/current/ChangeLog
+++ b/packages/compat/posix/current/ChangeLog
@@ -1,3 +1,19 @@
+2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/mqueue.cxx (mq_open): Conditionalize use of sigev correctly.
+	(mq_close): Similarly.
+
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/pthread.cdl (CYGNUM_POSIX_MAIN_DEFAULT_PRIORITY): Clarify
+	POSIX thread priority description.
+
+2001-09-28  Jesper Skov  <jskov@redhat.com>
+
+	* cdl/pthread.cdl: Changed default priority of POSIX main to
+	16. This allows service threads (such as DHCP thread) to run when
+	started from main().
+
 2001-09-10  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/pthread.h: Separate mutex and condvar API into separate
--- a/packages/compat/posix/current/cdl/pthread.cdl
+++ b/packages/compat/posix/current/cdl/pthread.cdl
@@ -170,13 +170,15 @@ cdl_component CYGPKG_POSIX_MAIN_THREAD {
 	     display        "main()'s default thread priority"
 	     flavor         data
 	     legal_values   0 to 31
-	     default_value  30
+	     default_value  16
 	     description    "
                 POSIX compatibility requires that the application's
                 main() function be invoked in a thread.
-		This option controls the priority of that thread. Its
-		default value makes it the second highest priority in
-		the system."
+		This option controls the priority of that thread. This
+                priority is the POSIX priority and is NOT the same as
+                an eCos thread priority. With POSIX thread priorities,
+                lower numbers are lower priority, and higher numbers are
+                higher priority."
 	}
 }
 
--- a/packages/compat/posix/current/src/mqueue.cxx
+++ b/packages/compat/posix/current/src/mqueue.cxx
@@ -317,7 +317,9 @@ mq_open( const char *name, int oflag, ..
         mqtab[i].maxmsg  = attr->mq_maxmsg;
         mqtab[i].msgsize = attr->mq_msgsize;
         mqtab[i].unlinkme = false;
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
         mqtab[i].sigev = NULL;
+#endif
         strncpy( mqtab[i].name, name, PATH_MAX );
 
         // initialize first mqtab[i].users
@@ -420,6 +422,7 @@ mq_close( mqd_t mqdes )
     // perhaps should return EBADF instead of assert?
     CYG_ASSERT( tabent->users != NULL, "Null message queue user list" );
 
+#ifdef CYGFUN_POSIX_MQUEUE_NOTIFY
     // deregister notification iff this was the message queue descriptor
     // that was used to register it (POSIX says)
     if ( true == user->notifieruser ) {
@@ -427,6 +430,7 @@ mq_close( mqd_t mqdes )
         tabent->sigev = NULL;
         // not worth clearing notifieruser
     }
+#endif
 
     // find in the list for this queue and remove - sucks a bit, but seems
     // best over all - the list shouldn't be too long
--- a/packages/devs/eth/amd/pcnet/current/ChangeLog
+++ b/packages/devs/eth/amd/pcnet/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-12  Jesper Skov  <jskov@redhat.com>
+
+	* src/amd_pcnet.h: fix warning.
+
 2001-07-26  Jesper Skov  <jskov@redhat.com>
 
 	* src/if_pcnet.c (amd_pcnet_init): Wait for init table loadup
--- a/packages/devs/eth/amd/pcnet/current/src/amd_pcnet.h
+++ b/packages/devs/eth/amd/pcnet/current/src/amd_pcnet.h
@@ -524,5 +524,5 @@ put_reg(struct eth_drv_sc *sc, int regno
 }
 
 // ------------------------------------------------------------------------
-#endif CYGONCE_DEVS_ETH_AMD_PCNET_H
+#endif // CYGONCE_DEVS_ETH_AMD_PCNET_H
 // EOF amd_pcnet.h
--- a/packages/devs/eth/arm/ebsa285/current/ChangeLog
+++ b/packages/devs/eth/arm/ebsa285/current/ChangeLog
@@ -1,5 +1,5 @@
 2001-08-31  Hugo Tyson  <hmt@redhat.com>
-2001-08-31  Andrew Lunn <Andrew.Lunn@ascom.ch>
+2001-08-31  Sanjay Bisen <sanjay.bisen@ascom.ch>
 
 	* src/if_ebsa285.c (TxDone): Check from prev change is moved to
 	the logical driver.  Also, we zero the key in global state before
--- a/packages/devs/eth/arm/edb7xxx/current/ChangeLog
+++ b/packages/devs/eth/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-25  Gary Thomas  <gthomas@redhat.com>
+
+	* src/if_edb7xxx.c (edb7xxx_cs8900_init): Handle case where device
+	doesn't work - instead of just hanging.
+
 2001-08-15  Gary Thomas  <gthomas@redhat.com>
 
 	* src/if_edb7xxx.c (cs8900_send): Only start transmitter after
--- a/packages/devs/eth/arm/edb7xxx/current/src/cs8900.h
+++ b/packages/devs/eth/arm/edb7xxx/current/src/cs8900.h
@@ -63,7 +63,6 @@
 #define CS8900_ISQ    *(volatile unsigned short *)(CS8900_BASE+0x10)
 #define CS8900_PPTR   *(volatile unsigned short *)(CS8900_BASE+0x14)
 #define CS8900_PDATA  *(volatile unsigned short *)(CS8900_BASE+0x18)
-
 #define ISQ_RxEvent     0x04
 #define ISQ_TxEvent     0x08
 #define ISQ_BufEvent    0x0C
@@ -197,8 +196,10 @@
 static __inline__ unsigned short
 get_reg(int regno)
 {
+    unsigned short val;
     CS8900_PPTR = regno;
-    return CS8900_PDATA;
+    val = CS8900_PDATA;
+    return val;
 }
 
 static __inline__ void
--- a/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c
+++ b/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c
@@ -167,6 +167,7 @@ edb7xxx_cs8900_init(struct cyg_netdevtab
     struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance;
     unsigned short chip_type, chip_rev, chip_status;
     int i;
+    long timeout = 500000;
 
     // Initialize environment, setup interrupt handler
     cyg_drv_interrupt_create(CYGNUM_HAL_INTERRUPT_EINT3,
@@ -199,6 +200,10 @@ edb7xxx_cs8900_init(struct cyg_netdevtab
 #if 0
     diag_printf("CS8900 - type: %x, rev: %x\n", chip_type, chip_rev);
 #endif
+    if (chip_type != 0x630e) {
+        diag_printf("CS8900 - invalid device: %x, must be 0x630E\n", chip_type);
+        return false;
+    }
 
     // Fetch hardware address
 #if defined(CYGPKG_REDBOOT) && \
@@ -214,7 +219,12 @@ edb7xxx_cs8900_init(struct cyg_netdevtab
 #endif
 
     put_reg(PP_SelfCtl, PP_SelfCtl_Reset);  // Reset chip
-    while ((get_reg(PP_SelfStat) & PP_SelfStat_InitD) == 0) ;  
+    while ((get_reg(PP_SelfStat) & PP_SelfStat_InitD) == 0) {
+        if (--timeout <= 0) {
+            diag_printf("CS8900 didn't reset - abort!\n");
+            return false;
+        }
+    }
 
     chip_status = get_reg(PP_SelfStat);
 #if 0
--- a/packages/devs/eth/intel/i82559/current/ChangeLog
+++ b/packages/devs/eth/intel/i82559/current/ChangeLog
@@ -1,3 +1,21 @@
+2001-09-20  Gary Thomas  <gthomas@redhat.com>
+
+	* src/if_i82559.c: Add declaration of 'i82559_stop' to quiet warning.
+
+2001-09-13  Hugo Tyson  <hmt@redhat.com>
+
+	* cdl/intel_i82559_eth_drivers.cdl: 
+	* src/if_i82559.c: 
+	Remove the tickle thread from this driver.  The functionality is
+	now in the network timeout functionality which handles the
+	"deliver" calls.  So it's only called if the net is quiet.
+
+2001-09-12  Hugo Tyson  <hmt@redhat.com>
+
+	* src/if_i82559.c (TxDone): Defensive programming; zero the Tx key
+	in the global data before making the callback.  This change
+	appeared useful in our forebear, the EBSA-specific driver.
+
 2001-08-29  Hugo Tyson  <hmt@redhat.com>
 
 	* cdl/intel_i82559_eth_drivers.cdl: New CDL options called 
--- a/packages/devs/eth/intel/i82559/current/cdl/intel_i82559_eth_drivers.cdl
+++ b/packages/devs/eth/intel/i82559/current/cdl/intel_i82559_eth_drivers.cdl
@@ -136,41 +136,5 @@ cdl_package CYGPKG_DEVS_ETH_INTEL_I82559
                 global flags."
         }
     }
-
-    cdl_component CYGPKG_DEVS_ETH_INTEL_I82559_TICKLE_THREAD {
-        display "Create a thread to 'unstick' from lost interrupts"
-        active_if CYGPKG_KERNEL
-        active_if CYGPKG_NET
-        default_value 0
-        description "
-            If this is enabled, the driver creates a thread to 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, provided
-            that it tries to send packets itself from time to time - or
-            uses TCP, or amy 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_DEVS_ETH_INTEL_I82559_TICKLE_THREAD_PRIORITY {
-            display "Priority of i82559 tickle thread"
-            flavor data
-            default_value CYGPKG_NET_THREAD_PRIORITY + 2
-            description "
-                The default is two below the net thread, which is one below
-                the default prio of the DHCP thread."
-        }
-
-        cdl_option CYGNUM_DEVS_ETH_INTEL_I82559_TICKLE_THREAD_DELAY {
-            display "Delay in kernel clocks of i82559 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."
-        }
-    }
 }
 # EOF intel_i82559_eth_drivers.cdl
--- a/packages/devs/eth/intel/i82559/current/src/if_i82559.c
+++ b/packages/devs/eth/intel/i82559/current/src/if_i82559.c
@@ -859,17 +859,6 @@ static int
 write_enable_eeprom(long ioaddr,  int addr_len);
 #endif
 
-#ifdef CYGPKG_KERNEL
-#ifdef CYGPKG_NET
-#ifdef CYGPKG_DEVS_ETH_INTEL_I82559_TICKLE_THREAD
-
-static void
-starti82559ticklethread( void );
-
-#endif // CYGPKG_DEVS_ETH_INTEL_I82559_TICKLE_THREAD
-#endif // CYGPKG_NET
-#endif // CYGPKG_KERNEL
-
 // debugging/logging only:
 void dump_txcb(TxCB* p_txcb);
 void DisplayStatistics(void);
@@ -878,6 +867,8 @@ 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 i82559_stop( struct eth_drv_sc *sc );
+
 // ------------------------------------------------------------------------
 // utilities
 // ------------------------------------------------------------------------
@@ -1312,15 +1303,6 @@ i82559_init(struct cyg_netdevtab_entry *
 #endif
             return 0;
         }
-#ifdef CYGPKG_KERNEL
-#ifdef CYGPKG_NET
-#ifdef CYGPKG_DEVS_ETH_INTEL_I82559_TICKLE_THREAD
-
-        starti82559ticklethread();
-
-#endif // CYGPKG_DEVS_ETH_INTEL_I82559_TICKLE_THREAD
-#endif // CYGPKG_NET
-#endif // CYGPKG_KERNEL
     }
 
     // If this device is not present, exit
@@ -2122,10 +2104,14 @@ TxDone(struct i82559* p_i82559)
              ( ( ! p_i82559->tx_queue_full) || (0 == txstatus) ) )
             break;
 
+        // 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 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 )
@@ -3582,90 +3568,4 @@ update_statistics(struct i82559* p_i8255
 
 // ------------------------------------------------------------------------
 
-#ifdef CYGPKG_KERNEL
-#ifdef CYGPKG_NET
-#ifdef CYGPKG_DEVS_ETH_INTEL_I82559_TICKLE_THREAD
-
-// Then we create a thread to tickle the device(s) periodically
-// to unblock them when the hardware has become wedged.
-// 
-// This is not necessary if a networked app is running, provided that it
-// tries to "send stuff" itself from time to time - or uses TCP, or amy
-// similar protocol which exchanges "keep-alive" packets periodically and
-// often enough.
-
-#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL)
-static char i82559tickle_stack[STACK_SIZE];
-static cyg_thread i82559tickle_thread_data;
-static cyg_handle_t i82559tickle_thread_handle;
-
-static int
-Poll82559ForTxLockupTimeout( void )
-{
-    struct eth_drv_sc *sc;
-    struct cyg_netdevtab_entry *ndp;
-    struct i82559 *p_i82559;
-    int i;
-#ifdef CYGDBG_USE_ASSERTS
-    int lockto = missed_interrupt.lockup_timeouts;
-#endif
-    for ( i = 0; i < CYGNUM_DEVS_ETH_INTEL_I82559_DEV_COUNT; i++ ) {
-        p_i82559 = i82559_priv_array[i];
-        ndp = (struct cyg_netdevtab_entry *)(p_i82559->ndp);
-        sc = (struct eth_drv_sc *)(ndp->device_instance);
-        if ( p_i82559->active )
-            (void)i82559_can_send( sc ); // This is a neat way to advance
-    }
-    return 
-#ifdef CYGDBG_USE_ASSERTS
-        (missed_interrupt.lockup_timeouts - lockto)
-#endif
-        +0;
-}
-
-static void
-i82559tickle( cyg_addrword_t param )
-{
-    int spl, to;
-
-    while( 1 ) {
-        cyg_thread_delay(CYGNUM_DEVS_ETH_INTEL_I82559_TICKLE_THREAD_DELAY);
-
-        spl = splnet();
-        to = Poll82559ForTxLockupTimeout();
-        splx(spl);
-
-#ifdef DEBUG
-#ifdef CYGDBG_USE_ASSERTS
-        if ( to )
-            diag_printf( "###Lockup detected: %d this time, total %d\n",
-                         to, missed_interrupt.lockup_timeouts );
-#endif
-#endif
-    }
-}
-
-
-static void
-starti82559ticklethread( void )
-{
-    // Create background thread
-    cyg_thread_create(CYGNUM_DEVS_ETH_INTEL_I82559_TICKLE_THREAD_PRIORITY,
-                      i82559tickle,                 // entry
-                      0,                            // entry parameter
-                      "i82559 ethernet tickle",     // Name
-                      &i82559tickle_stack[0],       // Stack
-                      STACK_SIZE,                   // Size
-                      &i82559tickle_thread_handle,  // Handle
-                      &i82559tickle_thread_data     // Thread data structure
-        );
-    cyg_thread_resume(i82559tickle_thread_handle);    // Start it
-}
-
-#endif // CYGPKG_DEVS_ETH_INTEL_I82559_TICKLE_THREAD
-#endif // CYGPKG_NET
-#endif // CYGPKG_KERNEL
-
-// ------------------------------------------------------------------------
-
 // EOF if_i82559.c
--- a/packages/devs/eth/ns/dp83902a/current/ChangeLog
+++ b/packages/devs/eth/ns/dp83902a/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-12  Jesper Skov  <jskov@redhat.com>
+
+	* src/if_dp83902a.c: Apply a little more DMA magic.
+
 2001-08-25  Gary Thomas  <gthomas@redhat.com>
 
 	* include/dp83902a.h (DP_DATAPORT): Add - used by ESA discovery
--- a/packages/devs/eth/ns/dp83902a/current/src/if_dp83902a.c
+++ b/packages/devs/eth/ns/dp83902a/current/src/if_dp83902a.c
@@ -331,6 +331,11 @@ dp83902a_send(struct eth_drv_sc *sc, str
 
     pkt_len = total_len;
     if (pkt_len < IEEE_8023_MIN_FRAME) pkt_len = IEEE_8023_MIN_FRAME;
+#ifdef CYGHWR_NS_DP83902A_PLF_16BIT_DATA
+    // Make length even when using 16 bit transfers
+    if (pkt_len % 2) pkt_len++;
+#endif
+
     start_page = dp->tx_next;
     if (dp->tx_next == DP_TX_BUF1) {
         dp->tx1 = start_page;
@@ -350,9 +355,25 @@ dp83902a_send(struct eth_drv_sc *sc, str
 #endif
 
     DP_OUT(base, DP_ISR, DP_ISR_RDC);  // Clear end of DMA
-    // Set these first, following the small print of the manual
-    DP_OUT(base, DP_RBCL, 1);
-    DP_OUT(base, DP_CR, DP_CR_PAGE0 | DP_CR_RDMA | DP_CR_START);
+    {
+        // Dummy read. The manual sez something slightly different,
+        // but the code is extended a bit to do what Hitachi's monitor
+        // does (i.e., also read data).
+
+        cyg_uint16 tmp;
+#ifdef CYGHWR_NS_DP83902A_PLF_16BIT_DATA
+        int len = 2;
+#else
+        int len = 1;
+#endif
+
+        DP_OUT(base, DP_RSAL, 0x100-len);
+        DP_OUT(base, DP_RSAH, (start_page-1) & 0xff);
+        DP_OUT(base, DP_RBCL, len);
+        DP_OUT(base, DP_RBCH, 0);
+        DP_OUT(base, DP_CR, DP_CR_PAGE0 | DP_CR_RDMA | DP_CR_START);
+        DP_IN_DATA(dp->data, tmp);
+    }
 
 #ifdef CYGHWR_NS_DP83902A_PLF_BROKEN_TX_DMA
     // Stall for a bit before continuing to work around random data
--- a/packages/devs/flash/amd/am29xxxxx/current/ChangeLog
+++ b/packages/devs/flash/amd/am29xxxxx/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-09-26  Gary Thomas  <gthomas@redhat.com>
+
+	* include/flash_am29xxxxx.inl (flash_erase_block): 
+	New platform control - CYGHWR_FLASH_AM29XXXXX_NO_WRITE_PROTECT.
+	Define this if the write-protect feature is non-functional/missing.
+
 2001-08-16  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/flash_am29xxxxx.inl: Double erase timeouts for faster CPUs.
--- a/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl
+++ b/packages/devs/flash/amd/am29xxxxx/current/include/flash_am29xxxxx.inl
@@ -288,6 +288,7 @@ flash_erase_block(void* block, unsigned 
     }
 
     while (len > 0) {
+#ifndef CYGHWR_FLASH_AM29XXXXX_NO_WRITE_PROTECT
         // First check whether the block is protected
         *f_s1 = FLASH_Setup_Code1;
         *f_s2 = FLASH_Setup_Code2;
@@ -297,6 +298,7 @@ flash_erase_block(void* block, unsigned 
 
         if (FLASH_unlocked != state)
             return FLASH_ERR_PROTECT;
+#endif
 
         b_v = FLASH_P2V(b_p);
     
--- a/packages/devs/flash/arm/ebsa285/current/ChangeLog
+++ b/packages/devs/flash/arm/ebsa285/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/ebsa285_flash.c (flash_hwr_init): Only re-enable icache if it
+	was enabled before.
+
 2001-07-11  Andrew Lunn <andrew.lunn@ascom.ch>
 
 	* src/flash.h:
--- a/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c
+++ b/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c
@@ -57,18 +57,20 @@ flash_hwr_init(void)
     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;
+    int code_len, stat, num_regions, region_size, icache_isenabled;
 
     // 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_ICACHE_IS_ENABLED(icache_isenabled);
     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 (icache_isenabled)
+        HAL_ICACHE_ENABLE();
 
     if ((data[0] == FLASH_Intel_code) && ((data[4] == FLASH_28F008SA) ||
 					  (data[4] == FLASH_28F008SC))) {
--- a/packages/devs/flash/arm/iq80310/current/ChangeLog
+++ b/packages/devs/flash/arm/iq80310/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/iq80310_flash.c (flash_hwr_init): Only re-enable icache if it
+	was enabled before.
+
 2001-08-04  Mark Salter  <msalter@redhat.com>
 
 	* src/flash.h (FLASH_P2V): First 4K of flash now mapped at 0xd0000000.
--- a/packages/devs/flash/arm/iq80310/current/src/iq80310_flash.c
+++ b/packages/devs/flash/arm/iq80310/current/src/iq80310_flash.c
@@ -59,18 +59,20 @@ flash_hwr_init(void)
     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;
+    int code_len, stat, num_regions, region_size, icache_isenabled;
 
     // 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_ICACHE_IS_ENABLED(icache_isenabled);
     HAL_DCACHE_SYNC();  // Should guarantee this code will run
     HAL_ICACHE_DISABLE(); // is also required to avoid old contents
 
     memset(&data,0,sizeof(data));
     stat = (*_flash_query)((void*)&data);
-    HAL_ICACHE_ENABLE();
+    if (icache_isenabled)
+        HAL_ICACHE_ENABLE();
 
     qp = &data;
     if (/*(qp->manuf_code == FLASH_Intel_code) && */
--- a/packages/devs/flash/arm/sa1100mm/current/ChangeLog
+++ b/packages/devs/flash/arm/sa1100mm/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/sa1100mm_flash.c (flash_hwr_init): Only re-enable icache if it
+	was enabled before.
+
 2001-06-11  Gary Thomas  <gthomas@redhat.com>
 
 	* src/sa1100mm_flash.c: Remove dependency on printf() via user functions.
--- a/packages/devs/flash/arm/sa1100mm/current/src/sa1100mm_flash.c
+++ b/packages/devs/flash/arm/sa1100mm/current/src/sa1100mm_flash.c
@@ -57,18 +57,20 @@ flash_hwr_init(void)
     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;
+    int code_len, stat, num_regions, region_size, icache_isenabled;
 
     // 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_ICACHE_IS_ENABLED(icache_isenabled);
     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 (icache_isenabled)
+        HAL_ICACHE_ENABLE();
 
     if ((data[0] == FLASH_Intel_code) &&
         (data[4] == FLASH_28F016SV_low) &&
--- a/packages/devs/flash/atmel/at29cxxxx/current/ChangeLog
+++ b/packages/devs/flash/atmel/at29cxxxx/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-09-13  Jesper Skov  <jskov@redhat.com>
+
+	* include/flash_at29cxxxx.inl: Added support for AT29LV1024. Added
+	code to erase blocks. Made driver work with 16bit wide
+	parts. Fixed flash size calculations.
+
 2001-05-23  Jesper Skov  <jskov@redhat.com>
 
 	* cdl/flash_atmel_at29cxxxx.cdl: Links functions to RAM. IO driver
--- a/packages/devs/flash/atmel/at29cxxxx/current/include/flash_at29cxxxx.inl
+++ b/packages/devs/flash/atmel/at29cxxxx/current/include/flash_at29cxxxx.inl
@@ -88,6 +88,15 @@
 # define CYGNUM_FLASH_ID_MANUFACTURER   FLASHWORD(0x1F)
 # define CYGNUM_FLASH_ID_DEVICE         FLASHWORD(0xA4)
 #endif
+#ifdef CYGPKG_DEVS_FLASH_ATMEL_AT29LV1024
+# define FLASH_BLOCK_SIZE               (0x100*CYGNUM_FLASH_INTERLEAVE)
+# define FLASH_NUM_REGIONS              (512)
+# define CYGNUM_FLASH_BASE_MASK         (0xFFFe0000u) // 128kB devices
+# define CYGNUM_FLASH_WIDTH             (16)
+# define CYGNUM_FLASH_BLANK             (1)
+# define CYGNUM_FLASH_ID_MANUFACTURER   FLASHWORD(0x1F)
+# define CYGNUM_FLASH_ID_DEVICE         FLASHWORD(0x26)
+#endif
 
 #define FLASH_DEVICE_SIZE               (FLASH_BLOCK_SIZE*FLASH_NUM_REGIONS)
 #define CYGNUM_FLASH_DEVICES            (CYGNUM_FLASH_INTERLEAVE*CYGNUM_FLASH_SERIES)
@@ -123,10 +132,10 @@ flash_hwr_init(void)
         return FLASH_ERR_DRV_WRONG_PART;
 
     // Hard wired for now
-    flash_info.block_size = FLASH_BLOCK_SIZE * CYGNUM_FLASH_INTERLEAVE;
+    flash_info.block_size = FLASH_BLOCK_SIZE;
     flash_info.blocks = FLASH_NUM_REGIONS;
     flash_info.start = (void *)CYGNUM_FLASH_BASE;
-    flash_info.end = (void *)(CYGNUM_FLASH_BASE+ (FLASH_NUM_REGIONS * FLASH_BLOCK_SIZE * CYGNUM_FLASH_INTERLEAVE * CYGNUM_FLASH_SERIES));
+    flash_info.end = (void *)(CYGNUM_FLASH_BASE+ (FLASH_NUM_REGIONS * FLASH_BLOCK_SIZE * CYGNUM_FLASH_SERIES));
     return FLASH_ERR_OK;
 }
 
@@ -191,10 +200,63 @@ flash_query(void* data)
 //----------------------------------------------------------------------------
 // Erase Block
 int
-flash_erase_block(void* block, unsigned int size)
+flash_erase_block(void* block, unsigned int len)
 {
-    // Erasing is not necessary. Alternatively, use program function
-    // to write 0xff
+    volatile flash_data_t* ROM;
+    volatile flash_data_t* addr_ptr = (volatile flash_data_t*) block;
+    volatile flash_data_t* addr_ptr2;
+
+    int res = FLASH_ERR_OK;
+
+    while ((FLASH_ERR_OK == res) && (len > 0)) {
+        int len2, i, timeout;
+        flash_data_t state, prev_state;
+
+        // Base address of device(s) being programmed. 
+        ROM = (volatile flash_data_t*)((unsigned long)block & ~(FLASH_DEVICE_SIZE-1));
+
+        // Program data [byte] - 4 step sequence
+        ROM[FLASH_Setup_Addr1] = FLASH_Setup_Code1;
+        ROM[FLASH_Setup_Addr2] = FLASH_Setup_Code2;
+        ROM[FLASH_Setup_Addr1] = FLASH_Program;
+
+        addr_ptr2 = addr_ptr;
+        len2 = len;
+
+        // Always load 256 bytes
+        for (i = 0; i < 256;) {
+            *addr_ptr2++ = FLASH_BlankValue;
+            i += sizeof(*addr_ptr2);
+        }
+
+        // Wait for completion (bit 6 stops toggling)
+        timeout = 5000000;
+        prev_state = *addr_ptr & FLASH_Busy;
+        while (true) {
+            state = *addr_ptr & FLASH_Busy;
+            if (prev_state == state) {
+                break;
+            }
+            if (--timeout == 0) {
+                res = FLASH_ERR_DRV_TIMEOUT;
+                break;
+            }
+            prev_state = state;
+        }
+
+        // Verify loaded data bytes
+        for (i = 0; (len > 0) && (i < 256) ;) {
+            if (*addr_ptr != FLASH_BlankValue) {
+                // Only update return value if erase operation was OK
+                if (FLASH_ERR_OK == res) res = FLASH_ERR_DRV_VERIFY;
+                break;
+            }
+            addr_ptr++;
+            len -= sizeof(*addr_ptr);
+            i += sizeof(*addr_ptr);
+        }
+    }
+
     return FLASH_ERR_OK;
 }
 
@@ -235,13 +297,14 @@ flash_program_buf(void* addr, void* data
         len2 = len;
 
         // Always load 256 bytes
-        for (i = 0; i < 256; i++) {
+        for (i = 0; i < 256;) {
             if (len2 > 0) {
                 *addr_ptr2++ = *data_ptr2++;
-                len2 -= sizeof(*data_ptr);
+                len2 -= sizeof(*data_ptr2);
             } else {
                 *addr_ptr2++ = FLASH_BlankValue;
             }
+            i += sizeof(*data_ptr2);
         }
 
         // Wait for completion (bit 6 stops toggling)
@@ -260,7 +323,7 @@ flash_program_buf(void* addr, void* data
         }
 
         // Verify loaded data bytes
-        for (i = 0; (len > 0) && (i < 256) ; i++) {
+        for (i = 0; (len > 0) && (i < 256) ;) {
             if (*addr_ptr != *data_ptr) {
                 // Only update return value if erase operation was OK
                 if (FLASH_ERR_OK == res) res = FLASH_ERR_DRV_VERIFY;
@@ -269,6 +332,7 @@ flash_program_buf(void* addr, void* data
             addr_ptr++;
             data_ptr++;
             len -= sizeof(*data_ptr);
+            i += sizeof(*data_ptr);
         }
     }
 
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/sh/edk7708/current/ChangeLog
@@ -0,0 +1,29 @@
+2001-09-13  Jesper Skov  <jskov@redhat.com>
+
+	* Cloned from ARM PID 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####
+//===========================================================================
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/sh/edk7708/current/cdl/flash_sh_edk7708.cdl
@@ -0,0 +1,60 @@
+# ====================================================================
+#
+#      flash_edk7708.cdl
+#
+#      FLASH memory - Hardware support on Hitachi EDK7708 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####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      gthomas, hmt, jskov
+# Original data:  gthomas
+# Contributors:   gthomas
+# Date:           2001-02-20
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVS_FLASH_SH_EDK7708 {
+    display       "Hitachi EDK7708 board FLASH memory support"
+    description   "FLASH memory device support for Hitachi EDK7708 board"
+
+    parent        CYGPKG_IO_FLASH
+    active_if	  CYGPKG_IO_FLASH
+    requires	  CYGPKG_HAL_SH_EDK7708
+
+    compile       sh_edk7708_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_ATMEL_AT29CXXXX_REQUIRED {
+        display   "Generic AMD AM29F040 driver required"
+    }
+
+    implements    CYGINT_DEVS_FLASH_ATMEL_AT29CXXXX_REQUIRED
+}
new file mode 100644
--- /dev/null
+++ b/packages/devs/flash/sh/edk7708/current/src/sh_edk7708_flash.c
@@ -0,0 +1,56 @@
+//==========================================================================
+//
+//      sh_edk7708_flash.c
+//
+//      Flash programming for Atmel device on Hitachi EDK7708 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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    jskov
+// Contributors: jskov
+// Date:         2001-09-13
+// Purpose:      
+// Description:  
+//              
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+// There's a single AT29C1024 on the EDK7708 board.
+
+#define CYGPKG_DEVS_FLASH_ATMEL_AT29LV1024
+#define CYGNUM_FLASH_INTERLEAVE	(1)
+#define CYGNUM_FLASH_SERIES	(1)
+#define CYGNUM_FLASH_BASE 	(0x80000000u)
+
+#include "cyg/io/flash_at29cxxxx.inl"
+
+
+// ------------------------------------------------------------------------
+// EOF sh_edk7708_flash.c
--- a/packages/devs/serial/arm/at91/current/ChangeLog
+++ b/packages/devs/serial/arm/at91/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-20  Jesper Skov  <jskov@redhat.com>
+
+	* src/at91_serial.c (at91_serial_init): Use valid interrupt priority.
+
 2001-09-10  Jonathan Larmour  <jlarmour@redhat.com>
 
         * cdl/ser_arm_at91.cdl:        
--- a/packages/devs/serial/arm/at91/current/src/at91_serial.c
+++ b/packages/devs/serial/arm/at91/current/src/at91_serial.c
@@ -217,7 +217,7 @@ at91_serial_init(struct cyg_devtab_entry
     (chan->callbacks->serial_init)(chan);  // Really only required for interrupt driven devices
     if (chan->out_cbuf.len != 0) {
         cyg_drv_interrupt_create(at91_chan->int_num,
-                                 99,                     // Priority - unused
+                                 4,                      // Priority
                                  (cyg_addrword_t)chan,   // Data item passed to interrupt handler
                                  at91_serial_ISR,
                                  at91_serial_DSR,
--- a/packages/devs/serial/mips/vrc437x/current/ChangeLog
+++ b/packages/devs/serial/mips/vrc437x/current/ChangeLog
@@ -1,3 +1,11 @@
+2001-09-18  Nick Garnett  <nickg@redhat.com>
+
+	* cdl/ser_mips_vrc437x.cdl: 
+	* src/vrc437x_serial.h:
+	* src/vrc437x_serial.c:
+	Fixed VRC4373 -> VRC437X conversions that were missed.
+	Also made default baud rates 38400 rather than 9600.
+	
 2001-09-10  Jonathan Larmour  <jlarmour@redhat.com>
 
         * cdl/ser_mips_vrc437x.cdl:        
--- a/packages/devs/serial/mips/vrc437x/current/cdl/ser_mips_vrc437x.cdl
+++ b/packages/devs/serial/mips/vrc437x/current/cdl/ser_mips_vrc437x.cdl
@@ -53,7 +53,7 @@ cdl_package CYGPKG_IO_SERIAL_MIPS_VRC437
     include_files ; # none _exported_ whatsoever
     description   "
            This option enables the serial device drivers for the
-           VRC4373."
+           VRC437X."
     doc           redirect/ecos-device-drivers.html
 
     compile       -library=libextras.a   vrc437x_serial.c
@@ -86,7 +86,7 @@ cdl_component CYGPKG_IO_SERIAL_MIPS_VRC4
         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 9600
+        default_value 38400
         description   "
             This option specifies the default baud rate (speed) for the
             VRC437X port 0."
@@ -124,7 +124,7 @@ cdl_component CYGPKG_IO_SERIAL_MIPS_VRC4
         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 9600
+        default_value 38400
         description   "
             This option specifies the default baud rate (speed) for the
             VRC437X port 1."
--- a/packages/devs/serial/mips/vrc437x/current/src/vrc437x_serial.c
+++ b/packages/devs/serial/mips/vrc437x/current/src/vrc437x_serial.c
@@ -1,8 +1,8 @@
 //==========================================================================
 //
-//      io/serial/mips/vrc4373_serial.c
+//      io/serial/mips/vrc437x_serial.c
 //
-//      Mips VRC4373 Serial I/O Interface Module (interrupt driven)
+//      Mips VRC437X Serial I/O Interface Module (interrupt driven)
 //
 //==========================================================================
 //####COPYRIGHTBEGIN####
@@ -34,7 +34,7 @@
 // Author(s):    gthomas
 // Contributors: gthomas
 // Date:         1999-04-15
-// Purpose:      VRC4373 Serial I/O module (interrupt driven version)
+// Purpose:      VRC437X Serial I/O module (interrupt driven version)
 // Description: 
 //
 //####DESCRIPTIONEND####
@@ -49,73 +49,73 @@
 #include <cyg/io/devtab.h>
 #include <cyg/io/serial.h>
 
-#ifdef CYGPKG_IO_SERIAL_MIPS_VRC4373
+#ifdef CYGPKG_IO_SERIAL_MIPS_VRC437X
 
-#include "vrc4373_serial.h"
+#include "vrc437x_serial.h"
 
 #if defined(CYGPKG_HAL_MIPS_LSBFIRST)
-#define VRC4373_SCC_BASE 0xC1000000
+#define VRC437X_SCC_BASE 0xC1000000
 #elif defined(CYGPKG_HAL_MIPS_MSBFIRST)
-#define VRC4373_SCC_BASE 0xC1000003
+#define VRC437X_SCC_BASE 0xC1000003
 #else
 #error MIPS endianness not defined by configuration
 #endif
 
-#define VRC4373_SCC_INT  CYGNUM_HAL_INTERRUPT_DUART
+#define VRC437X_SCC_INT  CYGNUM_HAL_INTERRUPT_DUART
 #define SCC_CHANNEL_A             4
 #define SCC_CHANNEL_B             0
 
 extern void diag_printf(const char *fmt, ...);
 
-typedef struct vrc4373_serial_info {
+typedef struct vrc437x_serial_info {
     CYG_ADDRWORD   base;
     unsigned char  regs[16];   // Known register state (since hardware is write-only!)
-} vrc4373_serial_info;
+} vrc437x_serial_info;
 
-static bool vrc4373_serial_init(struct cyg_devtab_entry *tab);
-static bool vrc4373_serial_putc(serial_channel *chan, unsigned char c);
-static Cyg_ErrNo vrc4373_serial_lookup(struct cyg_devtab_entry **tab, 
+static bool vrc437x_serial_init(struct cyg_devtab_entry *tab);
+static bool vrc437x_serial_putc(serial_channel *chan, unsigned char c);
+static Cyg_ErrNo vrc437x_serial_lookup(struct cyg_devtab_entry **tab, 
                                        struct cyg_devtab_entry *sub_tab,
                                        const char *name);
-static unsigned char vrc4373_serial_getc(serial_channel *chan);
-static Cyg_ErrNo vrc4373_serial_set_config(serial_channel *chan, cyg_uint32 key,
+static unsigned char vrc437x_serial_getc(serial_channel *chan);
+static Cyg_ErrNo vrc437x_serial_set_config(serial_channel *chan, cyg_uint32 key,
                                            const void *xbuf, cyg_uint32 *len);
-static void vrc4373_serial_start_xmit(serial_channel *chan);
-static void vrc4373_serial_stop_xmit(serial_channel *chan);
+static void vrc437x_serial_start_xmit(serial_channel *chan);
+static void vrc437x_serial_stop_xmit(serial_channel *chan);
 
-static cyg_uint32 vrc4373_serial_ISR(cyg_vector_t vector, cyg_addrword_t data);
-static void       vrc4373_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data);
+static cyg_uint32 vrc437x_serial_ISR(cyg_vector_t vector, cyg_addrword_t data);
+static void       vrc437x_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data);
 
-static SERIAL_FUNS(vrc4373_serial_funs, 
-                   vrc4373_serial_putc, 
-                   vrc4373_serial_getc,
-                   vrc4373_serial_set_config,
-                   vrc4373_serial_start_xmit,
-                   vrc4373_serial_stop_xmit
+static SERIAL_FUNS(vrc437x_serial_funs, 
+                   vrc437x_serial_putc, 
+                   vrc437x_serial_getc,
+                   vrc437x_serial_set_config,
+                   vrc437x_serial_start_xmit,
+                   vrc437x_serial_stop_xmit
     );
 
-#ifdef CYGPKG_IO_SERIAL_MIPS_VRC4373_SERIAL0
-static vrc4373_serial_info vrc4373_serial_info0 = {VRC4373_SCC_BASE+SCC_CHANNEL_A};
-#if CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL0_BUFSIZE > 0
-static unsigned char vrc4373_serial_out_buf0[CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL0_BUFSIZE];
-static unsigned char vrc4373_serial_in_buf0[CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL0_BUFSIZE];
+#ifdef CYGPKG_IO_SERIAL_MIPS_VRC437X_SERIAL0
+static vrc437x_serial_info vrc437x_serial_info0 = {VRC437X_SCC_BASE+SCC_CHANNEL_A};
+#if CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL0_BUFSIZE > 0
+static unsigned char vrc437x_serial_out_buf0[CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL0_BUFSIZE];
+static unsigned char vrc437x_serial_in_buf0[CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL0_BUFSIZE];
 
-static SERIAL_CHANNEL_USING_INTERRUPTS(vrc4373_serial_channel0,
-                                       vrc4373_serial_funs, 
-                                       vrc4373_serial_info0,
-                                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL0_BAUD),
+static SERIAL_CHANNEL_USING_INTERRUPTS(vrc437x_serial_channel0,
+                                       vrc437x_serial_funs, 
+                                       vrc437x_serial_info0,
+                                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL0_BAUD),
                                        CYG_SERIAL_STOP_DEFAULT,
                                        CYG_SERIAL_PARITY_DEFAULT,
                                        CYG_SERIAL_WORD_LENGTH_DEFAULT,
                                        CYG_SERIAL_FLAGS_DEFAULT,
-                                       &vrc4373_serial_out_buf0[0], sizeof(vrc4373_serial_out_buf0),
-                                       &vrc4373_serial_in_buf0[0], sizeof(vrc4373_serial_in_buf0)
+                                       &vrc437x_serial_out_buf0[0], sizeof(vrc437x_serial_out_buf0),
+                                       &vrc437x_serial_in_buf0[0], sizeof(vrc437x_serial_in_buf0)
     );
 #else
-static SERIAL_CHANNEL(vrc4373_serial_channel0,
-                      vrc4373_serial_funs, 
-                      vrc4373_serial_info0,
-                      CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL0_BAUD),
+static SERIAL_CHANNEL(vrc437x_serial_channel0,
+                      vrc437x_serial_funs, 
+                      vrc437x_serial_info0,
+                      CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL0_BAUD),
                       CYG_SERIAL_STOP_DEFAULT,
                       CYG_SERIAL_PARITY_DEFAULT,
                       CYG_SERIAL_WORD_LENGTH_DEFAULT,
@@ -123,38 +123,38 @@ static SERIAL_CHANNEL(vrc4373_serial_cha
     );
 #endif
 
-DEVTAB_ENTRY(vrc4373_serial_io0, 
-             CYGDAT_IO_SERIAL_MIPS_VRC4373_SERIAL0_NAME,
+DEVTAB_ENTRY(vrc437x_serial_io0, 
+             CYGDAT_IO_SERIAL_MIPS_VRC437X_SERIAL0_NAME,
              0,                     // Does not depend on a lower level interface
              &cyg_io_serial_devio, 
-             vrc4373_serial_init, 
-             vrc4373_serial_lookup,     // Serial driver may need initializing
-             &vrc4373_serial_channel0
+             vrc437x_serial_init, 
+             vrc437x_serial_lookup,     // Serial driver may need initializing
+             &vrc437x_serial_channel0
     );
-#endif //  CYGPKG_IO_SERIAL_MIPS_VRC4373_SERIAL0
+#endif //  CYGPKG_IO_SERIAL_MIPS_VRC437X_SERIAL0
 
-#ifdef CYGPKG_IO_SERIAL_MIPS_VRC4373_SERIAL1
-static vrc4373_serial_info vrc4373_serial_info1 = {VRC4373_SCC_BASE+SCC_CHANNEL_B};
-#if CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL1_BUFSIZE > 0
-static unsigned char vrc4373_serial_out_buf1[CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL1_BUFSIZE];
-static unsigned char vrc4373_serial_in_buf1[CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL1_BUFSIZE];
+#ifdef CYGPKG_IO_SERIAL_MIPS_VRC437X_SERIAL1
+static vrc437x_serial_info vrc437x_serial_info1 = {VRC437X_SCC_BASE+SCC_CHANNEL_B};
+#if CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL1_BUFSIZE > 0
+static unsigned char vrc437x_serial_out_buf1[CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL1_BUFSIZE];
+static unsigned char vrc437x_serial_in_buf1[CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL1_BUFSIZE];
 
-static SERIAL_CHANNEL_USING_INTERRUPTS(vrc4373_serial_channel1,
-                                       vrc4373_serial_funs, 
-                                       vrc4373_serial_info1,
-                                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL1_BAUD),
+static SERIAL_CHANNEL_USING_INTERRUPTS(vrc437x_serial_channel1,
+                                       vrc437x_serial_funs, 
+                                       vrc437x_serial_info1,
+                                       CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL1_BAUD),
                                        CYG_SERIAL_STOP_DEFAULT,
                                        CYG_SERIAL_PARITY_DEFAULT,
                                        CYG_SERIAL_WORD_LENGTH_DEFAULT,
                                        CYG_SERIAL_FLAGS_DEFAULT,
-                                       &vrc4373_serial_out_buf1[0], sizeof(vrc4373_serial_out_buf1),
-                                       &vrc4373_serial_in_buf1[0], sizeof(vrc4373_serial_in_buf1)
+                                       &vrc437x_serial_out_buf1[0], sizeof(vrc437x_serial_out_buf1),
+                                       &vrc437x_serial_in_buf1[0], sizeof(vrc437x_serial_in_buf1)
     );
 #else
-static SERIAL_CHANNEL(vrc4373_serial_channel1,
-                      vrc4373_serial_funs, 
-                      vrc4373_serial_info1,
-                      CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC4373_SERIAL1_BAUD),
+static SERIAL_CHANNEL(vrc437x_serial_channel1,
+                      vrc437x_serial_funs, 
+                      vrc437x_serial_info1,
+                      CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MIPS_VRC437X_SERIAL1_BAUD),
                       CYG_SERIAL_STOP_DEFAULT,
                       CYG_SERIAL_PARITY_DEFAULT,
                       CYG_SERIAL_WORD_LENGTH_DEFAULT,
@@ -162,28 +162,28 @@ static SERIAL_CHANNEL(vrc4373_serial_cha
     );
 #endif
 
-DEVTAB_ENTRY(vrc4373_serial_io1, 
-             CYGDAT_IO_SERIAL_MIPS_VRC4373_SERIAL1_NAME,
+DEVTAB_ENTRY(vrc437x_serial_io1, 
+             CYGDAT_IO_SERIAL_MIPS_VRC437X_SERIAL1_NAME,
              0,                     // Does not depend on a lower level interface
              &cyg_io_serial_devio, 
-             vrc4373_serial_init, 
-             vrc4373_serial_lookup,     // Serial driver may need initializing
-             &vrc4373_serial_channel1
+             vrc437x_serial_init, 
+             vrc437x_serial_lookup,     // Serial driver may need initializing
+             &vrc437x_serial_channel1
     );
-#endif //  CYGPKG_IO_SERIAL_MIPS_VRC4373_SERIAL1
+#endif //  CYGPKG_IO_SERIAL_MIPS_VRC437X_SERIAL1
 
-static cyg_interrupt  vrc4373_serial_interrupt;
-static cyg_handle_t   vrc4373_serial_interrupt_handle;
+static cyg_interrupt  vrc437x_serial_interrupt;
+static cyg_handle_t   vrc437x_serial_interrupt_handle;
 
 // Table which maps hardware channels (A,B) to software ones
-struct serial_channel *vrc4373_chans[] = {
-#ifdef CYGPKG_IO_SERIAL_MIPS_VRC4373_SERIAL0    // Hardware channel A
-    &vrc4373_serial_channel0,        
+struct serial_channel *vrc437x_chans[] = {
+#ifdef CYGPKG_IO_SERIAL_MIPS_VRC437X_SERIAL0    // Hardware channel A
+    &vrc437x_serial_channel0,        
 #else
     0,
 #endif
-#ifdef CYGPKG_IO_SERIAL_MIPS_VRC4373_SERIAL1    // Hardware channel B
-    &vrc4373_serial_channel1,
+#ifdef CYGPKG_IO_SERIAL_MIPS_VRC437X_SERIAL1    // Hardware channel B
+    &vrc437x_serial_channel1,
 #else
     0,
 #endif
@@ -248,13 +248,13 @@ scc_write_dat(volatile struct serial_por
 
 // Internal function to actually configure the hardware to desired baud rate, etc.
 static bool
-vrc4373_serial_config_port(serial_channel *chan, cyg_serial_info_t *new_config, bool init)
+vrc437x_serial_config_port(serial_channel *chan, cyg_serial_info_t *new_config, bool init)
 {
-    vrc4373_serial_info *vrc4373_chan = (vrc4373_serial_info *)chan->dev_priv;
-    volatile struct serial_port *port = (volatile struct serial_port *)vrc4373_chan->base;
+    vrc437x_serial_info *vrc437x_chan = (vrc437x_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)vrc437x_chan->base;
     cyg_int32 baud_rate = select_baud[new_config->baud];
     cyg_int32 baud_divisor;
-    unsigned char *regs = &vrc4373_chan->regs[0];
+    unsigned char *regs = &vrc437x_chan->regs[0];
     if (baud_rate == 0) return false;
     // Compute state of registers.  The register/control state needs to be kept in
     // the shadow variable 'regs' because the hardware registers can only be written,
@@ -303,36 +303,36 @@ vrc4373_serial_config_port(serial_channe
 
 // Function to initialize the device.  Called at bootstrap time.
 static bool 
-vrc4373_serial_init(struct cyg_devtab_entry *tab)
+vrc437x_serial_init(struct cyg_devtab_entry *tab)
 {
     serial_channel *chan = (serial_channel *)tab->priv;
-    vrc4373_serial_info *vrc4373_chan = (vrc4373_serial_info *)chan->dev_priv;
+    vrc437x_serial_info *vrc437x_chan = (vrc437x_serial_info *)chan->dev_priv;
     static bool init = false;
 #ifdef CYGDBG_IO_INIT
-    diag_printf("VRC4373 SERIAL init '%s' - dev: %x\n", tab->name, vrc4373_chan->base);
+    diag_printf("VRC437X SERIAL init '%s' - dev: %x\n", tab->name, vrc437x_chan->base);
 #endif
     (chan->callbacks->serial_init)(chan);  // Really only required for interrupt driven devices
     if (!init && chan->out_cbuf.len != 0) {
         init = true;
 // Note that the hardware is rather broken.  The interrupt status needs to
 // be read using only channel A
-        cyg_drv_interrupt_create(VRC4373_SCC_INT,
+        cyg_drv_interrupt_create(VRC437X_SCC_INT,
                                  99,                     
-                                 (cyg_addrword_t)VRC4373_SCC_BASE+SCC_CHANNEL_A,
-                                 vrc4373_serial_ISR,
-                                 vrc4373_serial_DSR,
-                                 &vrc4373_serial_interrupt_handle,
-                                 &vrc4373_serial_interrupt);
-        cyg_drv_interrupt_attach(vrc4373_serial_interrupt_handle);
-        cyg_drv_interrupt_unmask(VRC4373_SCC_INT);
+                                 (cyg_addrword_t)VRC437X_SCC_BASE+SCC_CHANNEL_A,
+                                 vrc437x_serial_ISR,
+                                 vrc437x_serial_DSR,
+                                 &vrc437x_serial_interrupt_handle,
+                                 &vrc437x_serial_interrupt);
+        cyg_drv_interrupt_attach(vrc437x_serial_interrupt_handle);
+        cyg_drv_interrupt_unmask(VRC437X_SCC_INT);
     }
-    vrc4373_serial_config_port(chan, &chan->config, true);
+    vrc437x_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 
-vrc4373_serial_lookup(struct cyg_devtab_entry **tab, 
+vrc437x_serial_lookup(struct cyg_devtab_entry **tab, 
                   struct cyg_devtab_entry *sub_tab,
                   const char *name)
 {
@@ -344,10 +344,10 @@ vrc4373_serial_lookup(struct cyg_devtab_
 // Send a character to the device output buffer.
 // Return 'true' if character is sent to device
 static bool
-vrc4373_serial_putc(serial_channel *chan, unsigned char c)
+vrc437x_serial_putc(serial_channel *chan, unsigned char c)
 {
-    vrc4373_serial_info *vrc4373_chan = (vrc4373_serial_info *)chan->dev_priv;
-    volatile struct serial_port *port = (volatile struct serial_port *)vrc4373_chan->base;
+    vrc437x_serial_info *vrc437x_chan = (vrc437x_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)vrc437x_chan->base;
     if (scc_read_ctl(port, R0) & RR0_TxEmpty) {
 // Transmit buffer is empty
         scc_write_dat(port, c);
@@ -360,11 +360,11 @@ vrc4373_serial_putc(serial_channel *chan
 
 // Fetch a character from the device input buffer, waiting if necessary
 static unsigned char 
-vrc4373_serial_getc(serial_channel *chan)
+vrc437x_serial_getc(serial_channel *chan)
 {
     unsigned char c;
-    vrc4373_serial_info *vrc4373_chan = (vrc4373_serial_info *)chan->dev_priv;
-    volatile struct serial_port *port = (volatile struct serial_port *)vrc4373_chan->base;
+    vrc437x_serial_info *vrc437x_chan = (vrc437x_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)vrc437x_chan->base;
     while ((scc_read_ctl(port, R0) & RR0_RxAvail) == 0) ;   // Wait for char
     c = scc_read_dat(port);
     return c;
@@ -372,7 +372,7 @@ vrc4373_serial_getc(serial_channel *chan
 
 // Set up the device characteristics; baud rate, etc.
 static Cyg_ErrNo
-vrc4373_serial_set_config(serial_channel *chan, cyg_uint32 key,
+vrc437x_serial_set_config(serial_channel *chan, cyg_uint32 key,
                           const void *xbuf, cyg_uint32 *len)
 {
     switch (key) {
@@ -383,7 +383,7 @@ vrc4373_serial_set_config(serial_channel
             return -EINVAL;
         }
         *len = sizeof(cyg_serial_info_t);
-        if ( true != vrc4373_serial_config_port(chan, config, false) )
+        if ( true != vrc437x_serial_config_port(chan, config, false) )
             return -EINVAL;
       }
       break;
@@ -395,15 +395,15 @@ vrc4373_serial_set_config(serial_channel
 
 // Enable the transmitter on the device
 static void
-vrc4373_serial_start_xmit(serial_channel *chan)
+vrc437x_serial_start_xmit(serial_channel *chan)
 {
-    vrc4373_serial_info *vrc4373_chan = (vrc4373_serial_info *)chan->dev_priv;
-    volatile struct serial_port *port = (volatile struct serial_port *)vrc4373_chan->base;
-    if ((vrc4373_chan->regs[R1] & WR1_TxIntEnab) == 0) {
+    vrc437x_serial_info *vrc437x_chan = (vrc437x_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)vrc437x_chan->base;
+    if ((vrc437x_chan->regs[R1] & WR1_TxIntEnab) == 0) {
         CYG_INTERRUPT_STATE old;
         HAL_DISABLE_INTERRUPTS(old);
-        vrc4373_chan->regs[R1] |= WR1_TxIntEnab;  // Enable Tx interrupt
-        scc_write_ctl(port, R1, vrc4373_chan->regs[R1]);
+        vrc437x_chan->regs[R1] |= WR1_TxIntEnab;  // Enable Tx interrupt
+        scc_write_ctl(port, R1, vrc437x_chan->regs[R1]);
         (chan->callbacks->xmt_char)(chan);  // Send first character to start xmitter
         HAL_RESTORE_INTERRUPTS(old);
     }
@@ -411,33 +411,33 @@ vrc4373_serial_start_xmit(serial_channel
 
 // Disable the transmitter on the device
 static void 
-vrc4373_serial_stop_xmit(serial_channel *chan)
+vrc437x_serial_stop_xmit(serial_channel *chan)
 {
-    vrc4373_serial_info *vrc4373_chan = (vrc4373_serial_info *)chan->dev_priv;
-    volatile struct serial_port *port = (volatile struct serial_port *)vrc4373_chan->base;
-    if ((vrc4373_chan->regs[R1] & WR1_TxIntEnab) != 0) {
+    vrc437x_serial_info *vrc437x_chan = (vrc437x_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)vrc437x_chan->base;
+    if ((vrc437x_chan->regs[R1] & WR1_TxIntEnab) != 0) {
         CYG_INTERRUPT_STATE old;
         HAL_DISABLE_INTERRUPTS(old);
-        vrc4373_chan->regs[R1] &= ~WR1_TxIntEnab;  // Disable Tx interrupt
-        scc_write_ctl(port, R1, vrc4373_chan->regs[R1]);
+        vrc437x_chan->regs[R1] &= ~WR1_TxIntEnab;  // Disable Tx interrupt
+        scc_write_ctl(port, R1, vrc437x_chan->regs[R1]);
         HAL_RESTORE_INTERRUPTS(old);
     }
 }
 
 // Serial I/O - low level interrupt handler (ISR)
 static cyg_uint32 
-vrc4373_serial_ISR(cyg_vector_t vector, cyg_addrword_t data)
+vrc437x_serial_ISR(cyg_vector_t vector, cyg_addrword_t data)
 {
-    cyg_drv_interrupt_mask(VRC4373_SCC_INT);
-    cyg_drv_interrupt_acknowledge(VRC4373_SCC_INT);
+    cyg_drv_interrupt_mask(VRC437X_SCC_INT);
+    cyg_drv_interrupt_acknowledge(VRC437X_SCC_INT);
     return CYG_ISR_CALL_DSR;  // Cause DSR to be run
 }
 
 inline static void
-vrc4373_int(serial_channel *chan, unsigned char stat)
+vrc437x_int(serial_channel *chan, unsigned char stat)
 {
-    vrc4373_serial_info *vrc4373_chan = (vrc4373_serial_info *)chan->dev_priv;
-    volatile struct serial_port *port = (volatile struct serial_port *)vrc4373_chan->base;
+    vrc437x_serial_info *vrc437x_chan = (vrc437x_serial_info *)chan->dev_priv;
+    volatile struct serial_port *port = (volatile struct serial_port *)vrc437x_chan->base;
     // Note: 'stat' value is interrupt status register, shifted into "B" position
     if (stat & RR3_BRxIP) {
         // Receive interrupt
@@ -462,7 +462,7 @@ vrc4373_int(serial_channel *chan, unsign
 // Also note that the hardware is rather broken.  The interrupt status needs to
 // be read using only channel A (pointed to by 'data')
 static void       
-vrc4373_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
+vrc437x_serial_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
 {
     serial_channel *chan;
     volatile struct serial_port *port = (volatile struct serial_port *)data;
@@ -470,16 +470,16 @@ vrc4373_serial_DSR(cyg_vector_t vector, 
     while (true) {
         stat = scc_read_ctl(port, R3);
         if (stat & (RR3_AExt | RR3_ATxIP | RR3_ARxIP)) {
-            chan = vrc4373_chans[0];  // Hardware channel A
-            vrc4373_int(chan, stat>>3);  // Handle interrupt
+            chan = vrc437x_chans[0];  // Hardware channel A
+            vrc437x_int(chan, stat>>3);  // Handle interrupt
         } else if (stat & (RR3_BExt | RR3_BTxIP | RR3_BRxIP)) {
-            chan = vrc4373_chans[1];  // Hardware channel B
-            vrc4373_int(chan, stat);  // Handle interrupt
+            chan = vrc437x_chans[1];  // Hardware channel B
+            vrc437x_int(chan, stat);  // Handle interrupt
         } else {
             // No more interrupts, all done
             break;
         }
     }
-    cyg_drv_interrupt_unmask(VRC4373_SCC_INT);
+    cyg_drv_interrupt_unmask(VRC437X_SCC_INT);
 }
 #endif
--- a/packages/devs/serial/mips/vrc437x/current/src/vrc437x_serial.h
+++ b/packages/devs/serial/mips/vrc437x/current/src/vrc437x_serial.h
@@ -1,11 +1,11 @@
-#ifndef CYGONCE_MIPS_VRC4373_SERIAL_H
-#define CYGONCE_MIPS_VRC4373_SERIAL_H
+#ifndef CYGONCE_MIPS_VRC437X_SERIAL_H
+#define CYGONCE_MIPS_VRC437X_SERIAL_H
 
 // ====================================================================
 //
-//      aeb_serial.h
+//      vrc437x_serial.h
 //
-//      Device I/O - Description of Mips VRC4373 serial hardware
+//      Device I/O - Description of Mips VRC437X serial hardware
 //
 // ====================================================================
 //####COPYRIGHTBEGIN####
@@ -44,7 +44,7 @@
 //
 // ====================================================================
 
-// Description of serial ports on Mips VRC4373
+// Description of serial ports on Mips VRC437X
 //   Based on Zilog 85C30 SCC
 
 struct serial_port {
@@ -332,4 +332,4 @@ static cyg_int32 select_baud[] = {
     0,      // 230400
 };
 
-#endif // CYGONCE_MIPS_VRC4373_SERIAL_H
+#endif // CYGONCE_MIPS_VRC437X_SERIAL_H
--- a/packages/devs/usb/sa11x0/current/ChangeLog
+++ b/packages/devs/usb/sa11x0/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-14  Bart Veer  <bartv@redhat.com>
+
+	* src/usbs_sa11x0.c:
+	Update support for USB testing
+
 2001-08-06  Bart Veer  <bartv@redhat.com>
 
 	* src/usbs_sa11x0.c:
--- a/packages/devs/usb/sa11x0/current/src/usbs_sa11x0.c
+++ b/packages/devs/usb/sa11x0/current/src/usbs_sa11x0.c
@@ -2431,49 +2431,52 @@ usbs_sa11x0_init(void)
 // Testing support.
 usbs_testing_endpoint usbs_testing_endpoints[] = {
     {
-        endpoint_type   : USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, 
-        endpoint_number : 0,
-        in_endpoint     : false,
-        endpoint        : (void*) &ep0.common,
+        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_SA11X0_EP0_DEVTAB_ENTRY
-        devtab_entry    : CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "0c",
+        devtab_entry        : CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "0c",
 #else        
-        devtab_entry    : (const char*) 0,
+        devtab_entry        : (const char*) 0,
 #endif        
-        min_size        : 1,            // zero-byte control transfers are meaningless
-        max_size        : 0x0FFFF,      // limit imposed by protocol
-        max_in_padding  : 0
+        min_size            : 1,            // zero-byte control transfers are meaningless
+        max_size            : 0x0FFFF,      // limit imposed by protocol
+        max_in_padding      : 0,
+        alignment           : 0
     },
 #ifdef CYGPKG_DEVS_USB_SA11X0_EP1
     {
-        endpoint_type   : USB_ENDPOINT_DESCRIPTOR_ATTR_BULK,
-        endpoint_number : 1,
-        in_endpoint     : false,        // ep1 is an rx endpoint
-        endpoint        : (void*) &ep1.common,
+        endpoint_type       : USB_ENDPOINT_DESCRIPTOR_ATTR_BULK,
+        endpoint_number     : 1,
+        endpoint_direction  : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_OUT,
+        endpoint            : (void*) &ep1.common,
 #ifdef CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY
-        devtab_entry    : CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "1r",
+        devtab_entry        : CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "1r",
 #else        
-        devtab_entry    : (const char*) 0,
+        devtab_entry        : (const char*) 0,
 #endif        
-        min_size        : 0,
-        max_size        : -1,           // No hardware or driver limitation
-        max_in_padding  : 0
+        min_size            : 1,
+        max_size            : -1,           // No hardware or driver limitation
+        max_in_padding      : 0,
+        alignment           : 0
     },
 #endif
 #ifdef CYGPKG_DEVS_USB_SA11X0_EP2
     {
-        endpoint_type   : USB_ENDPOINT_DESCRIPTOR_ATTR_BULK,
-        endpoint_number : 2,
-        in_endpoint     : true,         // ep2 is a tx endpoint
-        endpoint        : (void*) &ep2.common,
+        endpoint_type       : USB_ENDPOINT_DESCRIPTOR_ATTR_BULK,
+        endpoint_number     : 2,
+        endpoint_direction  : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN,
+        endpoint            : (void*) &ep2.common,
 #ifdef CYGVAR_DEVS_USB_SA11X0_EP2_DEVTAB_ENTRY
-        devtab_entry    : CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "2w",
+        devtab_entry        : CYGDAT_DEVS_USB_SA11X0_DEVTAB_BASENAME "2w",
 #else        
-        devtab_entry    : (const char*) 0,
+        devtab_entry        : (const char*) 0,
 #endif        
-        min_size        : 0,
-        max_size        : -1,           // No hardware or driver limitation
-        max_in_padding  : 1             // hardware limitation
+        min_size            : 1,
+        max_size            : -1,           // No hardware or driver limitation
+        max_in_padding      : 1,            // hardware limitation
+        alignment           : 0
     },
 #endif
     USBS_TESTING_ENDPOINTS_TERMINATOR
new file mode 100644
--- /dev/null
+++ b/packages/devs/wallclock/i386/pc/current/ChangeLog
@@ -0,0 +1,31 @@
+2001-09-18  Rajagopalan Thiruvenkatachary  <rajt@us.ibm.com>
+
+	* include/devices_wallclock_i386_pc.inl:
+	* cdl/i386_pc_wallclock_drivers.cdl:
+	New 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####
+
+
new file mode 100644
--- /dev/null
+++ b/packages/devs/wallclock/i386/pc/current/cdl/i386_pc_wallclock_drivers.cdl
@@ -0,0 +1,77 @@
+# ====================================================================
+#
+#      i386_pc_wallclock_drivers.cdl
+#
+#      Wallclock drivers - support for DS12887 RTC on the PC
+#
+# ====================================================================
+#####COPYRIGHTBEGIN####
+#
+# -------------------------------------------
+# The contents of this file are subject to the Red Hat eCos Public License
+# Version 1.1 (the "License"); you may not use this file except in
+# compliance with the License.  You may obtain a copy of the License at
+# http://www.redhat.com/
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the
+# License for the specific language governing rights and limitations under
+# the License.
+#
+# The Original Code is eCos - Embedded Configurable Operating System,
+# released 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####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      rajt
+# Contributors:   rajt
+# Date:           2001-07-19
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVICES_WALLCLOCK_I386_PC {
+    display       "PC board RTC Driver"
+    description   "RTC driver for PC."
+
+    parent        CYGPKG_IO_WALLCLOCK
+    active_if   CYGPKG_IO_WALLCLOCK
+    active_if     CYGPKG_HAL_I386_PC
+    requires      CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887
+
+    include_dir   cyg/io
+
+    define_proc {
+        puts $::cdl_system_header "/***** PC RTC driver proc output start *****/"
+        puts $::cdl_system_header "#define CYGDAT_DEVS_WALLCLOCK_DALLAS_12887_INL <cyg/io/devices_wallclock_i386_pc.inl>"
+        puts $::cdl_system_header "#define CYGDAT_DEVS_WALLCLOCK_i386_PC_CFG <pkgconf/devices_wallclock_i386_pc.h>"
+        puts $::cdl_system_header "/***** PC RTC driver proc output end  *****/"
+    }
+
+    cdl_option CYGDAT_DEVS_WALLCLOCK_I386_PC_RTC_ADDRESS_PORT {
+    display         "IO port address of the ADDRESS register"
+    flavor          data
+        default_value 0x70
+        description   "
+              This option sets the io address of the address port for
+              accessing the PC RTC"
+    }
+
+    cdl_option CYGDAT_DEVS_WALLCLOCK_I386_PC_RTC_DATA_PORT {
+    display         "IO port address of the DATA register"
+    flavor          data
+        default_value 0x71
+        description   "
+              This option sets the io address of the data port for
+              accessing the PC RTC"
+    }
+}
new file mode 100644
--- /dev/null
+++ b/packages/devs/wallclock/i386/pc/current/include/devices_wallclock_i386_pc.inl
@@ -0,0 +1,46 @@
+//==========================================================================
+//
+//      devs/wallclock/i386/pc/include/devs_wallclock_i386_pc.inl
+//
+//      PC RTC IO 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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):   rajt
+// Contributors:rajt
+// Date:        2001-07-19
+// Purpose:     PC RTC definitions for using DS12887
+//####DESCRIPTIONEND####
+//==========================================================================
+
+#include CYGDAT_DEVS_WALLCLOCK_i386_PC_CFG
+
+#define DS_ADDR CYGDAT_DEVS_WALLCLOCK_I386_PC_RTC_ADDRESS_PORT
+#define DS_DATA    CYGDAT_DEVS_WALLCLOCK_I386_PC_RTC_DATA_PORT
+
+// EOF devs_wallclock_i386_pc.inl
--- a/packages/ecos.db
+++ b/packages/ecos.db
@@ -162,6 +162,16 @@ package CYGPKG_DEVS_FLASH_ARM_PID {
 	   on the ARM PID platform."
 }
 
+package CYGPKG_DEVS_FLASH_SH_EDK7708 {
+	alias 		{ "Support for flash memory on Hitachi/EDK7708 board" flash_sh_edk7708 }
+	directory	devs/flash/sh/edk7708
+	script		flash_sh_edk7708.cdl
+	hardware
+        description "
+           This package contains hardware support for flash memory
+	   on the Hitachi EDK7708 platform."
+}
+
 package CYGPKG_DEVS_FLASH_MIPS_OCELOT {
 	alias 		{ "Support for flash memory on PMC-Sierra/Ocelot board" flash_qed_ocelot }
 	directory	devs/flash/mips/ocelot
@@ -331,7 +341,6 @@ package CYGPKG_DEVS_FLASH_ATLAS {
            This package contains hardware support for FLASH memory
 	   on the MIPS Atlas platform."
 }
-
 package CYGPKG_DEVS_TOUCH_IPAQ {
 	alias 		{ "Touch screen support for iPAQ" touch_ipaq }
 	directory	devs/touch/arm/ipaq
@@ -772,6 +781,7 @@ package CYGPKG_DEVS_ETH_CF {
         hardware
         description     "Ethernet drivers for PCMCIA (Compact Flash) cardss."
 }
+
 package CYGPKG_IO_PCI	{
 	alias		{ "PCI configuration library" io_pci }
 	directory	io/pci
@@ -829,6 +839,17 @@ package CYGPKG_DEVICES_WALLCLOCK_MIPS_RE
            This package provides a wallclock driver implementation for the
            Toshiba REF4955 board."
 }
+
+package CYGPKG_DEVICES_WALLCLOCK_I386_PC {
+         alias          { "Standard PC RTC device" devs_wallclock_i386_pc_ds12887 pc_rtc }
+         hardware
+         directory      devs/wallclock/i386/pc
+         script         i386_pc_wallclock_drivers.cdl
+         description    "
+            RTC driver for standard PC. This is essentially support for a
+            Dallas DS12887 RTC."
+}
+
 package CYGPKG_DEVICES_WATCHDOG_ARM_AEB {
 	alias		{ "Watchdog driver for ARM/AEB board" devices_watchdog_aeb device_watchdog_aeb }
 	directory	devs/watchdog/arm/aeb
@@ -909,6 +930,15 @@ dynamic memory allocators, including the
 interface. It also contains some sample implementations."
 }
 
+package CYGPKG_LOADER {
+        alias           { "Dynamic loader" loader dload }
+        directory       services/loader
+        script          loader.cdl
+        description "
+This package provides support for the dynamic executable and
+library loader."
+}
+
 package CYGPKG_COMPRESS_ZLIB {
         alias           { "Zlib compress/decompress" zlib_compress compress_zlib }
         directory       services/compress/zlib
@@ -1843,11 +1873,13 @@ evaluation board."
 
 
 
+
 # ==========================================================================
 
 
+
 # --------------------------------------------------------------------------
-# ARM targets
+# ARM Targets
 
 target pid {
 	alias { "ARM development board (PID)" PID }
@@ -2067,6 +2099,8 @@ target sh7708 {
 	              CYGPKG_IO_SERIAL_SH_SCI
 	              CYGPKG_IO_SERIAL_SH_EDK7708
                       CYGPKG_DEVICES_WATCHDOG_SH_SH3
+                      CYGPKG_DEVS_FLASH_SH_EDK7708
+                      CYGPKG_DEVS_FLASH_ATMEL_AT29CXXXX
         }
         description "
            The sh7708 target provides the packages needed to run
@@ -2109,6 +2143,8 @@ target pc {
 	                  CYGPKG_IO_SERIAL_I386_PC
 			  CYGPKG_DEVS_ETH_INTEL_I82559
 			  CYGPKG_DEVS_ETH_I386_PC_I82559
+                          CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887
+                          CYGPKG_DEVICES_WALLCLOCK_I386_PC
         }
         description "
     	    The pc target provides the 
--- a/packages/hal/arm/aeb/current/ChangeLog
+++ b/packages/hal/arm/aeb/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-02  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/hal_arm_aeb.cdl (CYGBLD_BUILD_REDBOOT_BIN): cygtclsh80 on
+	Cygwin can't deal with absolute paths correctly, so copy
+	flash_cksum.tcl into build directory.
+
 2001-04-16  Gary Thomas  <gthomas@redhat.com>
 
 	* cdl/hal_arm_aeb.cdl: Add CDL to describe CPU family.
--- a/packages/hal/arm/aeb/current/cdl/hal_arm_aeb.cdl
+++ b/packages/hal/arm/aeb/current/cdl/hal_arm_aeb.cdl
@@ -219,7 +219,8 @@ cdl_package CYGPKG_HAL_ARM_AEB {
                 @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 $<
+                @cp $(dir $<)flash_cksum.tcl src/
+                $(CC) -c -DCHECKSUM=`src/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
--- a/packages/hal/arm/arch/current/ChangeLog
+++ b/packages/hal/arm/arch/current/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/arm.ld: Make separate section for GOT and .eh_frame.
+	Make macro section for all reloc sections.
+	Input extras.o unconditionally.
+	* cdl/hal_arm.cdl: Don't bother with -DEXTRAS=1 - unconditional now.
+
 2001-08-24  Mark Salter  <msalter@redhat.com>
 
 	* src/arm_stub.c (target_thumb_ins): Add support for pop insn.
--- a/packages/hal/arm/arch/current/cdl/hal_arm.cdl
+++ b/packages/hal/arm/arch/current/cdl/hal_arm.cdl
@@ -77,7 +77,7 @@ cdl_package CYGPKG_HAL_ARM {
 
     make {
         <PREFIX>/lib/target.ld: <PACKAGE>/src/arm.ld
-        $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $<
+        $(CC) -E -P -Wp,-MD,target.tmp -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $<
         @echo $@ ": \\" > $(notdir $@).deps
         @tail +2 target.tmp >> $(notdir $@).deps
         @echo >> $(notdir $@).deps
--- a/packages/hal/arm/arch/current/src/arm.ld
+++ b/packages/hal/arm/arch/current/src/arm.ld
@@ -1,7 +1,6 @@
 //=============================================================================
 //
 // MLT linker script for ARM
-// adapted from packages/hal/arm/pid/v1_1/src/pid.ld
 //
 //=============================================================================
 //####COPYRIGHTBEGIN####
@@ -22,7 +21,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                     
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -33,10 +32,12 @@
 
 STARTUP(vectors.o)
 ENTRY(reset_vector)
-#ifdef EXTRAS
 INPUT(extras.o)
+#if (__GNUC__ >= 3)
+GROUP(libtarget.a libgcc.a libsupc++.a)
+#else
+GROUP(libtarget.a libgcc.a)
 #endif
-GROUP(libtarget.a libgcc.a)
 
 #if defined(__ARMEB__)
 OUTPUT_FORMAT(elf32-bigarm)
@@ -128,6 +129,76 @@ OUTPUT_FORMAT(elf32-bigarm)
     { FORCE_OUTPUT; *(.gcc_except_table) } \
     > _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_
+
+#define SECTION_got(_region_, _vma_, _lma_)                                 \
+  .got _vma_ : _lma_                                                        \
+    {                                                                       \
+      FORCE_OUTPUT; *(.got.plt) *(.got)                                     \
+      _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.);      \
+      _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.);      \
+    } > _region_
+
 #define SECTION_mmu_tables(_region_, _vma_, _lma_) \
     .mmu_tables _vma_ : _lma_ \
     { FORCE_OUTPUT; *(.mmu_tables) } \
@@ -141,8 +212,6 @@ OUTPUT_FORMAT(elf32-bigarm)
 #define SECTION_data(_region_,  _vma_, _lma_) \
     .data _vma_ : _lma_ \
     { __ram_data_start = ABSOLUTE (.); *(.data*) *(.data1) MERGE_IN_RODATA \
-    _GOT1_START_ = ABSOLUTE (.); *(.got1) _GOT1_END_ = ABSOLUTE (.); \
-    _GOT2_START_ = ABSOLUTE (.); *(.got2) _GOT2_END_ = ABSOLUTE (.); \
     . = ALIGN (4); \
     KEEP(*( SORT (.ecos.table.*))) ;            \
     . = ALIGN (4); \
--- a/packages/hal/arm/e7t/current/ChangeLog
+++ b/packages/hal/arm/e7t/current/ChangeLog
@@ -1,3 +1,9 @@
+2001-10-02  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/hal_arm_e7t.cdl (CYGBLD_BUILD_REDBOOT_BIN): cygtclsh80 on
+	Cygwin can't deal with absolute paths correctly, so copy
+	flash_cksum.tcl into build directory.
+
 2001-07-02  Jesper Skov  <jskov@redhat.com>
 
 	* src/hal_diag.c (cyg_hal_plf_serial_getc_nonblock): Ack RX
--- a/packages/hal/arm/e7t/current/cdl/hal_arm_e7t.cdl
+++ b/packages/hal/arm/e7t/current/cdl/hal_arm_e7t.cdl
@@ -280,7 +280,8 @@ cdl_package CYGPKG_HAL_ARM_E7T {
                 @echo >> $(notdir $@).deps
                 @rm deps.tmp
                 # Then build version with checksum from previously built image.
-                $(CC) -c -DCHECKSUM=`$(dir $<)flash_cksum.tcl src/redboot_ncs.bin` $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -o src/redboot.o $<
+                @cp $(dir $<)flash_cksum.tcl src/
+                $(CC) -c -DCHECKSUM=`src/flash_cksum.tcl src/redboot_ncs.bin` $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -o src/redboot.o $<
                 $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o src/redboot.tmp $(PREFIX)/lib/version.o src/redboot.o
                 $(OBJCOPY) --strip-debug src/redboot.tmp $(@:.bin=.img)
                 $(OBJCOPY) -O binary $(@:.bin=.img) src/redboot.bin
--- a/packages/hal/arm/edb7xxx/current/ChangeLog
+++ b/packages/hal/arm/edb7xxx/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-26  Gary Thomas  <gthomas@redhat.com
+
+	* cdl/hal_arm_edb7xxx.cdl: Implement CYGINT_HAL_SUPPORTS_MMU_TABLES
+	to show that this HAL uses MMU tables.
+
 2001-07-25  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/pkgconf/mlt_arm_edb7211_ram.h:
--- a/packages/hal/arm/edb7xxx/current/cdl/hal_arm_edb7xxx.cdl
+++ b/packages/hal/arm/edb7xxx/current/cdl/hal_arm_edb7xxx.cdl
@@ -56,6 +56,7 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
     implements    CYGINT_HAL_DEBUG_GDB_STUBS_BREAK
     implements    CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT
     implements    CYGINT_HAL_ARM_ARCH_ARM7
+    implements    CYGINT_HAL_SUPPORTS_MMU_TABLES
 
     define_proc {
         puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H   <pkgconf/hal_arm.h>"
@@ -70,31 +71,50 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
         description   "
             The Cirrus Logic processor variant."
         define -file system.h CYGHWR_HAL_ARM_EDB7XXX_VARIANT
+    }
+
+    cdl_option CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT {
+        display       "Cirrus Logic board variant"
+        flavor        data
+        legal_values  { "CL7111" "EDB7209" "EDB7211" "EDB7212" }
+        default_value { CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "CL_PS7111" ? "CL7111" : \
+                        CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7209" ? "EDB7209" : \
+                        CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7211" ? "EDB7211" : \
+                        CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7212" ? "EDB7212" : \
+                        "" }
+        description   "
+            The board type which uses a Cirrus Logic processor variant."
+        define -file system.h CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT
 	define_proc {
             puts $::cdl_header ""
-            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_CL_PS7111"
+            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_CL7111"
             puts $::cdl_header "#define HAL_PLATFORM_CPU    \"ARM 710C\""
             puts $::cdl_header "#define HAL_PLATFORM_BOARD  \"Cirrus Logic CL-PS7111\""
             puts $::cdl_header "#define HAL_PLATFORM_EXTRA  \"\""
-            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_VARIANT_CL_PS7111"
+            puts $::cdl_header "#define __CL7111"
+            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_CL7111"
             puts $::cdl_header ""
-            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7209"
+            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_EDB7209"
             puts $::cdl_header "#define HAL_PLATFORM_CPU    \"ARM 720T\""
             puts $::cdl_header "#define HAL_PLATFORM_BOARD  \"Cirrus Logic EDB7209\""
             puts $::cdl_header "#define HAL_PLATFORM_EXTRA  \"\""
-            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7209"
+            puts $::cdl_header "#define __EDB7209"
+            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_EDB7209"
             puts $::cdl_header ""
-            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7211"
+            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_EDB7211"
             puts $::cdl_header "#define HAL_PLATFORM_CPU    \"ARM 720T\""
             puts $::cdl_header "#define HAL_PLATFORM_BOARD  \"Cirrus Logic EDB7211\""
             puts $::cdl_header "#define HAL_PLATFORM_EXTRA  \"\""
-            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7211"
+            puts $::cdl_header "#define __EDB7211"
+            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_EDB7211"
             puts $::cdl_header ""
-            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7212"
+            puts $::cdl_header "#ifdef CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_EDB7212"
             puts $::cdl_header "#define HAL_PLATFORM_CPU    \"ARM 720T\""
             puts $::cdl_header "#define HAL_PLATFORM_BOARD  \"Cirrus Logic EDB7212\""
             puts $::cdl_header "#define HAL_PLATFORM_EXTRA  \"\""
-            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7212"
+            puts $::cdl_header "#define __EDB7209"
+            puts $::cdl_header "#define __EDB7212"
+            puts $::cdl_header "#endif //CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT_EDB7212"
             puts $::cdl_header ""
 	}
     }
@@ -136,7 +156,7 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
         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
@@ -186,8 +206,8 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
         display       "Installed DRAM on board"
         flavor        data
         legal_values  0 2 16
-        default_value { CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "CL_PS7111" ? 2 : \
-                        CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7209" ? 0 : 16 }
+        default_value { CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "CL7111" ? 2 : \
+                        CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7209" ? 0 : 16 }
         description   "
             The Cirrus Logic boards can have various amounts of DRAM installed.
             The machine needs to be initialized differently, depending
@@ -212,7 +232,7 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
             If an LCD panel is installed, 128K of DRAM will be dedicated to the
             LCD buffer by the system intialization.  Note: changing this value
 	    from the default will alter the memory map and a new debug enviroment
-	    (GDB or CygMon) may be required."
+	    (GDB or RedBoot) may be required."
     }
 
     # Real-time clock/counter specifics
@@ -397,15 +417,18 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
 	    compiler flags used only in building this package,
 	    and details of which tests are built."
 
+# Note: now defined in <pkgconf/hal.h>
+#            default_value { CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "CL_PS7111" ? "-D__CL7111" : 
+#                            CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7209" ? "-D__EDB7209" : 
+#                            CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7211" ? "-D__EDB7211" : 
+#                            CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7212" ? "-D__EDB7209 -D__EDB7212" : 
+#                            "" }
 
         cdl_option CYGPKG_HAL_ARM_EDB7XXX_CFLAGS_ADD {
             display "Additional compiler flags"
             flavor  data
             no_define
-            default_value { CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "CL_PS7111" ? "-D__CL7111" : \
-                            CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7209" ? "-D__EDB7209" : \
-                            CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7211" ? "-D__EDB7211" : \
-                            CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7212" ? "-D__EDB7209 -D__EDB7212" : "" }
+            default_value { "" }
             description   "
                 This option modifies the set of compiler flags for
                 building the Cirrus Logic HAL. These flags are used in addition
@@ -438,15 +461,15 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
         flavor data
         no_define
         calculated { 
-          CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "CL_PS7111" ? 
+          CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "CL7111" ? 
             (CYG_HAL_STARTUP == "RAM" ? "arm_cl7111_ram" : \
              CYG_HAL_STARTUP == "ROM" ? "arm_cl7111_rom" : "BOGUS.mlt" ) : \
-          CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7209" ? 
+          CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7209" ? 
             (CYG_HAL_STARTUP == "ROM" ? "arm_edb7209_rom" : "BOGUS.mlt" ) : \
-          CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7211" ? 
+          CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7211" ? 
             (CYG_HAL_STARTUP == "RAM" ? "arm_edb7211_ram" : \
              CYG_HAL_STARTUP == "ROM" ? "arm_edb7211_rom" : "BOGUS.mlt" ) : \
-          CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7212" ? 
+          CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7212" ? 
             (CYG_HAL_STARTUP == "RAM" ? "arm_edb7212_ram" : \
              CYG_HAL_STARTUP == "ROM" ? "arm_edb7212_rom" : "BOGUS.mlt" ) : \
           "BOGUS.mlt" }
@@ -457,15 +480,15 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
             no_define
             define -file system.h CYGHWR_MEMORY_LAYOUT_LDI
             calculated { 
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "CL_PS7111" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "CL7111" ?
                 (CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_cl7111_ram.ldi>" :  \
                  CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_cl7111_rom.ldi>" :  "BOGUS.ldi" ) : \
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7209" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7209" ?
                 (CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_edb7209_rom.ldi>" :  "BOGUS.ldi" ) : \
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7211" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7211" ?
                 (CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_edb7211_ram.ldi>" :  \
                  CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_edb7211_rom.ldi>" :  "BOGUS.ldi" ) : \
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7212" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7212" ?
                 (CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_edb7212_ram.ldi>" :  \
                  CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_edb7212_rom.ldi>" :  "BOGUS.ldi" ) : \
               "BOGUS.ldi" }
@@ -477,15 +500,15 @@ cdl_package CYGPKG_HAL_ARM_EDB7XXX {
             no_define
             define -file system.h CYGHWR_MEMORY_LAYOUT_H
             calculated {
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "CL_PS7111" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "CL7111" ?
                 (CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_cl7111_ram.h>" :  \
                  CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_cl7111_rom.h>" :  "BOGUS.h" ) : \
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7209" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7209" ?
                 (CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_edb7209_rom.h>" :  "BOGUS.h" ) : \
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7211" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7211" ?
                 (CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_edb7211_ram.h>" :  \
                  CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_edb7211_rom.h>" :  "BOGUS.h" ) : \
-              CYGHWR_HAL_ARM_EDB7XXX_VARIANT == "EP7212" ?
+              CYGHWR_HAL_ARM_EDB7XXX_BOARD_VARIANT == "EDB7212" ?
                 (CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_arm_edb7212_ram.h>" :  \
                  CYG_HAL_STARTUP == "ROM" ? "<pkgconf/mlt_arm_edb7212_rom.h>" :  "BOGUS.h" ) : \
               "BOGUS.h" }
--- a/packages/hal/arm/edb7xxx/current/include/hal_platform_setup.h
+++ b/packages/hal/arm/edb7xxx/current/include/hal_platform_setup.h
@@ -26,7 +26,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -52,11 +52,11 @@
 #include <cyg/hal/hal_mmu.h>          // MMU definitions
 
 #define CYGHWR_HAL_ARM_HAS_MMU        // This processor has an MMU
-
+#define CYGSEM_HAL_ROM_RESET_USES_JUMP
 //
 // Memory map - set up by ROM (GDB stubs)
 //
-// Region        Logical Address              Physical Address        
+// Region        Logical Address              Physical Address
 //   DRAM          0x00000000..0x00xFFFFF        0xC00x0000  (see below)
 //   Expansion 2   0x20000000                    0x20000000
 //   Expansion 3   0x30000000                    0x30000000
@@ -114,84 +114,164 @@
 #define IO_LA_END        0x80003000
 #define IO_PA            0x80000000
 
+
 // Define startup code [macros]
-#if defined(CYGSEM_HAL_INSTALL_MMU_TABLES) && !defined(CYG_HAL_STARTUP_RAM)
+#if defined(CYGSEM_HAL_INSTALL_MMU_TABLES)
 
 #ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_CL_PS7111 // CL7111, 710 processor
-#define MMU_INITIALIZE                                                   \
-	ldr	r2,=MMU_Control_Init                                    ;\
-	mcr	MMU_CP,0,r2,MMU_Control,c0	/* MMU off */           ;\
-	mcr	MMU_CP,0,r1,MMU_Base,c0                                 ;\
-	mcr	MMU_CP,0,r1,MMU_FlushTLB,c0,0	/* Invalidate TLB */    ;\
-	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0	/* Invalidate Caches */ ;\
-	ldr	r1,=0xFFFFFFFF                                          ;\
-	mcr	MMU_CP,0,r1,MMU_DomainAccess,c0                         ;\
-	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                                                             ;\
+        .macro MMU_INITIALIZE
+	ldr	r2,=MMU_Control_Init                                    
+	mcr	MMU_CP,0,r2,MMU_Control,c0	/* MMU off */           
+	mcr	MMU_CP,0,r1,MMU_Base,c0                                 
+	mcr	MMU_CP,0,r1,MMU_FlushTLB,c0,0	/* Invalidate TLB */    
+	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0	/* Invalidate Caches */ 
+	ldr	r1,=0xFFFFFFFF                                          
+	mcr	MMU_CP,0,r1,MMU_DomainAccess,c0                         
+	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:
-#else // EP7211, 720T processor
-#define MMU_INITIALIZE                                                   \
-	ldr	r2,=MMU_Control_Init                                    ;\
-	mcr	MMU_CP,0,r2,MMU_Control,c0    /* MMU off */             ;\
-	mcr	MMU_CP,0,r1,MMU_Base,c0                                 ;\
-	mcr	MMU_CP,0,r1,MMU_TLB,c7,0      /* Invalidate TLB */      ;\
-	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0 /* Invalidate Caches */   ;\
-	ldr	r1,=0xFFFFFFFF                                          ;\
-	mcr	MMU_CP,0,r1,MMU_DomainAccess,c0                         ;\
-	ldr	r2,=10f                                                 ;\
-	ldr     r3,=__exception_handlers                                ;\
-	sub     r2,r2,r3                                                ;\
-	ldr     r3,=ROM0_LA_START                                       ;\
- 	add     r2,r2,r3                                                ;\
-	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                                                             ;\
+        .endm
+#else // EP7xxx, 720T processor
+        .macro  MMU_INITIALIZE                                        
+	ldr	r2,=MMU_Control_Init                                    
+	mcr	MMU_CP,0,r2,MMU_Control,c0    /* MMU off */             
+	mcr	MMU_CP,0,r1,MMU_Base,c0                                 
+	mcr	MMU_CP,0,r1,MMU_TLB,c7,0      /* Invalidate TLB */      
+	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0 /* Invalidate Caches */   
+	ldr	r1,=0xFFFFFFFF                                          
+	mcr	MMU_CP,0,r1,MMU_DomainAccess,c0                         
+	ldr	r2,=10f       
+#ifdef CYG_HAL_STARTUP_ROM                                                  
+	ldr     r3,=__exception_handlers                                
+	sub     r2,r2,r3                                                
+	ldr     r3,=ROM0_LA_START                                       
+ 	add     r2,r2,r3  
+#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:
-#endif
+        .endm
+#endif // EP7xxx,720T processor
 
-#define RELOCATE_TEXT_SEGMENT                    \
-        ldr     r2,=__exception_handlers        ;\
-        ldr     r3,=ROM0_LA_START               ;\
-        cmp     r2,r3                           ;\
-        beq     20f                             ;\
-        ldr     r4,=__rom_data_end              ;\
-15:                                             ;\
-        ldr     r0,[r3],#4                      ;\
-        str     r0,[r2],#4                      ;\
-        cmp     r2,r4                           ;\
-        bne     15b                             ;\
+#ifdef CYG_HAL_STARTUP_ROM                                                  
+        .macro  RELOCATE_TEXT_SEGMENT
+        ldr     r2,=__exception_handlers
+        ldr     r3,=ROM0_LA_START       
+        cmp     r2,r3                   
+        beq     20f                     
+        ldr     r4,=__rom_data_end      
+15:                                     
+        ldr     r0,[r3],#4              
+        str     r0,[r2],#4              
+        cmp     r2,r4                   
+        bne     15b                     
 20:
+        .endm        
+#endif
+        
+#ifdef CYG_HAL_STARTUP_RAM
+        .macro  RELOCATE_RAM_IMAGE
+// Special code to handle case where program has been loaded into DRAM
+// _somewhere_.  This code first relocates itself into DRAM where eCos
+// mapping will expect it to be.  Note since we don't know the current
+// MMU mapping, this is tricky.  This is handled by putting a small
+// routine into SRAM (which is always mapped 1-1) that turns off the
+// MMU whilst it stores one word into physical memory.  Once the whole
+// program has been relocated thusly, the MMU is shut off again while
+// the eCos memory mapping takes place                
+        bl      5f
+// Routine to store one item in physical memory, with the MMU off        
+_phys_store:
+	ldr	r5,=MMU_Control_Init
+	mcr	MMU_CP,0,r5,MMU_Control,c0    /* MMU off */
+	nop
+	nop
+	nop
+	mcr	MMU_CP,0,r1,MMU_TLB,c7,0      /* Invalidate TLB */
+	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0 /* Invalidate Caches */
+        str     r4,[r2],#4
+	ldr	r5,=MMU_Control_Init|MMU_Control_M
+	mcr	MMU_CP,0,r5,MMU_Control,c0
+        mov     pc,lr
+_phys_store_end:                
+// Copy above routine to SRAM, whose address does not change with MMU        
+5:      mov     r1,lr
+        add     r2,r1,#_phys_store_end-_phys_store
+        ldr     r3,=SRAM_LA_START
+6:      ldr     r4,[r1],#4
+        str     r4,[r3],#4
+        cmp     r1,r2
+        bne     6b
+        ldr     r6,=SRAM_LA_START
+// Relocate code in DRAM to where eCos mapping wants it
+        bl      7f
+7:      mov     r2,lr
+        ldr     r1,=7b
+        sub     r1,r2,r1
+        ldr     r2,=__exception_handlers
+        add     r1,r1,r2
+//        ldr     r1,=0xF0020000
+        ldr     r3,=DRAM_PA
+        add     r2,r2,r3
+//        ldr     r2,=DRAM_PA+0x20000
+        ldr     r3,=_edata
+        ldr     r4,=__exception_handlers
+        sub     r3,r3,r4
+        add     r3,r1,r3
+//        ldr     r3,=0xF0040000
+10:     ldr     r4,[r1],#4
+        mov     lr,pc           // Call phys_store() function above
+        mov     pc,r6
+        cmp     r1,r3
+        bne     10b
+// Now, turn off the MMU an execute the rest of this code in PHYSICAL memory        
+        ldr     r1,=15f
+        ldr     r2,=DRAM_PA
+        add     r1,r1,r2
+	ldr	r5,=MMU_Control_Init
+	mcr	MMU_CP,0,r5,MMU_Control,c0    /* MMU off */
+        mov     pc,r1
+	nop
+	nop
+	nop
+15:	mcr	MMU_CP,0,r1,MMU_TLB,c7,0      /* Invalidate TLB */
+	mcr	MMU_CP,0,r1,MMU_FlushIDC,c0,0 /* Invalidate Caches */
+        .endm
+#endif // CYG_HAL_STARTUP_RAM        
 
-#ifdef CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7209
+#if CYGHWR_HAL_ARM_EDB7XXX_VARIANT_EP7209
 // No DRAM controller
-#define INIT_MEMORY_CONFIG                       \
-/* Initialize memory configuration */           ;\
-	ldr	r1,=MEMCFG1                     ;\
-	ldr	r2,=0x8200A080                  ;\
-	str	r2,[r1]                         ;\
-	ldr	r1,=MEMCFG2                     ;\
-	ldr	r2,=0xFEFC0000                  ;\
+        .macro  INIT_MEMORY_CONFIG
+/* Initialize memory configuration */
+	ldr	r1,=MEMCFG1
+	ldr	r2,=0x8200A080
+	str	r2,[r1]
+	ldr	r1,=MEMCFG2
+	ldr	r2,=0xFEFC0000
 	str	r2,[r1]
-#else
-#define INIT_MEMORY_CONFIG                                       \
-/* Initialize memory configuration */                           ;\
-	ldr	r1,=MEMCFG1                                     ;\
-	ldr	r2,=0x8200A080                                  ;\
-	str	r2,[r1]                                         ;\
-	ldr	r1,=MEMCFG2                                     ;\
-	ldr	r2,=0xFEFC0000                                  ;\
-	str	r2,[r1]                                         ;\
-	ldr	r1,=DRFPR                                       ;\
-	ldr	r2,=0x81	/* DRAM refresh = 64KHz */      ;\
+        .endm
+#else // CYGHWR_HAL_ARM_EDB7XXX_VARIANT = EP7211, EP7212
+        .macro  INIT_MEMORY_CONFIG
+/* Initialize memory configuration */
+	ldr	r1,=MEMCFG1
+	ldr	r2,=0x8200A080
+	str	r2,[r1]
+	ldr	r1,=MEMCFG2
+	ldr	r2,=0xFEFC0000
+	str	r2,[r1]
+	ldr	r1,=DRFPR
+	ldr	r2,=0x81	/* DRAM refresh = 64KHz */
 	strb	r2,[r1]
+        .endm
 #endif
 
 #if defined(CYGSEM_HAL_STATIC_MMU_TABLES)
@@ -208,7 +288,7 @@ 20:
 
 #if (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 2)
 // Note: The DRAM on this board is very irregular in that every
-// other 256K piece is missing.  E.g. only these [physical] 
+// other 256K piece is missing.  E.g. only these [physical]
 // addresses are valid:
 //   0xC0000000..0xC003FFFF
 //   0xC0080000..0xC00BFFFF
@@ -220,242 +300,215 @@ 20:
 //      etc.
 // The MMU mapping code takes this into consideration and creates
 // a continuous logical map for the DRAM.
-#define MAP_DRAM                                                              \
-/* Map DRAM */                                                               ;\
-	ldr	r3,=DRAM_LA_START                                            ;\
-	ldr	r4,=DRAM_LA_END                                              ;\
-	ldr	r5,=DRAM_PA                                                  ;\
-/* 0x00000000..0x000FFFFF */                                                 ;\
-	mov	r6,r2		/* Set up page table descriptor */           ;\
-	ldr	r7,=MMU_L1_TYPE_Page                                         ;\
-	orr	r6,r6,r7                                                     ;\
-	str	r6,[r1],#4	/* Store PTE, update pointer */              ;\
-10:	mov	r6,r5		/* Build page table entry */                 ;\
-	ldr	r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable;\
-	orr	r6,r6,r7                                                     ;\
-	ldr	r7,=MMU_PAGE_SIZE                                            ;\
-	str	r6,[r2],#4	/* Next page */                              ;\
-	add	r3,r3,r7                                                     ;\
-	add	r5,r5,r7                                                     ;\
-	ldr	r8,=DRAM_LA_START+MMU_SECTION_SIZE                           ;\
-	cmp	r3,r8		/* Done with first 1M? */                    ;\
-	beq	20f                                                          ;\
-	ldr	r7,=0x40000	/* Special check for 256K boundary */        ;\
-	and	r7,r7,r5                                                     ;\
-	cmp	r7,#0                                                        ;\
-	beq	10b                                                          ;\
-	add	r5,r5,r7	/* Skip 256K hole */                         ;\
-	ldr	r7,=0x100000                                                 ;\
-	and	r7,r5,r7                                                     ;\
-	beq	10b                                                          ;\
-	add	r5,r5,r7	/* Nothing at 0xC0100000 */                  ;\
-	ldr	r7,=0x400000	/* Also nothing at 0xC0400000 */             ;\
-	and	r7,r5,r7                                                     ;\
-	beq	10b                                                          ;\
-	add	r5,r5,r7                                                     ;\
-	b	10b                                                          ;\
-20:                                                                          ;\
-/* 0x00100000..0x001FFFFF */                                                 ;\
-	mov	r6,r2		/* Set up page table descriptor */           ;\
-	ldr	r7,=MMU_L1_TYPE_Page                                         ;\
-	orr	r6,r6,r7                                                     ;\
-	str	r6,[r1],#4	/* Store PTE, update pointer */              ;\
-10:	mov	r6,r5		/* Build page table entry */                 ;\
-	ldr	r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable;\
-	orr	r6,r6,r7                                                     ;\
-	ldr	r7,=MMU_PAGE_SIZE                                            ;\
-	str	r6,[r2],#4	/* Next page */                              ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4		/* Done with first DRAM? */                  ;\
-	beq	20f                                                          ;\
-	add	r5,r5,r7                                                     ;\
-	ldr	r7,=0x40000	/* Special check for 256K boundary */        ;\
-	and	r7,r7,r5                                                     ;\
-	cmp	r7,#0                                                        ;\
-	beq	10b                                                          ;\
-	add	r5,r5,r7	/* Skip 256K hole */                         ;\
-	ldr	r7,=0x100000                                                 ;\
-	and	r7,r5,r7                                                     ;\
-	beq	10b                                                          ;\
-	add	r5,r5,r7	/* Nothing at 0xC0300000 */                  ;\
-	ldr	r7,=0x400000	/* Also nothing at 0xC0400000 */             ;\
-	and	r7,r5,r7                                                     ;\
-	beq	10b                                                          ;\
-	add	r5,r5,r7                                                     ;\
-	b	10b                                                          ;\
+        .macro  MAP_DRAM
+/* Map DRAM */
+	ldr	r3,=DRAM_LA_START
+	ldr	r4,=DRAM_LA_END
+	ldr	r5,=DRAM_PA
+/* 0x00000000..0x000FFFFF */
+	mov	r6,r2		/* Set up page table descriptor */
+	ldr	r7,=MMU_L1_TYPE_Page
+	orr	r6,r6,r7
+	str	r6,[r1],#4	/* Store PTE, update pointer */
+10:	mov	r6,r5		/* Build page table entry */
+	ldr	r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
+	orr	r6,r6,r7
+	ldr	r7,=MMU_PAGE_SIZE
+	str	r6,[r2],#4	/* Next page */
+	add	r3,r3,r7
+	add	r5,r5,r7
+	ldr	r8,=DRAM_LA_START+MMU_SECTION_SIZE
+	cmp	r3,r8		/* Done with first 1M? */
+	beq	20f
+	ldr	r7,=0x40000	/* Special check for 256K boundary */
+	and	r7,r7,r5
+	cmp	r7,#0
+	beq	10b
+	add	r5,r5,r7	/* Skip 256K hole */
+	ldr	r7,=0x100000
+	and	r7,r5,r7
+	beq	10b
+	add	r5,r5,r7	/* Nothing at 0xC0100000 */
+	ldr	r7,=0x400000	/* Also nothing at 0xC0400000 */
+	and	r7,r5,r7
+	beq	10b
+	add	r5,r5,r7
+	b	10b
+20:
+/* 0x00100000..0x001FFFFF */
+	mov	r6,r2		/* Set up page table descriptor */
+	ldr	r7,=MMU_L1_TYPE_Page
+	orr	r6,r6,r7
+	str	r6,[r1],#4	/* Store PTE, update pointer */
+10:	mov	r6,r5		/* Build page table entry */
+	ldr	r7,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
+	orr	r6,r6,r7
+	ldr	r7,=MMU_PAGE_SIZE
+	str	r6,[r2],#4	/* Next page */
+	add	r3,r3,r7
+	cmp	r3,r4		/* Done with first DRAM? */
+	beq	20f
+	add	r5,r5,r7
+	ldr	r7,=0x40000	/* Special check for 256K boundary */
+	and	r7,r7,r5
+	cmp	r7,#0
+	beq	10b
+	add	r5,r5,r7	/* Skip 256K hole */
+	ldr	r7,=0x100000
+	and	r7,r5,r7
+	beq	10b
+	add	r5,r5,r7	/* Nothing at 0xC0300000 */
+	ldr	r7,=0x400000	/* Also nothing at 0xC0400000 */
+	and	r7,r5,r7
+	beq	10b
+	add	r5,r5,r7
+	b	10b
 20:
 
 #elif (CYGHWR_HAL_ARM_EDB7XXX_DRAM_SIZE == 16)
-// The 16M board is arranged as:
+// The 16M EDB72xx boards are arranged as:
 //   0xC0000000..0xC07FFFFF
 //   0xC1000000..0xC17FFFFF
-#define MAP_DRAM                                                              \
-/* Map DRAM */                                                               ;\
-	ldr	r3,=DRAM_LA_START                                            ;\
-	ldr	r4,=DRAM_LA_END                                              ;\
-	ldr	r5,=DRAM_PA                                                  ;\
-/* 0xXXX00000..0xXXXFFFFF */                                                 ;\
-10:	mov	r6,r2		/* Set up page table descriptor */           ;\
-	ldr	r7,=MMU_L1_TYPE_Page                                         ;\
-	orr	r6,r6,r7                                                     ;\
-	str	r6,[r1],#4	/* Store PTE, update pointer */              ;\
-        ldr     r8,=MMU_SECTION_SIZE/MMU_PAGE_SIZE                           ;\
-	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 */      ;\
-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                                                     ;\
-	ldr	r7,=MMU_PAGE_SIZE                                            ;\
-	str	r6,[r2],#4	/* Next page */                              ;\
-	add	r3,r3,r7                                                     ;\
-	add	r5,r5,r7                                                     ;\
-        cmp     r3,r4           /* End of DRAM? */                           ;\
-        beq     20f                                                          ;\
-        sub     r8,r8,#1        /* End of 1M section? */                     ;\
-        cmp     r8,#0                                                        ;\
-        bne     12b             /* Next page */                              ;\
-        b       10b             /* Next section */                           ;\
+        .macro  MAP_DRAM
+/* Map DRAM */
+	ldr	r3,=DRAM_LA_START
+	ldr	r4,=DRAM_LA_END
+	ldr	r5,=DRAM_PA
+/* 0xXXX00000..0xXXXFFFFF */
+10:	mov	r6,r2		/* Set up page table descriptor */
+	ldr	r7,=MMU_L1_TYPE_Page
+	orr	r6,r6,r7
+	str	r6,[r1],#4	/* Store PTE, update pointer */
+        ldr     r8,=MMU_SECTION_SIZE/MMU_PAGE_SIZE
+	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 */
+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
+	ldr	r7,=MMU_PAGE_SIZE
+	str	r6,[r2],#4	/* Next page */
+	add	r3,r3,r7
+	add	r5,r5,r7
+        cmp     r3,r4           /* End of DRAM? */
+        beq     20f
+        sub     r8,r8,#1        /* End of 1M section? */
+        cmp     r8,#0
+        bne     12b             /* Next page */
+        b       10b             /* Next section */
 20:
+        .endm
 #else
 #error Invalid DRAM size select
 #endif
 
-#define PLATFORM_SETUP1                                                       \
-        INIT_MEMORY_CONFIG                                                   ;\
-/* Initialize MMU to create new memory map */                                ;\
-	ldr	r1,=MMU_BASE                                                 ;\
-	ldr	r2,=PTE_BASE                                                 ;\
-	MAP_DRAM                                                             ;\
-/* Nothing until PCMCIA0 */                                                  ;\
-	ldr	r3,=0x3FF	/* Page tables need 2K boundary */           ;\
-	add	r2,r2,r3                                                     ;\
-	ldr	r3,=~0x3FF                                                   ;\
-	and	r2,r2,r3                                                     ;\
-	ldr	r3,=(DRAM_LA_END+0x000FFFFF)&0xFFF00000                      ;\
-	ldr	r4,=EXPANSION2_LA_START                                      ;\
-	ldr	r5,=MMU_L1_TYPE_Fault                                        ;\
-	ldr	r7,=MMU_SECTION_SIZE                                         ;\
-10:	str	r5,[r1],#4                                                   ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-/* EXPANSION2, EXPANSION3, PCMCIA0, PCMCIA1 */                               ;\
-	ldr	r3,=EXPANSION2_LA_START                                      ;\
-	ldr	r4,=SRAM_LA_START                                            ;\
-	ldr	r5,=EXPANSION2_PA                                            ;\
-	ldr	r6,=MMU_L1_TYPE_Section|MMU_AP_Any                           ;\
-	ldr	r7,=MMU_SECTION_SIZE                                         ;\
-10:	orr	r0,r5,r6                                                     ;\
-	str	r0,[r1],#4                                                   ;\
-	add	r5,r5,r7                                                     ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-/* SRAM */                                                                   ;\
-	ldr	r3,=SRAM_LA_START                                            ;\
-	ldr	r4,=MMU_L1_TYPE_Page|MMU_DOMAIN(0)                           ;\
-	orr	r4,r4,r2                                                     ;\
-	str	r4,[r1],#4                                                   ;\
-	ldr	r7,=MMU_PAGE_SIZE                                            ;\
-        ldr     r5,=SRAM_LA_END                                              ;\
-05:	ldr	r4,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable;\
-	orr	r4,r3,r4                                                     ;\
-	str	r4,[r2],#4                                                   ;\
-        add     r3,r3,r7                                                     ;\
-        cmp     r3,r5                                                        ;\
-        bne     05b                                                          ;\
-	ldr	r4,=SRAM_LA_START+MMU_SECTION_SIZE                           ;\
-	ldr	r5,=MMU_L2_TYPE_Fault                                        ;\
-10:	str	r5,[r2],#4                                                   ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-	ldr	r4,=IO_LA_START                                              ;\
-	ldr	r5,=MMU_L1_TYPE_Fault                                        ;\
-	ldr	r7,=MMU_SECTION_SIZE                                         ;\
-20:	str	r5,[r1],#4                                                   ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	20b                                                          ;\
-/* I/O */                                                                    ;\
-	ldr	r3,=0x3FF	/* Page tables need 2K boundary */           ;\
-	add	r2,r2,r3                                                     ;\
-	ldr	r3,=~0x3FF                                                   ;\
-	and	r2,r2,r3                                                     ;\
-	ldr	r4,=MMU_L1_TYPE_Page|MMU_DOMAIN(0)                           ;\
-	orr	r4,r4,r2                                                     ;\
-	str	r4,[r1],#4                                                   ;\
-	ldr	r3,=IO_LA_START                                              ;\
-	ldr	r4,=IO_LA_END                                                ;\
-	ldr	r7,=MMU_PAGE_SIZE                                            ;\
-	ldr	r5,=IO_PA|MMU_L2_TYPE_Small|MMU_AP_All                       ;\
-10:	str	r5,[r2],#4                                                   ;\
-	add	r5,r5,r7                                                     ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-	ldr	r4,=IO_LA_START+MMU_SECTION_SIZE                             ;\
-	ldr	r5,=MMU_L2_TYPE_Fault                                        ;\
-	ldr	r7,=MMU_PAGE_SIZE                                            ;\
-10:	str	r5,[r2],#4                                                   ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-	ldr	r4,=LCD_LA_START                                             ;\
-	ldr	r5,=MMU_L1_TYPE_Fault                                        ;\
-	ldr	r7,=MMU_SECTION_SIZE                                         ;\
-20:	str	r5,[r1],#4                                                   ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	20b                                                          ;\
-/* LCD Buffer & Unmapped DRAM (holes and all) */                             ;\
-	ldr	r3,=LCD_LA_START                                             ;\
-	ldr	r4,=ROM0_LA_START                                            ;\
-	ldr	r5,=LCD_PA                                                   ;\
-	ldr	r6,=MMU_L1_TYPE_Section|MMU_AP_Any                            \
-                   |MMU_Bufferable|MMU_Cacheable                             ;\
-	ldr	r7,=MMU_SECTION_SIZE                                         ;\
-10:	orr	r0,r5,r6                                                     ;\
-	str	r0,[r1],#4                                                   ;\
-	add	r5,r5,r7                                                     ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-/* ROM0 */                                                                   ;\
-	ldr	r3,=ROM0_LA_START                                            ;\
-	ldr	r4,=ROM0_LA_END                                              ;\
-	ldr	r5,=ROM0_PA                                                  ;\
-	ldr	r6,=MMU_L1_TYPE_Section|MMU_AP_Any|MMU_Cacheable             ;\
-	ldr	r7,=MMU_SECTION_SIZE                                         ;\
-10:	orr	r0,r5,r6                                                     ;\
-	str	r0,[r1],#4                                                   ;\
-	add	r5,r5,r7                                                     ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-/* ROM1 */                                                                   ;\
-	ldr	r3,=ROM1_LA_START                                            ;\
-	ldr	r4,=ROM1_LA_END                                              ;\
-	ldr	r5,=ROM1_PA                                                  ;\
-	ldr	r6,=MMU_L1_TYPE_Section|MMU_AP_Any                           ;\
-	ldr	r7,=MMU_SECTION_SIZE                                         ;\
-10:	orr	r0,r5,r6                                                     ;\
-	str	r0,[r1],#4                                                   ;\
-	add	r5,r5,r7                                                     ;\
-	add	r3,r3,r7                                                     ;\
-	cmp	r3,r4                                                        ;\
-	bne	10b                                                          ;\
-/* Now initialize the MMU to use this new page table */                      ;\
-	ldr	r1,=MMU_BASE                                                 ;\
-        MMU_INITIALIZE                                                       ;\
+        .macro  MAP_L1_SEGMENT start end phys prot
+	ldr	r3,=0x3FF	/* Page tables need 2K boundary */
+	add	r2,r2,r3
+	ldr	r3,=~0x3FF
+	and	r2,r2,r3
+	ldr	r3,=\start
+	ldr	r4,=\end
+	ldr	r5,=\phys
+	ldr	r6,=\prot
+	ldr	r7,=MMU_SECTION_SIZE
+10:	orr	r0,r5,r6
+	str	r0,[r1],#4
+	add	r5,r5,r7
+	add	r3,r3,r7
+	cmp	r3,r4
+	bne	10b
+        .endm
+
+        .macro  PLATFORM_SETUP1
+        INIT_MEMORY_CONFIG
+#ifdef CYG_HAL_STARTUP_RAM
+        RELOCATE_RAM_IMAGE
+#endif        
+/* Initialize MMU to create new memory map */
+	ldr	r1,=MMU_BASE
+	ldr	r2,=PTE_BASE
+	MAP_DRAM
+/* Nothing until PCMCIA0 */
+        MAP_L1_SEGMENT (DRAM_LA_END+0x000FFFFF)&0xFFF00000 EXPANSION2_LA_START 0 MMU_L1_TYPE_Fault
+/* EXPANSION2, EXPANSION3, PCMCIA0, PCMCIA1 */
+        MAP_L1_SEGMENT EXPANSION2_LA_START SRAM_LA_START EXPANSION2_PA MMU_L1_TYPE_Section|MMU_AP_Any
+/* SRAM */
+	ldr	r3,=SRAM_LA_START
+	ldr	r4,=MMU_L1_TYPE_Page|MMU_DOMAIN(0)
+	orr	r4,r4,r2
+	str	r4,[r1],#4
+	ldr	r7,=MMU_PAGE_SIZE
+        ldr     r5,=SRAM_LA_END
+05:	ldr	r4,=MMU_L2_TYPE_Small|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
+	orr	r4,r3,r4
+	str	r4,[r2],#4
+        add     r3,r3,r7
+        cmp     r3,r5
+        bne     05b
+	ldr	r4,=SRAM_LA_START+MMU_SECTION_SIZE
+	ldr	r5,=MMU_L2_TYPE_Fault
+10:	str	r5,[r2],#4
+	add	r3,r3,r7
+	cmp	r3,r4
+	bne	10b
+	ldr	r4,=IO_LA_START
+	ldr	r5,=MMU_L1_TYPE_Fault
+	ldr	r7,=MMU_SECTION_SIZE
+20:	str	r5,[r1],#4
+	add	r3,r3,r7
+	cmp	r3,r4
+	bne	20b
+/* I/O */
+	ldr	r3,=0x3FF	/* Page tables need 2K boundary */
+	add	r2,r2,r3
+	ldr	r3,=~0x3FF
+	and	r2,r2,r3
+	ldr	r4,=MMU_L1_TYPE_Page|MMU_DOMAIN(0)
+	orr	r4,r4,r2
+	str	r4,[r1],#4
+	ldr	r3,=IO_LA_START
+	ldr	r4,=IO_LA_END
+	ldr	r7,=MMU_PAGE_SIZE
+	ldr	r5,=IO_PA|MMU_L2_TYPE_Small|MMU_AP_All
+10:	str	r5,[r2],#4
+	add	r5,r5,r7
+	add	r3,r3,r7
+	cmp	r3,r4
+	bne	10b
+	ldr	r4,=IO_LA_START+MMU_SECTION_SIZE
+	ldr	r5,=MMU_L2_TYPE_Fault
+	ldr	r7,=MMU_PAGE_SIZE
+10:	str	r5,[r2],#4
+	add	r3,r3,r7
+	cmp	r3,r4
+	bne	10b
+	ldr	r4,=LCD_LA_START
+	ldr	r5,=MMU_L1_TYPE_Fault
+	ldr	r7,=MMU_SECTION_SIZE
+20:	str	r5,[r1],#4
+	add	r3,r3,r7
+	cmp	r3,r4
+	bne	20b
+/* LCD Buffer & Unmapped DRAM (holes and all) */
+        MAP_L1_SEGMENT LCD_LA_START ROM0_LA_START LCD_PA MMU_L1_TYPE_Section|MMU_AP_Any|MMU_Bufferable|MMU_Cacheable
+/* ROM0 */
+        MAP_L1_SEGMENT ROM0_LA_START ROM0_LA_END ROM0_PA MMU_L1_TYPE_Section|MMU_AP_Any
+/* ROM1 */
+        MAP_L1_SEGMENT ROM1_LA_START ROM1_LA_END ROM1_PA MMU_L1_TYPE_Section|MMU_AP_Any
+/* Now initialize the MMU to use this new page table */
+	ldr	r1,=MMU_BASE
+        MMU_INITIALIZE
+#ifdef CYG_HAL_STARTUP_ROM                                                  
         RELOCATE_TEXT_SEGMENT
+#endif // CYG_HAL_STARTUP_ROM                                                          
+        .endm
 #endif // CYGSEM_HAL_STATIC_MMU_TABLES
 
 #else  // CYGSEM_HAL_INSTALL_MMU_TABLES
 
-#define PLATFORM_SETUP1                                                 
+#define PLATFORM_SETUP1
 #endif
 
 /*---------------------------------------------------------------------------*/
--- a/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c
+++ b/packages/hal/arm/edb7xxx/current/src/edb7xxx_misc.c
@@ -319,9 +319,11 @@ void hal_hardware_init(void)
 {
     volatile cyg_uint32 *icr;
     int vector;
+
     // Clear and initialize instruction cache
     HAL_ICACHE_INVALIDATE_ALL();
     HAL_ICACHE_ENABLE();
+
     // Any hardware/platform initialization that needs to be done.
     *(volatile cyg_uint32 *)INTMR1 = 0;
     *(volatile cyg_uint32 *)INTMR2 = 0;
@@ -329,6 +331,7 @@ void hal_hardware_init(void)
     *(volatile cyg_uint32 *)INTMR3 = 0;
     *(volatile cyg_uint8 *)SYSCON3 = SYSCON3_CLKCTL(CPU_CLOCK);
 #endif
+
 #if 0
     diag_printf("IMR1: %04x, IMR2: %04x\n",
                 *(volatile cyg_uint32 *)INTMR1,
@@ -396,6 +399,7 @@ void hal_hardware_init(void)
     // Initialize system control
     *(volatile cyg_uint32 *)SYSCON2 = SYSCON2_KBWEN;
 #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];
@@ -420,6 +424,7 @@ void hal_hardware_init(void)
 
     // Set up eCos/ROM interfaces
     hal_if_init();
+
 }
 
 //
--- a/packages/hal/arm/edb7xxx/current/support/Makefile
+++ b/packages/hal/arm/edb7xxx/current/support/Makefile
@@ -2,6 +2,8 @@
 # eCos support tools for Cirrus Logic EDB7xxx eval boards
 #
 
+CFLAGS += -D__LINUX -O2
+
 DL_FILES = dl_edb7xxx.o io.o
 ALL := dl_edb7xxx
 
--- a/packages/hal/arm/edb7xxx/current/support/dl_edb7xxx.c
+++ b/packages/hal/arm/edb7xxx/current/support/dl_edb7xxx.c
@@ -16,13 +16,22 @@
 #define CHAR_READY_IS_RELIABLE
 #endif
 
-#define DEFAULT_PORT "/dev/ttyS1"
-extern char ReceiveChar(long);
-extern void SendChar(long, char);
-extern void SetBaud(long, long);
-extern int  CharRead(long port);
-extern void WaitForOutputReady(long port);
-extern long OpenPort(char *);
+#define DEFAULT_PORT "/dev/ttyS0"
+extern char _ReceiveChar(long);
+extern void _SendChar(long, char);
+extern void _SetBaud(long, long);
+extern int  _CharRead(long port);
+extern void _WaitForOutputReady(long port);
+extern long _OpenPort(char *);
+extern int  _CharReady(long port);
+
+#define ReceiveChar _ReceiveChar
+#define SendChar    _SendChar
+#define SetBaud     _SetBaud
+#define CharRead    _CharRead
+#define WaitForOutputEmpty _WaitForOutputEmpty
+#define OpenPort    _OpenPort
+#define CharReady   _CharReady
 
 //****************************************************************************
 //
@@ -382,6 +391,7 @@ main(int argc, char *argv[])
         //
         fprintf(stderr, "\b\b\b\b\b%3d%%)",
                ((cFirstChar - cChar + 1) * 100) / (cFirstChar - '0'));
+        fprintf(stderr, "%c\n", cChar);
 
         //
         // Read a character from the boot code.
--- a/packages/hal/arm/edb7xxx/current/support/io.c
+++ b/packages/hal/arm/edb7xxx/current/support/io.c
@@ -46,7 +46,7 @@
 #include <fcntl.h>
 #include <termios.h>
 
-char ReceiveChar(long port)
+char _ReceiveChar(long port)
 {
     char buf;
     int res;
@@ -67,7 +67,7 @@ uspin(int len)
     }
 }
 
-void SendChar(long port, char ch)
+void _SendChar(long port, char ch)
 {
     char buf = ch;
     write(port, &buf, 1);
@@ -76,7 +76,7 @@ void SendChar(long port, char ch)
     uspin(100);
 }
 
-void SetBaud(long port, long reqRate)
+void _SetBaud(long port, long reqRate)
 {
     struct termios buf;
     int rate;
@@ -131,9 +131,10 @@ void SetBaud(long port, long reqRate)
 
     tcdrain(port);
     usleep(1000000/10*2);
+    sleep(2);
 }
 
-int CharReady(long port)
+int _CharReady(long port)
 {
 #ifdef __CYGWIN__
     // Windows doesn't support the below ioctl
@@ -145,12 +146,12 @@ int CharReady(long port)
 #endif
 }
 
-void WaitForOutputEmpty(long port)
+void _WaitForOutputEmpty(long port)
 {
     usleep(2000000);
 }
 
-long OpenPort(char *name)
+long _OpenPort(char *name)
 {
     int fd;
     fd = open(name, O_RDWR|O_NONBLOCK);
--- a/packages/hal/arm/sa11x0/ipaq/current/ChangeLog
+++ b/packages/hal/arm/sa11x0/ipaq/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-28  Richard Panton <rpanton@3glab.com>
+
+	* include/hal_platform_setup.h: Use correct MMU control register bits
+	during initial disable.
+
 2001-08-22  Gary Thomas  <gthomas@redhat.com>
 
 	* src/redboot_cmds.c: 
--- a/packages/hal/arm/sa11x0/ipaq/current/include/hal_platform_setup.h
+++ b/packages/hal/arm/sa11x0/ipaq/current/include/hal_platform_setup.h
@@ -298,7 +298,7 @@ 123:    ldr r1,[r0],#32
 	mcr p15,0,r0,c9,c0,0	// Flush Read-Buffer
 	mcr p15,0,r0,c7,c10,4	// Drain write buffer
 	mcr p15,0,r0,c13,c0,0	// Disable virtual ID mapping
-	mcr p15,0,r0,c1,c0,0	// Write MMU control register
+	mcr p15,0,r1,c1,c0,0	// Write MMU control register
 	nop; nop; nop; nop
 
         InitUART3
--- a/packages/hal/common/current/ChangeLog
+++ b/packages/hal/common/current/ChangeLog
@@ -1,3 +1,23 @@
+2001-10-01  Gary Thomas  <gthomas@redhat.com>
+
+	* src/generic-stub.c (getpacket): Send back error response (E01) if
+	packet received which overflows buffers.  GDB doesn't always do much
+	with this error, but at least it keeps the protocol moving.
+
+2001-09-26  Gary Thomas  <gthomas@redhat.com>
+
+	* cdl/common.cdl: New interface CYGINT_HAL_SUPPORTS_MMU_TABLES which
+	indicates if the HAL supports MMU tables (few do).
+
+2001-09-25  Gary Thomas  <gthomas@redhat.com>
+
+	* cdl/common.cdl (CYGSEM_HAL_INSTALL_MMU_TABLES): Change to be
+	default for ROM startup.
+
+2001-09-20  Jesper Skov  <jskov@redhat.com>
+
+	* tests/vaargs.c (cyg_start): Call CYG_TEST_INIT.
+
 2001-09-10  Nick Garnett  <nickg@redhat.com>
 
 	* include/hal_stub.h (strlen): Changed return type to size_t from
--- a/packages/hal/common/current/cdl/common.cdl
+++ b/packages/hal/common/current/cdl/common.cdl
@@ -91,9 +91,14 @@ cdl_option CYGSEM_HAL_STOP_CONSTRUCTORS_
         C library."
 }
 
+cdl_interface CYGINT_HAL_SUPPORTS_MMU_TABLES {
+    display   "HAL uses the MMU and allows for CDL manipulation of it's use"
+}
+
 cdl_option CYGSEM_HAL_INSTALL_MMU_TABLES {
     display        "Install MMU tables."
-    default_value  1
+    default_value  { CYG_HAL_STARTUP != "RAM" }
+    active_if      CYGINT_HAL_SUPPORTS_MMU_TABLES
     description    "This option controls whether this application installs
        its own Memory Management Unit (MMU) tables, or relies on the
        existing environment to run."
--- a/packages/hal/common/current/src/generic-stub.c
+++ b/packages/hal/common/current/src/generic-stub.c
@@ -222,13 +222,16 @@ static void
 getpacket (buffer)
      char *buffer;
 {
-  struct gdb_packet packet;
+    struct gdb_packet packet;
+    int res;
 
-  packet.state = 0;
-  packet.contents = buffer;
-  while (__add_char_to_packet (readDebugChar () & 0xff, &packet) != 1)
-    {
-      /* Empty */
+    packet.state = 0;
+    packet.contents = buffer;
+    while ((res = __add_char_to_packet (readDebugChar () & 0xff, &packet)) != 1) {
+        if (res == -2) {
+            putDebugChar ('+'); // Pretend we took the packet
+            __putpacket("E01"); // ... but didn't process it
+        }
     }
 }
 
@@ -260,7 +263,7 @@ int
         {
           if (packet->length == BUFMAX) {
             packet->state = 0;
-            return -1;
+            return -2;
           }
           packet->checksum += ch;
           packet->contents[packet->length++] = ch;
--- a/packages/hal/common/current/tests/vaargs.c
+++ b/packages/hal/common/current/tests/vaargs.c
@@ -139,6 +139,8 @@ entry(void)
 externC void
 cyg_start( void )
 {
+    CYG_TEST_INIT();
+
     entry();
 }
 
--- a/packages/hal/i386/pc/current/ChangeLog
+++ b/packages/hal/i386/pc/current/ChangeLog
@@ -1,3 +1,14 @@
+2001-10-02  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/hal_i386_pc.cdl 
+	(CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT): Allow user to
+	change value.
+
+2001-09-28  Ian Campbell  <icampbell@arcom.co.uk>
+
+	* include/platform.inc (hal_cpu_init): Initialise %ss.
+	Be more pedantic about register names matching opcode suffixes.
+
 2001-09-07  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* misc/redboot_FLOPPY.ecm: Disable
--- a/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl
+++ b/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl
@@ -138,10 +138,10 @@ cdl_package CYGPKG_HAL_I386_PC {
      }
 
      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
+          display       "Default console channel."
+          flavor        data
+          legal_values  0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1
+          default_value 0
      }
 
      cdl_option CYGSEM_HAL_I386_PC_DIAG_SCREEN {
--- a/packages/hal/i386/pc/current/include/platform.inc
+++ b/packages/hal/i386/pc/current/include/platform.inc
@@ -76,8 +76,8 @@ hal_cpu_init_start:
 	lgdt	0
 
 	# Make an IDT pointer in location 0 and load new LDTR
-	movw	$0x77F,%eax
-	movw	%eax,0
+	movw	$0x77F,%ax
+	movw	%ax,0
 	leal	idtStart,%eax
 	movl	%eax,2	
 	lidt	0
@@ -140,6 +140,8 @@ 3:
 	movw	%ax, %fs
 	movw	%ax, %gs
 
+	movw	%ax, %ss
+	
 	# Set up SP
 	movl	$__interrupt_stack,%esp
 	
--- a/packages/hal/i386/pcmb/current/ChangeLog
+++ b/packages/hal/i386/pcmb/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-14  Mark Salter  <msalter@redhat.com>
+
+	* include/pcmb_io.h (HAL_IDE_READ_ALTSTATUS): Add 2 for correct offset.
+	(HAL_IDE_WRITE_CONTROL): Ditto.
+
 2001-08-22  Nick Garnett  <nickg@redhat.com>
 
 	* src/pcmb_misc.c: Added spinlock to clock read operation.
--- a/packages/hal/i386/pcmb/current/include/pcmb_io.h
+++ b/packages/hal/i386/pcmb/current/include/pcmb_io.h
@@ -213,14 +213,14 @@ CYG_MACRO_END
 #define HAL_IDE_READ_UINT16( __ctlr, __regno, __val )  \
     HAL_READ_UINT16(__CMD_ADDR(__ctlr) + (__regno), (__val))
 #define HAL_IDE_READ_ALTSTATUS( __ctlr, __val )  \
-    HAL_READ_UINT16(__CTL_ADDR(__ctlr), (__val))
+    HAL_READ_UINT16(__CTL_ADDR(__ctlr) + 2, (__val))
 
 #define HAL_IDE_WRITE_UINT8( __ctlr, __regno, __val )  \
     HAL_WRITE_UINT8(__CMD_ADDR(__ctlr) + (__regno), (__val))
 #define HAL_IDE_WRITE_UINT16( __ctlr, __regno, __val )  \
     HAL_WRITE_UINT16(__CMD_ADDR(__ctlr) + (__regno), (__val))
 #define HAL_IDE_WRITE_CONTROL( __ctlr, __val )  \
-    HAL_WRITE_UINT16(__CTL_ADDR(__ctlr), (__val))
+    HAL_WRITE_UINT16(__CTL_ADDR(__ctlr) + 2, (__val))
 
 
 //-----------------------------------------------------------------------------
--- a/packages/hal/mips/arch/current/ChangeLog
+++ b/packages/hal/mips/arch/current/ChangeLog
@@ -1,3 +1,15 @@
+2001-09-17  Nick Garnett  <nickg@redhat.com>
+
+	* src/hal_misc.c (hal_delay_us): Rewrote this routine to work
+	correctly in higher speed CPUs. The counter register counts at
+	half CPU clock speed. The original ticks calculation could
+	overflow very easily. For example in a 133MHz CPU, it overflowed
+	with any argument greater than 32! This is another of those "how
+	did it ever work?" things.
+
+	* include/hal_arch.h: Added casts to CYGARC_PHYSICAL_ADDRESS() and
+	friends.
+
 2001-09-07  Nick Garnett  <nickg@redhat.com>
 
 	* include/mips-stub.h: Returned target_register_t to long long
@@ -1477,7 +1489,7 @@ 1998-07-23  Nick Garnett  <nickg@cygnus.
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                        
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
--- a/packages/hal/mips/arch/current/include/hal_arch.h
+++ b/packages/hal/mips/arch/current/include/hal_arch.h
@@ -453,9 +453,9 @@ externC void hal_idle_thread_action(cyg_
 #define CYGARC_KSEG_UNCACHED                           (0xA0000000)
 #define CYGARC_KSEG_CACHED_BASE                        (0x80000000)
 #define CYGARC_KSEG_UNCACHED_BASE                      (0xA0000000)
-#define CYGARC_CACHED_ADDRESS(x)                       (((x) & ~CYGARC_KSEG_MASK) | CYGARC_KSEG_CACHED)
-#define CYGARC_UNCACHED_ADDRESS(x)                     (((x) & ~CYGARC_KSEG_MASK) | CYGARC_KSEG_UNCACHED)
-#define CYGARC_PHYSICAL_ADDRESS(x)                     ((x) & ~CYGARC_KSEG_MASK)
+#define CYGARC_CACHED_ADDRESS(x)                       ((((CYG_ADDRESS)(x)) & ~CYGARC_KSEG_MASK) | CYGARC_KSEG_CACHED)
+#define CYGARC_UNCACHED_ADDRESS(x)                     ((((CYG_ADDRESS)(x)) & ~CYGARC_KSEG_MASK) | CYGARC_KSEG_UNCACHED)
+#define CYGARC_PHYSICAL_ADDRESS(x)                     (((CYG_ADDRESS)(x)) & ~CYGARC_KSEG_MASK)
 #ifdef __ASSEMBLER__
 #define CYGARC_ADDRESS_REG_CACHED(reg)                 \
         and     reg, reg, ~CYGARC_KSEG_MASK;           \
--- a/packages/hal/mips/arch/current/src/hal_misc.c
+++ b/packages/hal/mips/arch/current/src/hal_misc.c
@@ -338,20 +338,40 @@ hal_delay_us(int us)
 {
     cyg_uint32 val1, val2;
     int diff;
+    long usticks;
     long ticks;
-    // Scale the desired number of microseconds to be a number of
-    // incrementer ticks
-    ticks = us * (CYGNUM_HAL_RTC_PERIOD * CYGNUM_HAL_RTC_DENOMINATOR) / 1000000;
+
+    // Calculate the number of counter register ticks per microsecond.
+    
+    usticks = (CYGNUM_HAL_RTC_PERIOD * CYGNUM_HAL_RTC_DENOMINATOR) / 1000000;
+
+    // Make sure that the value is not zero. This will only happen if the
+    // CPU is running at < 2MHz.
+    if( usticks == 0 ) usticks = 1;
+    
+    while( us > 0 )
+    {
+        int us1 = us;
 
-    asm volatile("mfc0 %0,$9;" : "=r"(val1));
-    while (ticks > 0) {
-        do {
-            asm volatile("mfc0 %0,$9;" : "=r"(val2));
-        } while (val1 == val2);
-        diff = val2 - val1;
-        if (diff < 0) diff += CYGNUM_HAL_RTC_PERIOD;
-        ticks -= diff;
-        val1 = val2;
+        // Wait in bursts of less than 10000us to avoid any overflow
+        // problems in the multiply.
+        if( us1 > 10000 )
+            us1 = 10000;
+
+        us -= us1;
+
+        ticks = us1 * usticks;
+
+        asm volatile("mfc0 %0,$9;" : "=r"(val1));
+        while (ticks > 0) {
+            do {
+                asm volatile("mfc0 %0,$9;" : "=r"(val2));
+            } while (val1 == val2);
+            diff = val2 - val1;
+            if (diff < 0) diff += CYGNUM_HAL_RTC_PERIOD;
+            ticks -= diff;
+            val1 = val2;
+        }
     }
 }
 
--- a/packages/hal/mips/vr4300/current/ChangeLog
+++ b/packages/hal/mips/vr4300/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/hal_mips_vr4300.cdl: Define endianness in platform CDL instead.
+
 2001-09-10  Nick Garnett  <nickg@redhat.com>
 
 	* src/mips_vr4300.ld: Added .2ram sections to data section needed
@@ -241,3 +245,29 @@ 1999-04-21  Nick Garnett  <nickg@cygnus.
 	
 	* src/PKGconf.mak (COMPILE): Added imp_misc.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####
+//===========================================================================
--- a/packages/hal/mips/vr4300/current/cdl/hal_mips_vr4300.cdl
+++ b/packages/hal/mips/vr4300/current/cdl/hal_mips_vr4300.cdl
@@ -23,7 +23,7 @@
 #                                                                          
 # The Initial Developer of the Original Code is Red Hat.                   
 # Portions created by Red Hat are                                          
-# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
 # All Rights Reserved.                                                     
 # -------------------------------------------                              
 #                                                                          
@@ -31,8 +31,7 @@
 # ====================================================================
 ######DESCRIPTIONBEGIN####
 #
-# Author(s):      jskov
-# Original data:  nickg
+# Author(s):      nickg
 # Contributors:
 # Date:           1999-11-02
 #
@@ -67,12 +66,6 @@ cdl_package CYGPKG_HAL_MIPS_VR4300 {
         calculated 1
     }
 
-    cdl_option CYGPKG_HAL_MIPS_MSBFIRST {
-        display    "CPU Variant big-endian"
-        calculated { CYGPKG_HAL_MIPS_VR4300_VRC4373 != 0 }
-    }
-
-
     define_proc {
         puts $::cdl_header "#include <pkgconf/hal_mips.h>"
     }
--- a/packages/hal/mips/vrc4373/current/ChangeLog
+++ b/packages/hal/mips/vrc4373/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/hal_mips_vr4300_vrc4373.cdl: Define CPU as big-endian here.
+
 2001-09-07  Nick Garnett  <nickg@redhat.com>
 
 	* cdl/hal_mips_vr4300_vrc4373.cdl: Brought up to date and much of
@@ -504,3 +508,29 @@ 1999-04-21  Nick Garnett  <nickg@cygnus.
 	Added an implementation of hal_intc_init. Changed initial status
 	register value. Moved VRC4372 register definitions here.
 
+
+//===========================================================================
+//####COPYRIGHTBEGIN####
+//                                                                          
+// -------------------------------------------                              
+// The contents of this file are subject to the Red Hat eCos Public License 
+// Version 1.1 (the "License"); you may not use this file except in         
+// compliance with the License.  You may obtain a copy of the License at    
+// http://www.redhat.com/                                                   
+//                                                                          
+// Software distributed under the License is distributed on an "AS IS"      
+// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
+// License for the specific language governing rights and limitations under 
+// the License.                                                             
+//                                                                          
+// The Original Code is eCos - Embedded Configurable Operating System,      
+// released 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####
+//===========================================================================
--- a/packages/hal/mips/vrc4373/current/cdl/hal_mips_vr4300_vrc4373.cdl
+++ b/packages/hal/mips/vrc4373/current/cdl/hal_mips_vr4300_vrc4373.cdl
@@ -23,7 +23,7 @@
 #                                                                          
 # The Initial Developer of the Original Code is Red Hat.                   
 # Portions created by Red Hat are                                          
-# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.             
 # All Rights Reserved.                                                     
 # -------------------------------------------                              
 #                                                                          
@@ -31,8 +31,7 @@
 # ====================================================================
 ######DESCRIPTIONBEGIN####
 #
-# Author(s):      jskov
-# Original data:  bartv
+# Author(s):      nickg
 # Contributors:
 # Date:           1999-11-02
 #
@@ -71,6 +70,11 @@ cdl_package CYGPKG_HAL_MIPS_VR4300_VRC43
            the system for either RAM bootstrap or ROM bootstrap."
     }
 
+    cdl_option CYGPKG_HAL_MIPS_MSBFIRST {
+        display    "CPU big-endian"
+        calculated { 1 }
+    }
+
     # Real-time clock/counter specifics
     cdl_component CYGNUM_HAL_RTC_CONSTANTS {
         display       "Real-time clock constants."
--- a/packages/hal/mips/vrc437x/current/ChangeLog
+++ b/packages/hal/mips/vrc437x/current/ChangeLog
@@ -1,3 +1,19 @@
+2001-09-17  Nick Garnett  <nickg@redhat.com>
+
+	* src/plf_misc.c:
+	Added ISR for dealing with spurious interrupts from the VRC437X.
+	Added PCI initialization routine.
+
+	* src/platform.S: Change PCI IO base address setup to a more
+	explicit value.
+
+	* include/plf_io.h: Adjust PCI IO and memory base addresses to
+	match the actual hardware setup.
+	Add explicit PCI initialization routine.
+
+	* include/platform.inc: Install bus error VSR in non-stub
+	configurations too.
+
 2001-09-07  Nick Garnett  <nickg@redhat.com>
 
 	This package is newly created to contain code that is common to
--- a/packages/hal/mips/vrc437x/current/include/platform.inc
+++ b/packages/hal/mips/vrc437x/current/include/platform.inc
@@ -375,7 +375,7 @@ 1:
 	sw	v0,(4*4)(v1)
 	sw	v0,(5*4)(v1)
 	sw	v0,(6*4)(v1)
-	sw	v0,(7*4)(v1)
+#	sw	v0,(7*4)(v1)	# Bus error
 	sw	v0,(8*4)(v1)
 	sw	v0,(9*4)(v1)
 	sw	v0,(10*4)(v1)
@@ -393,6 +393,12 @@ 1:
 	la	v0,__default_interrupt_vsr
 	sw	v0,(0*4)(v1)
 
+	# plant a pointer to our own bus error handler. See the
+	# comments in platform.S.
+	.extern	hal_bus_error_vsr
+	la	v0,hal_bus_error_vsr
+	sw	v0,(7*4)(v1)
+
 	.endm
 
 #endif
--- a/packages/hal/mips/vrc437x/current/include/plf_io.h
+++ b/packages/hal/mips/vrc437x/current/include/plf_io.h
@@ -67,14 +67,14 @@
 
 // This is where the PCI spaces are mapped in the CPU's (virtual)
 // address space.
-#define HAL_PCI_PHYSICAL_MEMORY_BASE    0xC0000000
-#define HAL_PCI_PHYSICAL_IO_BASE        0xAC000000
+#define HAL_PCI_PHYSICAL_IO_BASE        0xA0000000
+#define HAL_PCI_PHYSICAL_MEMORY_BASE    0xBC100000
 
 //-----------------------------------------------------------------------------
 
 // Initialize the PCI bus.
-// This has actually already been done by the HAL.
-#define HAL_PCI_INIT()
+externC void cyg_hal_plf_pci_init(void);
+#define HAL_PCI_INIT() cyg_hal_plf_pci_init()
 
 // Compute address necessary to access PCI config space for the given
 // bus and device.
@@ -177,7 +177,7 @@ CYG_MACRO_END
 
 // Map PCI device resources starting from these addresses in PCI space.
 #define HAL_PCI_ALLOC_BASE_MEMORY       0
-#define HAL_PCI_ALLOC_BASE_IO           0
+#define HAL_PCI_ALLOC_BASE_IO           0x0c000000
 
 // Translate the PCI interrupt requested by the device (INTA#, INTB#,
 // INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector).
--- a/packages/hal/mips/vrc437x/current/src/platform.S
+++ b/packages/hal/mips/vrc437x/current/src/platform.S
@@ -695,7 +695,7 @@ hal_memc_setup_table:
 	.long	PCISLAVADDR2,	0x10081080
 
 	# Map PCI IO space Phys == Local
-	.long	PCIMSTRIO,	(0x000fd000 | ( PCI_IOSPACE_BASE << 24) | PCI_IOSPACE_BASE)
+	.long	PCIMSTRIO,	0x0c0fd00c
 
 	# VRC437X Bridge config space
 
--- a/packages/hal/mips/vrc437x/current/src/plf_misc.c
+++ b/packages/hal/mips/vrc437x/current/src/plf_misc.c
@@ -58,8 +58,28 @@
 
 /*------------------------------------------------------------------------*/
 
+#ifdef CYGSEM_HAL_MIPS_VR4300_VRC437X_DIAG_ACKS_INT_0
+
+static cyg_uint32 hal_int0_count = 0;
+
+static cyg_uint32 hal_int0_isr( cyg_uint32 vector, cyg_uint32 data )
+{
+    hal_int0_count++;
+    HAL_INTERRUPT_ACKNOWLEDGE( CYGNUM_HAL_INTERRUPT_VRC437X );
+    return 0;
+}
+
+#endif
+
+/*------------------------------------------------------------------------*/
+
+
 void hal_platform_init(void)
 {
+#ifdef CYGSEM_HAL_MIPS_VR4300_VRC437X_DIAG_ACKS_INT_0
+    HAL_INTERRUPT_ATTACH( CYGNUM_HAL_INTERRUPT_VRC437X, hal_int0_isr, 0, 0 );
+#endif
+    
 #if defined(CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT)
     // Set up eCos/ROM interfaces
     hal_if_init();
@@ -75,7 +95,21 @@ void hal_platform_init(void)
         patch_dbg_syscalls( (void *)(&hal_virtual_vector_table[0]) );
     }
 #endif
+
 }
+/*------------------------------------------------------------------------*/
+// One-time PCI initialization.
+
+void cyg_hal_plf_pci_init(void)
+{
+    cyg_uint8  next_bus;
+
+    // Configure PCI bus.
+    next_bus = 1;
+    cyg_pci_configure_bus(0, &next_bus);
+
+}
+    
 
 /*------------------------------------------------------------------------*/
 /* Functions to support the detection and execution of a user provoked    */
--- a/packages/hal/sh/arch/current/ChangeLog
+++ b/packages/hal/sh/arch/current/ChangeLog
@@ -1,3 +1,14 @@
+2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/sh.ld: Make separate section for GOT and .eh_frame.
+	Make macro section for all reloc sections.
+	Input extras.o unconditionally.
+	* cdl/hal_sh.cdl: Don't bother with -DEXTRAS=1 - unconditional now.
+
+2001-09-12  Jesper Skov  <jskov@redhat.com>
+
+	* src/vectors.S: Don't include C intr header.
+
 2001-09-11  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/hal_sh.cdl (CYGHWR_HAL_SH_BIGENDIAN): Set the default
@@ -851,7 +862,7 @@ 1999-04-22  Jesper Skov  <jskov@lassi.cy
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                      
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
--- a/packages/hal/sh/arch/current/cdl/hal_sh.cdl
+++ b/packages/hal/sh/arch/current/cdl/hal_sh.cdl
@@ -78,7 +78,7 @@ cdl_package CYGPKG_HAL_SH {
 
     make {
         <PREFIX>/lib/target.ld: <PACKAGE>/src/sh.ld
-        $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $<
+        $(CC) -E -P -Wp,-MD,target.tmp -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $<
         @echo $@ ": \\" > $(notdir $@).deps
         @tail +2 target.tmp >> $(notdir $@).deps
         @echo >> $(notdir $@).deps
--- a/packages/hal/sh/arch/current/src/sh.ld
+++ b/packages/hal/sh/arch/current/src/sh.ld
@@ -23,7 +23,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -45,10 +45,12 @@
 
 STARTUP(vectors.o)
 ENTRY(CYG_LABEL_DEFN(_reset))
-#ifdef EXTRAS
 INPUT(extras.o)
+#if (__GNUC__ >= 3)
+GROUP(libtarget.a libgcc.a libsupc++.a)
+#else
+GROUP(libtarget.a libgcc.a)
 #endif
-GROUP(libtarget.a libgcc.a)
 
 #define ALIGN_LMA 16
 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
@@ -82,7 +84,6 @@ GROUP(libtarget.a libgcc.a)
       KEEP(*(SORT(.dtors*))) CYG_LABEL_DEFN(__DTOR_END__) = ABSOLUTE(.); \
     . = ALIGN(8);							 \
       KEEP(*( SORT (.ecos.table.*))) ;					 \
-      *(.got*) *(.rela.got) *(.rel.got)					 \
     . = ALIGN(4);                                                        \
     } > _region_							 \
     CYG_LABEL_DEFN(_rom_data_start) = LOADADDR(.data);			 \
@@ -90,6 +91,73 @@ GROUP(libtarget.a libgcc.a)
     CYG_LABEL_DEFN(edata) = .; PROVIDE (edata = .);
 
 
+#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_
+
+#define SECTION_got(_region_, _vma_, _lma_)                                 \
+  .got _vma_ : _lma_                                                        \
+    {                                                                       \
+      FORCE_OUTPUT; *(.got.plt) *(.got)                                     \
+    } > _region_
 
 #define SECTION_fini(_region_, _vma_, _lma_)	\
     .fini _vma_ : _lma_				\
--- a/packages/hal/sh/arch/current/src/vectors.S
+++ b/packages/hal/sh/arch/current/src/vectors.S
@@ -58,9 +58,6 @@
 #include <cyg/hal/sh_regs.h>
 #include <cyg/hal/sh_offsets.inc>
 
-#include <cyg/hal/hal_intr.h>
-
-
 #===========================================================================
 
         .file   "vectors.S"
--- a/packages/hal/sh/edk7708/current/ChangeLog
+++ b/packages/hal/sh/edk7708/current/ChangeLog
@@ -1,3 +1,19 @@
+2001-09-13  Jesper Skov  <jskov@redhat.com>
+
+	* include/pkgconf/mlt_sh_edk7708_romram.mlt: Moved RAM to
+	0x88000000, flash to 0x80000000, leave 0x10000 for RedBoot.
+	* include/pkgconf/mlt_sh_edk7708_romram.ldi: Same.
+	* include/pkgconf/mlt_sh_edk7708_romram.h: Same.
+	* include/pkgconf/mlt_sh_edk7708_rom.mlt: Same.
+	* include/pkgconf/mlt_sh_edk7708_rom.ldi: Same.
+	* include/pkgconf/mlt_sh_edk7708_rom.h: Same.
+	* include/pkgconf/mlt_sh_edk7708_ram.mlt: Same.
+	* include/pkgconf/mlt_sh_edk7708_ram.ldi: Same.
+	* include/pkgconf/mlt_sh_edk7708_ram.h: Same.
+
+	* cdl/hal_sh_edk7708.cdl: Moved memory to 88000000. Added RedBoot
+	options. Made LE by default.
+
 2001-09-11  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/hal_sh_edk7708.cdl: Default to big endian.
--- a/packages/hal/sh/edk7708/current/cdl/hal_sh_edk7708.cdl
+++ b/packages/hal/sh/edk7708/current/cdl/hal_sh_edk7708.cdl
@@ -56,15 +56,14 @@ cdl_package CYGPKG_HAL_SH_EDK7708 {
     implements    CYGINT_HAL_DEBUG_GDB_STUBS_BREAK
     implements    CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT
     implements    CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT_NOT_GUARANTEED
-    implements    CYGINT_HAL_SH_PLF_BIGENDIAN_DEFAULT
 
     define_proc {
         puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H   <pkgconf/hal_sh.h>"
         puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_sh_edk7708.h>"
 
         puts $::cdl_header "#define CYGNUM_HAL_SH_SH3_SCI_PORTS 1"
-        puts $::cdl_header "#define CYGHWR_HAL_VSR_TABLE 0x08000000"
-        puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0x08000100"
+        puts $::cdl_header "#define CYGHWR_HAL_VSR_TABLE 0x88000000"
+        puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0x88000100"
     }
 
     cdl_component CYG_HAL_STARTUP {
@@ -311,4 +310,31 @@ cdl_package CYGPKG_HAL_SH_EDK7708 {
             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 {
+                <PREFIX>/bin/redboot.bin : <PREFIX>/bin/redboot.elf
+                $(OBJCOPY) --strip-debug $< $(@:.bin=.img) 
+                $(OBJCOPY) -O srec $< $(@:.bin=.srec)
+                $(OBJCOPY) -O binary $< $@
+            }
+        }
+    }
 }
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.h
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.h
@@ -7,11 +7,11 @@
 #include <stddef.h>
 
 #endif
-#define CYGMEM_REGION_ram (0x8008000)
-#define CYGMEM_REGION_ram_SIZE (0xf8000)
+#define CYGMEM_REGION_ram (0x88010000)
+#define CYGMEM_REGION_ram_SIZE (0xf0000)
 #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 (0x8100000 - (size_t) CYG_LABEL_NAME (__heap1))
+#define CYGMEM_SECTION_heap1_SIZE (0x88100000 - (size_t) CYG_LABEL_NAME (__heap1))
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.ldi
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.ldi
@@ -6,13 +6,13 @@
 
 MEMORY
 {
-    ram : ORIGIN = 0x8008000, LENGTH = 0xf8000
+    ram : ORIGIN = 0x88010000, LENGTH = 0xf0000
 }
 
 SECTIONS
 {
     SECTIONS_BEGIN
-    SECTION_vectors (ram, 0x8008000, LMA_EQ_VMA)
+    SECTION_vectors (ram, 0x88010000, 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)
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.mlt
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_ram.mlt
@@ -1,6 +1,6 @@
 version 0
-region ram 8008000 f8000 0 !
-section vectors 0 1 0 1 1 1 1 1 8008000 8008000 text text !
+region ram 88010000 f0000 0 !
+section vectors 0 1 0 1 1 1 1 1 88010000 88010000 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 !
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.h
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.h
@@ -7,14 +7,14 @@
 #include <stddef.h>
 
 #endif
-#define CYGMEM_REGION_ram (0x8000200)
+#define CYGMEM_REGION_ram (0x88000200)
 #define CYGMEM_REGION_ram_SIZE (0xffe00)
 #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
-#define CYGMEM_REGION_rom (0xa0000000)
+#define CYGMEM_REGION_rom (0x80000000)
 #define CYGMEM_REGION_rom_SIZE (0x20000)
 #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 (0x8100000 - (size_t) CYG_LABEL_NAME (__heap1))
+#define CYGMEM_SECTION_heap1_SIZE (0x88100000 - (size_t) CYG_LABEL_NAME (__heap1))
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.ldi
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.ldi
@@ -6,21 +6,21 @@
 
 MEMORY
 {
-    ram : ORIGIN = 0x8000200, LENGTH = 0xffe00
-    rom : ORIGIN = 0xa0000000, LENGTH = 0x20000
+    ram : ORIGIN = 0x88000200, LENGTH = 0xffe00
+    rom : ORIGIN = 0x80000000, LENGTH = 0x20000
 }
 
 SECTIONS
 {
     SECTIONS_BEGIN
-    SECTION_vectors (rom, 0xa0000000, LMA_EQ_VMA)
+    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)
-    SECTION_data (ram, 0x8000200, FOLLOWING (.gcc_except_table))
+    SECTION_data (ram, 0x88000200, FOLLOWING (.gcc_except_table))
     SECTION_bss (ram, ALIGN (0x10), LMA_EQ_VMA)
     CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
     SECTIONS_END
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.mlt
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_rom.mlt
@@ -1,10 +1,10 @@
 version 0
-region ram 8000200 ffe00 0 !
-region rom a0000000 20000 1 !
-section data 0 1 1 1 1 1 0 0 8000200 bss !
+region ram 88000200 ffe00 0 !
+region rom 80000000 20000 1 !
+section data 0 1 1 1 1 1 0 0 88000200 bss !
 section bss 0 10 0 1 0 1 0 1 heap1 heap1 !
 section heap1 0 8 0 0 0 0 0 0 !
-section vectors 0 1 0 1 1 1 1 1 a0000000 a0000000 text text !
+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 !
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.h
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.h
@@ -7,14 +7,14 @@
 #include <stddef.h>
 
 #endif
-#define CYGMEM_REGION_ram (0x8000200)
+#define CYGMEM_REGION_ram (0x88000200)
 #define CYGMEM_REGION_ram_SIZE (0xffe00)
 #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
-#define CYGMEM_REGION_rom (0xa0000000)
+#define CYGMEM_REGION_rom (0x80000000)
 #define CYGMEM_REGION_rom_SIZE (0x20000)
 #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 (0x8100000 - (size_t) CYG_LABEL_NAME (__heap1))
+#define CYGMEM_SECTION_heap1_SIZE (0x88100000 - (size_t) CYG_LABEL_NAME (__heap1))
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.ldi
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.ldi
@@ -6,14 +6,14 @@
 
 MEMORY
 {
-    ram : ORIGIN = 0x8000200, LENGTH = 0xffe00
-    rom : ORIGIN = 0xa0000000, LENGTH = 0x20000
+    ram : ORIGIN = 0x88000200, LENGTH = 0xffe00
+    rom : ORIGIN = 0x80000000, LENGTH = 0x20000
 }
 
 SECTIONS
 {
     SECTIONS_BEGIN
-    SECTION_vectors (ram, 0x8000200, AT (0xa0000000))
+    SECTION_vectors (ram, 0x88000200, AT (0x80000000))
     SECTION_text (ram, ALIGN (0x10), FOLLOWING (.vectors))
     SECTION_fini (ram, ALIGN (0x10), FOLLOWING (.text))
     SECTION_rodata1 (ram, ALIGN (0x10), FOLLOWING (.fini))
--- a/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.mlt
+++ b/packages/hal/sh/edk7708/current/include/pkgconf/mlt_sh_edk7708_romram.mlt
@@ -1,7 +1,7 @@
 version 0
-region ram 8000200 ffe00 0 !
-region rom a0000000 20000 1 !
-section vectors 0 10 1 1 1 1 1 1 8000200 a0000000 text text !
+region ram 88000200 ffe00 0 !
+region rom 80000000 20000 1 !
+section vectors 0 10 1 1 1 1 1 1 88000200 80000000 text text !
 section text 0 10 1 1 0 1 0 1 fini fini !
 section fini 0 10 1 1 0 1 0 1 rodata1 rodata1 !
 section rodata1 0 10 1 1 0 1 0 1 rodata rodata !
new file mode 100644
--- /dev/null
+++ b/packages/hal/sh/edk7708/current/misc/redboot_RAM.ecm
@@ -0,0 +1,79 @@
+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    sh7708 ;
+    template    redboot ;
+    package -hardware CYGPKG_HAL_SH current ;
+    package -hardware CYGPKG_HAL_SH_SH3 current ;
+    package -hardware CYGPKG_HAL_SH_EDK7708 current ;
+    package -hardware CYGPKG_DEVICES_WALLCLOCK_SH3 current ;
+    package -hardware CYGPKG_IO_SERIAL_SH_SCI current ;
+    package -hardware CYGPKG_IO_SERIAL_SH_EDK7708 current ;
+    package -hardware CYGPKG_DEVICES_WATCHDOG_SH_SH3 current ;
+    package -hardware CYGPKG_DEVS_FLASH_SH_EDK7708 current ;
+    package -hardware CYGPKG_DEVS_FLASH_ATMEL_AT29CXXXX 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_IO_FLASH 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_SH_7708 {
+    inferred_value 1
+};
+
+cdl_component CYGBLD_BUILD_REDBOOT {
+    user_value 1
+};
+
+cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP {
+    user_value 0
+};
+
+cdl_option CYGBLD_ISO_STRTOK_R_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+
new file mode 100644
--- /dev/null
+++ b/packages/hal/sh/edk7708/current/misc/redboot_ROM.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    sh7708 ;
+    template    redboot ;
+    package -hardware CYGPKG_HAL_SH current ;
+    package -hardware CYGPKG_HAL_SH_SH3 current ;
+    package -hardware CYGPKG_HAL_SH_EDK7708 current ;
+    package -hardware CYGPKG_DEVICES_WALLCLOCK_SH3 current ;
+    package -hardware CYGPKG_IO_SERIAL_SH_SCI current ;
+    package -hardware CYGPKG_IO_SERIAL_SH_EDK7708 current ;
+    package -hardware CYGPKG_DEVICES_WATCHDOG_SH_SH3 current ;
+    package -hardware CYGPKG_DEVS_FLASH_SH_EDK7708 current ;
+    package -hardware CYGPKG_DEVS_FLASH_ATMEL_AT29CXXXX 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_IO_FLASH 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 CYGPKG_HAL_SH_7708 {
+    inferred_value 1
+};
+
+cdl_component CYG_HAL_STARTUP {
+    user_value ROM
+};
+
+cdl_component CYGBLD_BUILD_REDBOOT {
+    user_value 1
+};
+
+cdl_option CYGOPT_REDBOOT_FIS_REDBOOT_BACKUP {
+    user_value 0
+};
+
+cdl_option CYGBLD_ISO_STRTOK_R_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER {
+    inferred_value 1 <cyg/libc/string/string.h>
+};
+
+
--- a/packages/hal/sh/sh3/current/ChangeLog
+++ b/packages/hal/sh/sh3/current/ChangeLog
@@ -1,3 +1,23 @@
+2001-09-25  Jesper Skov  <jskov@redhat.com>
+
+	* include/var_intr.h: Default CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF
+	and CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF added.
+
+	* src/var_misc.c: Use those macros.
+
+2001-09-12  Jesper Skov  <jskov@redhat.com>
+
+	* src/variant.S: Don't include C intr header.
+
+	* include/var_intr.h (CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF):
+	Provide default version.
+
+	* src/var_misc.c (hal_interrupt_update_level): Don't ignore LVL
+	interrupts.
+	* src/var_misc.c (hal_interrupt_unmask, hal_interrupt_mask): Same.
+
+	* src/var_mk_defs.c: Added some interrupt defs.
+
 2001-09-10  Jesper Skov  <jskov@redhat.com>
 
 	* src/sh3_sci.c (cyg_hal_plf_sci_isr,
--- a/packages/hal/sh/sh3/current/include/var_intr.h
+++ b/packages/hal/sh/sh3/current/include/var_intr.h
@@ -54,8 +54,27 @@
 
 #include CYGBLD_HAL_CPU_MODULES_H       // INTC module selection
 
+//--------------------------------------------------------------------------
+// Optional platform overrides and fallbacks
 #include <cyg/hal/plf_intr.h>
 
+#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_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL14:          \
+        /* Cannot change levels */                                          \
+        break;                                                           
+#endif
+
+#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 V2
 
--- a/packages/hal/sh/sh3/current/src/var_misc.c
+++ b/packages/hal/sh/sh3/current/src/var_misc.c
@@ -107,12 +107,6 @@ hal_interrupt_update_level(int vector)
     level = cyg_hal_IMASK_table[vector] ? cyg_hal_ILVL_table[vector] : 0;
 
     switch( (vector) ) {                                               
-    case CYGNUM_HAL_INTERRUPT_NMI:                                       
-        /* fall through */                                               
-    case CYGNUM_HAL_INTERRUPT_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL14:         
-        /* Cannot change levels */                                       
-        break;                                                           
-                                                                         
         /* IPRA */                                                           
     case CYGNUM_HAL_INTERRUPT_TMU0_TUNI0:                                
         HAL_READ_UINT16(CYGARC_REG_IPRA, iprX);                          
@@ -311,8 +305,10 @@ hal_interrupt_mask(int vector)
     case CYGNUM_HAL_INTERRUPT_NMI:                                        
         /* fall through */                                                
     case CYGNUM_HAL_INTERRUPT_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL14:
-        /* Can only be masked by fiddling Imask in SR. */                 
-        break;                                                            
+        /* Normally can only be masked by fiddling Imask in SR,
+           but some platforms use external interrupt controller,
+           so allow regular handling. */
+        // fall through
     case CYGNUM_HAL_INTERRUPT_TMU0_TUNI0 ... CYGNUM_HAL_ISR_MAX:            
         cyg_hal_IMASK_table[vector] = 0;
         hal_interrupt_update_level(vector);
@@ -334,8 +330,10 @@ hal_interrupt_unmask(int vector)
     case CYGNUM_HAL_INTERRUPT_NMI:                                        
         /* fall through */                                                
     case CYGNUM_HAL_INTERRUPT_LVL0 ... CYGNUM_HAL_INTERRUPT_LVL14:          
-        /* Can only be unmasked by fiddling Imask in SR. */               
-        break;                                                            
+        /* Normally can only be masked by fiddling Imask in SR,
+           but some platforms use external interrupt controller,
+           so allow regular handling. */
+        // fall through
     case CYGNUM_HAL_INTERRUPT_TMU0_TUNI0 ... CYGNUM_HAL_ISR_MAX:            
         cyg_hal_IMASK_table[vector] = 1;
         hal_interrupt_update_level(vector);
@@ -445,6 +443,8 @@ hal_interrupt_configure(int vector, int 
         HAL_WRITE_UINT16(CYGARC_REG_ICR1, icr1);                         
     }                                                                    
 #endif
+
+    CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF(vector, level, up);
 }
 
 //---------------------------------------------------------------------------
--- a/packages/hal/sh/sh3/current/src/var_mk_defs.c
+++ b/packages/hal/sh/sh3/current/src/var_mk_defs.c
@@ -78,6 +78,10 @@ main(void)
     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_RESERVED_3E0, CYGNUM_HAL_INTERRUPT_RESERVED_3E0);
+
 }
 
 //--------------------------------------------------------------------------
--- a/packages/hal/sh/sh3/current/src/variant.S
+++ b/packages/hal/sh/sh3/current/src/variant.S
@@ -46,7 +46,6 @@
 #include <cyg/hal/sh3_offsets.inc>
 
 #include <cyg/hal/arch.inc>
-#include <cyg/hal/hal_intr.h>
 
 #---------------------------------------------------------------------------
 # Cache operations
--- a/packages/hal/sh/sh4/current/ChangeLog
+++ b/packages/hal/sh/sh4/current/ChangeLog
@@ -1,3 +1,20 @@
+2001-09-25  Jesper Skov  <jskov@redhat.com>
+
+	* include/var_intr.h: Default CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF
+	and CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF added.
+
+	* src/var_misc.c: Use those macros.
+
+2001-09-24  Jesper Skov  <jskov@redhat.com>
+
+	* cdl/hal_sh_sh4.cdl: Disable cache on 7750. Doesn't work
+	properly.
+
+2001-09-12  Jesper Skov  <jskov@redhat.com>
+
+	* include/var_intr.h (CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF):
+	Provide default version.
+
 2001-08-08  Jesper Skov  <jskov@redhat.com>
 
 	* include/mod_7750.h: Don't use UBC as handling of it is broken.
--- a/packages/hal/sh/sh4/current/cdl/hal_sh_sh4.cdl
+++ b/packages/hal/sh/sh4/current/cdl/hal_sh_sh4.cdl
@@ -78,6 +78,7 @@ cdl_package CYGPKG_HAL_SH_SH4 {
         parent        CYGPKG_HAL_SH_CPU
         implements    CYGINT_HAL_SH_VARIANT
         implements    CYGINT_HAL_SH_CPG_T1
+        requires      ! CYGHWR_HAL_SH_CACHE_ENABLE
         default_value 0
         no_define
         define        -file=system.h CYGPKG_HAL_SH_7750
--- a/packages/hal/sh/sh4/current/include/var_intr.h
+++ b/packages/hal/sh/sh4/current/include/var_intr.h
@@ -61,7 +61,20 @@
 #include <cyg/hal/plf_intr.h>
 
 #ifndef CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF
-# define CYGPRI_HAL_INTERRUPT_UPDATE_LEVEL_PLF(x,y)
+# 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;                                                           
+#endif
+
+#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
 
 //--------------------------------------------------------------------------
--- a/packages/hal/sh/sh4/current/src/var_misc.c
+++ b/packages/hal/sh/sh4/current/src/var_misc.c
@@ -275,9 +275,11 @@ hal_interrupt_unmask(int vector)
 void
 hal_interrupt_acknowledge(int vector)
 {
+    CYGPRI_HAL_INTERRUPT_ACKNOWLEDGE_PLF(vector);
 }
 
 void 
 hal_interrupt_configure(int vector, int level, int up)
 {
+    CYGPRI_HAL_INTERRUPT_CONFIGURE_PLF(vector, level, up);
 }
--- a/packages/infra/current/ChangeLog
+++ b/packages/infra/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/eprintf.c (__eprintf): Tolerate absence of standard ISO C
+	functions better.
+
 2001-09-11  Jesper Skov  <jskov@redhat.com>
 
 	* src/diag.cxx (diag_check_string): Also accept \b.
--- a/packages/infra/current/src/eprintf.c
+++ b/packages/infra/current/src/eprintf.c
@@ -45,16 +45,26 @@
 // CONFIGURATION
 
 #include <pkgconf/system.h>
-/* We can't do anything without the isoinfra package */
+
 #ifdef CYGPKG_ISOINFRA 
-#include <pkgconf/isoinfra.h>   // Configuration header
+# include <pkgconf/isoinfra.h>     // Configuration header
+#endif
 
 // INCLUDES
 
 #include <cyg/infra/cyg_type.h>    // Common type definitions and support
 #include <cyg/infra/cyg_ass.h>     // Default assertion
-#include <stdio.h>
-#include <stdlib.h>
+#include <cyg/infra/diag.h>
+
+#ifdef CYGPKG_ISOINFRA
+# if defined(CYGINT_ISO_STDIO_FORMATTED_IO) || \
+     defined(CYGINT_ISO_STDIO_FILEACCESS)
+#  include <stdio.h>
+# endif
+# if CYGINT_ISO_EXIT
+#  include <stdlib.h>
+# endif
+#endif
 
 // FUNCTIONS
 
@@ -78,6 +88,4 @@
 #endif
 } // __eprintf()
 
-#endif // ifdef CYGPKG_ISOINFRA 
-
 // EOF eprintf.c
--- a/packages/io/common/current/ChangeLog
+++ b/packages/io/common/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-27  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/io_diag.c: Delete. No longer used.
+	* cdl/io.cdl: Don't build io_diag.c.
+
 2001-04-18  Jesper Skov  <jskov@redhat.com>
 	Case 105926
 	* src/io_file.c (falloc): Don't return -EMFILE, but EMFILE. Found
--- a/packages/io/common/current/cdl/io.cdl
+++ b/packages/io/common/current/cdl/io.cdl
@@ -51,7 +51,7 @@ cdl_package CYGPKG_IO {
         support which is the basis for all drivers."
 
     compile       -library=libextras.a ioinit.cxx
-    compile       iosys.c io_diag.c
+    compile       iosys.c
 
  
     cdl_option CYGDBG_IO_INIT {
deleted file mode 100644
--- a/packages/io/common/current/src/io_diag.c
+++ /dev/null
@@ -1,109 +0,0 @@
-//=============================================================================
-//
-//	io_diag.c
-//
-//	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####
-//============================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s): 	jskov
-// Contributors:jskov
-// Date:	1999-04-09
-// Purpose:     Kernel diagnostic output
-// Description:	Implementations of kernel diagnostic routines.
-//
-//####DESCRIPTIONEND####
-//
-//=============================================================================
-
-#include <pkgconf/infra.h>              // CYGDBG_INFRA_DIAG_USE_DEVICE
-
-#if defined(CYGDBG_INFRA_DIAG_USE_DEVICE)
-
-#include <pkgconf/io_serial.h>          // TTY definitions
-
-#include <cyg/infra/cyg_ass.h>
-
-#include <cyg/io/io.h>
-#include <cyg/io/io_diag.h>
-
-//#include <cyg/io/devtab.h>
-//#include <cyg/io/ttyio.h>
-
-//-----------------------------------------------------------------------------
-// Write single char to output
-
-static cyg_ucount8 sync_mode = 0;
-static cyg_io_handle_t console_handle = 0;
-static cyg_io_handle_t hal_handle = 0;
-
-externC void
-diag_device_init(void)
-{
-    Cyg_ErrNo res;
-#ifdef CYGPKG_IO_SERIAL_HALDIAG
-    res = cyg_io_lookup("/dev/haldiag", &hal_handle);
-    // FIXME: This ASSERT will try to call diag_device_write_char
-    // to print out the error string... Recursive crash...
-    CYG_ASSERT(ENOERR == res, "Can't lookup /dev/haldiag");
-#endif
-#ifdef CYGPKG_IO_SERIAL_TTY
-    res = cyg_io_lookup(CYGDAT_IO_SERIAL_TTY_CONSOLE, &console_handle);
-    // FIXME: This ASSERT will try to call diag_device_write_char
-    // to print out the error string... Recursive crash...
-    CYG_ASSERT(ENOERR == res, "Can't lookup " CYGDAT_IO_SERIAL_TTY_CONSOLE);
-#endif
-}
-
-externC void 
-diag_device_write_char(char c)
-{
-    int len = 1;
-
-    if (sync_mode)
-        cyg_io_write(hal_handle, &c, &len);
-    else
-        cyg_io_write(console_handle, &c, &len);
-}
-
-externC void 
-diag_device_start_sync()
-{
-    sync_mode = 1;
-}
-
-externC void 
-diag_device_end_sync()
-{
-    sync_mode = 0;
-}
-
-#endif // CYGDBG_INFRA_DIAG_USE_DEVICE
-
-//-----------------------------------------------------------------------------
-// End of io_diag.c
--- a/packages/io/eth/current/ChangeLog
+++ b/packages/io/eth/current/ChangeLog
@@ -1,3 +1,24 @@
+2001-09-26  Jesper Skov  <jskov@redhat.com>
+
+	* cdl/eth_drivers.cdl: Require the string functions.
+
+	* src/stand_alone/eth_drv.c: Fix warnings.
+
+2001-09-25  Hugo Tyson  <hmt@redhat.com>
+
+	* src/net/eth_drv.c (eth_drv_dsr): Assert that the "sc" given to
+	eth_drv_dsr() really is a sc from the valid list.  This can save a
+	few hours debug time of a typo.
+
+2001-09-13  Hugo Tyson  <hmt@redhat.com>
+
+	* src/net/eth_drv.c (eth_drv_tickle_devices): New function to call
+	can_send() on all devices to allow them to unstick from a lost
+	interrupt or other wedge - it's up to the device to detect this,
+	of course, can_send() does not explicitly do this, it's just used
+	as an opportunity harmlessly to get control into the device so it
+	can examine its world.
+
 2001-09-05  Gary Thomas  <gthomas@redhat.com>
 
 	* src/stand_alone/eth_drv.c (eth_drv_init): Don't initialize
--- a/packages/io/eth/current/cdl/eth_drivers.cdl
+++ b/packages/io/eth/current/cdl/eth_drivers.cdl
@@ -44,6 +44,8 @@ cdl_package CYGPKG_IO_ETH_DRIVERS {
     display       "Common ethernet support"
     include_dir   .
     parent        CYGPKG_IO
+    requires      CYGINT_ISO_STRING_MEMFUNCS 
+    requires      CYGINT_ISO_STRING_STRFUNCS
     description   "Platform independent ethernet drivers"
 
     implements    CYGPKG_NET_DRIVER_FRAMEWORK
--- a/packages/io/eth/current/src/net/eth_drv.c
+++ b/packages/io/eth/current/src/net/eth_drv.c
@@ -83,6 +83,7 @@
 #include <pkgconf/hal.h>
 #include <cyg/hal/hal_if.h>
 #include <pkgconf/io_eth_drivers.h> // module configury; SIMULATED_FAILURES
+#include <pkgconf/net.h>            // CYGPKG_NET_FAST_THREAD_TICKLE_DEVS?
 
 #include <eth_drv.h>
 #include <netdev.h>
@@ -807,6 +808,17 @@ eth_drv_dsr(cyg_vector_t vector,
 {
     struct eth_drv_sc *sc = (struct eth_drv_sc *)data;
 
+#ifdef CYGDBG_USE_ASSERTS
+    // then check that this really is a "sc"
+    {
+        cyg_netdevtab_entry_t *t;
+        for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++)
+            if ( ((struct eth_drv_sc *)t->device_instance) == sc )
+                break; // found it
+        CYG_ASSERT( t != &__NETDEVTAB_END__, "eth_drv_dsr: Failed to find sc in NETDEVTAB" );
+    }
+#endif // Checking code
+
     sc->state |= ETH_DRV_NEEDS_DELIVERY;
 
     ecos_synch_eth_drv_dsr(); // [request] run delivery function for this dev
@@ -832,6 +844,19 @@ void eth_drv_run_deliveries( void )
     }
 }
 
+// This is called from the delivery thread, to unstick devices if there is
+// no network activity.
+#ifdef CYGPKG_NET_FAST_THREAD_TICKLE_DEVS
+void eth_drv_tickle_devices( void )
+{
+    cyg_netdevtab_entry_t *t;
+    for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) {
+        struct eth_drv_sc *sc = (struct eth_drv_sc *)t->device_instance;
+        if ( ETH_DRV_STATE_ACTIVE & sc->state )
+            (*sc->funs->can_send)(sc);
+    }
+}
+#endif // CYGPKG_NET_FAST_THREAD_TICKLE_DEVS
 
 // ------------------------------------------------------------------------
 
--- a/packages/io/eth/current/src/stand_alone/eth_drv.c
+++ b/packages/io/eth/current/src/stand_alone/eth_drv.c
@@ -53,6 +53,7 @@
 #include <cyg/hal/hal_if.h>
 #include <eth_drv.h>
 #include <netdev.h>
+#include <string.h>
 
 // High-level ethernet driver
 
@@ -250,8 +251,8 @@ eth_drv_write(char *eth_hdr, char *buf, 
         int old_console;
         old_console = start_console();
         diag_printf("Ethernet send:\n");
-        diag_dump_buf((CYG_ADDRWORD)eth_hdr, 14);
-        diag_dump_buf((CYG_ADDRWORD)buf, len);
+        diag_dump_buf(eth_hdr, 14);
+        diag_dump_buf(buf, len);
         end_console(old_console);
     }
 #endif
@@ -423,8 +424,8 @@ eth_drv_recv(struct eth_drv_sc *sc, int 
         int old_console;
         old_console = start_console();
         diag_printf("Ethernet recv:\n");
-        diag_dump_buf((CYG_ADDRWORD)buf, 14);
-        diag_dump_buf((CYG_ADDRWORD)buf+14, total_len-14);
+        diag_dump_buf(buf, 14);
+        diag_dump_buf(buf+14, total_len-14);
         end_console(old_console);
     }
 #endif
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-25  Gary Thomas  <gthomas@redhat.com>
+
+	* include/flash.h: Remove warning on printf() prototype.
+
 2001-08-10  Jesper Skov  <jskov@redhat.com>
 
 	* cdl/io_flash.cdl: Changed flavor of
--- a/packages/io/flash/current/include/flash.h
+++ b/packages/io/flash/current/include/flash.h
@@ -47,7 +47,7 @@
 #include <pkgconf/io_flash.h>
 #include <cyg/hal/hal_cache.h>
 
-typedef int _printf(char* fmt, ...);
+typedef int _printf(const char *fmt, ...);
 
 #define FLASH_MIN_WORKSPACE CYGNUM_FLASH_WORKSPACE_SIZE  // Space used by FLASH code
 
--- a/packages/io/pci/current/ChangeLog
+++ b/packages/io/pci/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-28  Gary Thomas  <gthomas@redhat.com>
+
+	* src/pci.c (cyg_pci_find_next): 
+	* include/pci.h: Allow platforms to restrict PCI bus/device ranges.
+
 2001-08-22  Gary Thomas  <gthomas@redhat.com>
 
 	* src/pci.c: 
--- a/packages/io/pci/current/include/pci.h
+++ b/packages/io/pci/current/include/pci.h
@@ -328,10 +328,22 @@ externC cyg_bool cyg_pci_allocate_io_pri
 
 //----------------------------------------------------------------------
 // Bus probing limits.
+// Note: these can be overridden by the platform
+#ifndef CYG_PCI_MAX_BUS
 #define CYG_PCI_MAX_BUS                      8  // Eight is enough?
+#endif
+#ifndef CYG_PCI_MAX_DEV
 #define CYG_PCI_MAX_DEV                      32
+#endif
+#ifndef CYG_PCI_MIN_DEV
+#define CYG_PCI_MIN_DEV                      0
+#endif
+#ifndef CYG_PCI_MAX_FN
 #define CYG_PCI_MAX_FN                       8
+#endif
+#ifndef CYG_PCI_MAX_BAR
 #define CYG_PCI_MAX_BAR                      6
+#endif
 
 //-----------------------------------------------------------------------------
 #endif // ifndef CYGONCE_PCI_H
--- a/packages/io/pci/current/src/pci.c
+++ b/packages/io/pci/current/src/pci.c
@@ -422,8 +422,10 @@ cyg_pci_find_next( cyg_pci_device_id cur
     // If this is the initializer, start with 0/0/0
     if (CYG_PCI_NULL_DEVID == cur_devid) {
         bus = dev = fn = 0;
+        dev = CYG_PCI_MIN_DEV;
     } else if (CYG_PCI_NULL_DEVFN == (cur_devid & CYG_PCI_NULL_DEVFN)) {
         dev = fn = 0;
+        dev = CYG_PCI_MIN_DEV;
     } else {
         // Otherwise, check multi-function bit of device's first function
         cyg_uint8 header;
@@ -446,7 +448,7 @@ cyg_pci_find_next( cyg_pci_device_id cur
 
     // Note: Reset iterators in enclosing statement's "next" part.
     //       Allows resuming scan with given input values. 
-    for (;bus < CYG_PCI_MAX_BUS; bus++, dev=0) {
+    for (;bus < CYG_PCI_MAX_BUS; bus++, dev=CYG_PCI_MIN_DEV) {
         for (;dev < CYG_PCI_MAX_DEV; dev++, fn=0) {
             for (;fn < CYG_PCI_MAX_FN; fn++) {
                 cyg_uint16 vendor;
--- a/packages/io/usb/slave/current/ChangeLog
+++ b/packages/io/usb/slave/current/ChangeLog
@@ -1,3 +1,16 @@
+2001-09-14  Bart Veer  <bartv@redhat.com>
+
+	* doc/usbs.sgml, doc/*.html:
+	Fix the example strings in the enumeration data.
+	Regenerate html.
+
+	* include/usbs.h:
+	Update the USB testing data structure	
+
+	* src/usbs.c (usbs_handle_standard_control):
+	Fix an assertion for the special case of a USB configuration that
+	defines no endpoints.
+
 2001-08-06  Bart Veer  <bartv@redhat.com>
 
 	* include/usbs.h:
--- a/packages/io/usb/slave/current/doc/io-usb-slave.html
+++ b/packages/io/usb/slave/current/doc/io-usb-slave.html
@@ -2,179 +2,182 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-eCos USB Slave Support</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>eCos USB Slave Support</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="NEXT"
 TITLE="Introduction"
-HREF="usbs-intro.html"></HEAD>
-<BODY
+HREF="usbs-intro.html"></HEAD
+><BODY
 CLASS="REFERENCE"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-&nbsp;</TD>
-<TD
+VALIGN="bottom"
+>&nbsp;</TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-intro.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-intro.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<DIV
-CLASS="REFERENCE">
-<A
-NAME="IO-USB-SLAVE">
-</A>
-<DIV
-CLASS="TITLEPAGE">
-<H1
-CLASS="TITLE">
-I. eCos USB Slave Support</H1>
-<DIV
-CLASS="TOC">
-<DL>
-<DT>
-<B>
-Table of Contents</B>
-</DT>
-<DT>
-<A
-HREF="usbs-intro.html">
-Introduction</A>
- &#8212; eCos support for USB slave devices</DT>
-<DT>
-<A
-HREF="usbs-enum.html">
-USB Enumeration Data</A>
- &#8212; The USB enumeration data structures</DT>
-<DT>
-<A
-HREF="usbs-start.html">
-Starting up a USB Device</A>
- &#8212; Starting up a USB Device</DT>
-<DT>
-<A
-HREF="usbs-devtab.html">
-Devtab Entries</A>
- &#8212; Data endpoint data structure</DT>
-<DT>
-<A
-HREF="usbs-start-rx.html">
-Receiving Data from the Host</A>
- &#8212; Receiving Data from the Host</DT>
-<DT>
-<A
-HREF="usbs-start-tx.html">
-Sending Data to the Host</A>
- &#8212; Sending Data to the Host</DT>
-<DT>
-<A
-HREF="usbs-halt.html">
-Halted Endpoints</A>
- &#8212; Support for Halting and Halted Endpoints</DT>
-<DT>
-<A
-HREF="usbs-control.html">
-Control Endpoints</A>
- &#8212; Control endpoint data structure</DT>
-<DT>
-<A
-HREF="usbs-data.html">
-Data Endpoints</A>
- &#8212; Data endpoint data structures</DT>
-<DT>
-<A
-HREF="usbs-writing.html">
-Writing a USB Device Driver</A>
- &#8212; USB Device Driver Porting Guide</DT>
-</DL>
-</DIV>
-</DIV>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+WIDTH="100%"></DIV
+><DIV
+CLASS="REFERENCE"
+><A
+NAME="IO-USB-SLAVE"
+></A
+><DIV
+CLASS="TITLEPAGE"
+><H1
+CLASS="TITLE"
+>I. eCos USB Slave Support</H1
+><DIV
+CLASS="TOC"
+><DL
+><DT
+><B
+>Table of Contents</B
+></DT
+><DT
+><A
+HREF="usbs-intro.html"
+>Introduction</A
+> &#8212; eCos support for USB slave devices</DT
+><DT
+><A
+HREF="usbs-enum.html"
+>USB Enumeration Data</A
+> &#8212; The USB enumeration data structures</DT
+><DT
+><A
+HREF="usbs-start.html"
+>Starting up a USB Device</A
+> &#8212; Starting up a USB Device</DT
+><DT
+><A
+HREF="usbs-devtab.html"
+>Devtab Entries</A
+> &#8212; Data endpoint data structure</DT
+><DT
+><A
+HREF="usbs-start-rx.html"
+>Receiving Data from the Host</A
+> &#8212; Receiving Data from the Host</DT
+><DT
+><A
+HREF="usbs-start-tx.html"
+>Sending Data to the Host</A
+> &#8212; Sending Data to the Host</DT
+><DT
+><A
+HREF="usbs-halt.html"
+>Halted Endpoints</A
+> &#8212; Support for Halting and Halted Endpoints</DT
+><DT
+><A
+HREF="usbs-control.html"
+>Control Endpoints</A
+> &#8212; Control endpoint data structure</DT
+><DT
+><A
+HREF="usbs-data.html"
+>Data Endpoints</A
+> &#8212; Data endpoint data structures</DT
+><DT
+><A
+HREF="usbs-writing.html"
+>Writing a USB Device Driver</A
+> &#8212; USB Device Driver Porting Guide</DT
+></DL
+></DIV
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-intro.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-intro.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Introduction</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Introduction</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-control.html
+++ b/packages/io/usb/slave/current/doc/usbs-control.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Control Endpoints</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Control Endpoints</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,107 +26,107 @@ TITLE="Halted Endpoints"
 HREF="usbs-halt.html"><LINK
 REL="NEXT"
 TITLE="Data Endpoints"
-HREF="usbs-data.html"></HEAD>
-<BODY
+HREF="usbs-data.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-halt.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-halt.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-data.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-data.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-CONTROL">
-Control Endpoints</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN489">
-</A>
-<H2>
-Name</H2>
-Control Endpoints&nbsp;--&nbsp;Control endpoint data structure</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN492">
-</A>
-<H2>
-Synopsis</H2>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-CONTROL"
+>Control Endpoints</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN489"
+></A
+><H2
+>Name</H2
+>Control Endpoints&nbsp;--&nbsp;Control endpoint data structure</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN492"
+></A
+><H2
+>Synopsis</H2
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="SYNOPSIS">
-#include &lt;cyg/io/usb/usbs.h&gt;
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="SYNOPSIS"
+>#include &lt;cyg/io/usb/usbs.h&gt;
 
 typedef struct usbs_control_endpoint {
     *hellip;
-} usbs_control_endpoint;</PRE>
-</TD>
-</TR>
-</TABLE>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN494">
-</A>
-<H2>
-<TT
-CLASS="LITERAL">
-usbs_control_endpoint</TT>
- Data Structure</H2>
-<P>
-The device driver for a USB slave device should supply one
+} usbs_control_endpoint;</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN494"
+></A
+><H2
+><TT
+CLASS="LITERAL"
+>usbs_control_endpoint</TT
+> Data Structure</H2
+><P
+>The device driver for a USB slave device should supply one
 <SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
- data structure per USB
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+> data structure per USB
 device. This corresponds to endpoint 0 which will be used for all
 control message interaction between the host and that device. The data
 structure is also used for internal management purposes, for example
@@ -135,11 +137,11 @@ connected to multiple hosts, then there 
 structure for each one. The name or names of the data structures are
 determined by the device drivers. For example, the SA11x0 USB device
 driver package provides <TT
-CLASS="LITERAL">
-usbs_sa11x0_ep0</TT>
-.</P>
-<P>
-The operations on a control endpoint do not fit cleanly into a
+CLASS="LITERAL"
+>usbs_sa11x0_ep0</TT
+>.</P
+><P
+>The operations on a control endpoint do not fit cleanly into a
 conventional open/read/write I/O model. For example, when the host
 sends a control message to the USB peripheral this may be one of four
 types: standard, class, vendor and reserved. Some or all of the
@@ -149,19 +151,19 @@ control messages and the other types of 
 handled by a class-specific package or by application code. Although
 it would be possible to have devtab entries such as
 <TT
-CLASS="LITERAL">
-/dev/usbs_ep0/standard</TT>
- and
+CLASS="LITERAL"
+>/dev/usbs_ep0/standard</TT
+> and
 <TT
-CLASS="LITERAL">
-/dev/usbs_ep0/class</TT>
-, and then support read and
+CLASS="LITERAL"
+>/dev/usbs_ep0/class</TT
+>, and then support read and
 write operations on these devtab entries, this would add significant
 overhead and code complexity. Instead, all of the fields in the
 control endpoint data structure are public and can be manipulated
-directly by higher level code if and when required. </P>
-<P>
-Control endpoints involve a number of callback functions, with
+directly by higher level code if and when required. </P
+><P
+>Control endpoints involve a number of callback functions, with
 higher-level code installing suitable function pointers in the control
 endpoint data structure. For example, if the peripheral involves
 vendor-specific control messages then a suitable handler for these
@@ -175,97 +177,97 @@ callback then the resulting behaviour is
 a whole may fail. In addition, if one of the callback functions
 involves significant processing effort then this may adversely affect
 the system's real time characteristics. The eCos kernel documentation
-should be consulted for more details of DSR handling.</P>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN504">
-</A>
-<H3>
-Initialization</H3>
-<P>
-The <SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
- data structure
-contains the following fields related to initialization.</P>
-<TABLE
+should be consulted for more details of DSR handling.</P
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN504"
+></A
+><H3
+>Initialization</H3
+><P
+>The <SPAN
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+> data structure
+contains the following fields related to initialization.</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-typedef struct usbs_control_endpoint {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>typedef struct usbs_control_endpoint {
     &#8230;
     const usbs_enumeration_data* enumeration_data;
     void                         (*start_fn)(usbs_control_endpoint*);
     &#8230;
-};</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-It is the responsibility of higher-level code, usually the
+};</PRE
+></TD
+></TR
+></TABLE
+><P
+>It is the responsibility of higher-level code, usually the
 application, to define the USB enumeration data. This needs to be
 installed in the control endpoint data structure early on during
 system startup, before the USB device is actually started and any
 interaction with the host is possible. Details of the enumeration data
 are supplied in the section <A
-HREF="usbs-enum.html">
-USB Enumeration
-Data</A>
-. Typically, the enumeration data is constant for a given
+HREF="usbs-enum.html"
+>USB Enumeration
+Data</A
+>. Typically, the enumeration data is constant for a given
 peripheral, although it can be constructed dynamically if necessary.
 However, the enumeration data cannot change while the peripheral is
 connected to a host: the peripheral cannot easily claim to be a
-keyboard one second and a printer the next.</P>
-<P>
-The <TT
-CLASS="STRUCTFIELD">
-<I>
-start_fn</I>
-</TT>
- member is normally accessed
+keyboard one second and a printer the next.</P
+><P
+>The <TT
+CLASS="STRUCTFIELD"
+><I
+>start_fn</I
+></TT
+> member is normally accessed
 via the utility <A
-HREF="usbs-start.html">
-<TT
-CLASS="FUNCTION">
-usbs_start</TT>
-</A>
- rather
+HREF="usbs-start.html"
+><TT
+CLASS="FUNCTION"
+>usbs_start</TT
+></A
+> rather
 than directly. It is provided by the device driver and should be
 invoked once the system is fully initialized and interaction with the
 host is possible. A typical implementation would change the USB data
 pins from tristated to active. If the peripheral is already plugged
 into a host then the latter should detect this change and start
 interacting with the peripheral, including requesting the enumeration
-data.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN515">
-</A>
-<H3>
-State</H3>
-<P>
-There are three <SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
- fields
+data.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN515"
+></A
+><H3
+>State</H3
+><P
+>There are three <SPAN
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+> fields
 related to the current state of a USB slave device, plus some state
-constants and an enumeration of the possible state changes:</P>
-<TABLE
+constants and an enumeration of the possible state changes:</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-typedef struct usbs_control_endpoint {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>typedef struct usbs_control_endpoint {
     &#8230;
     int     state;
     void    (*state_change_fn)(struct usbs_control_endpoint*, void*,
@@ -293,96 +295,96 @@ typedef enum {
     USBS_STATE_CHANGE_DECONFIGURED      = 7,    
     USBS_STATE_CHANGE_SUSPENDED         = 8,
     USBS_STATE_CHANGE_RESUMED           = 9
-} usbs_state_change;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-The USB standard defines a number of states for a given USB
+} usbs_state_change;</PRE
+></TD
+></TR
+></TABLE
+><P
+>The USB standard defines a number of states for a given USB
 peripheral. The initial state is <I
-CLASS="EMPHASIS">
-detached</I>
-, where
+CLASS="EMPHASIS"
+>detached</I
+>, where
 the peripheral is either not connected to a host at all or, from the
 host's perspective, the peripheral has not started up yet because the
 relevant pins are tristated. The peripheral then moves via
 intermediate <I
-CLASS="EMPHASIS">
-attached</I>
- and
+CLASS="EMPHASIS"
+>attached</I
+> and
 <I
-CLASS="EMPHASIS">
-powered</I>
- states to its default or
+CLASS="EMPHASIS"
+>powered</I
+> states to its default or
 <I
-CLASS="EMPHASIS">
-reset</I>
- state, at which point the host and
+CLASS="EMPHASIS"
+>reset</I
+> state, at which point the host and
 peripheral can actually start exchanging data. The first message is
 from host to peripheral and provides a unique 7-bit address within the
 local USB network, resulting in a state change to
 <I
-CLASS="EMPHASIS">
-addressed</I>
-. The host then requests enumeration
+CLASS="EMPHASIS"
+>addressed</I
+>. The host then requests enumeration
 data and performs other initialization. If everything succeeds the
 host sends a standard set-configuration control message, after which
 the peripheral is <I
-CLASS="EMPHASIS">
-configured</I>
- and expected to be
+CLASS="EMPHASIS"
+>configured</I
+> and expected to be
 up and running. Note that some USB device drivers may be unable to
 distinguish between the <I
-CLASS="EMPHASIS">
-detached</I>
-,
+CLASS="EMPHASIS"
+>detached</I
+>,
 <I
-CLASS="EMPHASIS">
-attached</I>
- and <I
-CLASS="EMPHASIS">
-powered</I>
- states
-but generally this is not important to higher-level code.</P>
-<P>
-A USB host should generate at least one token every millisecond. If a
+CLASS="EMPHASIS"
+>attached</I
+> and <I
+CLASS="EMPHASIS"
+>powered</I
+> states
+but generally this is not important to higher-level code.</P
+><P
+>A USB host should generate at least one token every millisecond. If a
 peripheral fails to detect any USB traffic for a period of time then
 typically this indicates that the host has entered a power-saving
 mode, and the peripheral should do the same if possible. This
 corresponds to the <I
-CLASS="EMPHASIS">
-suspended</I>
- bit. The actual
+CLASS="EMPHASIS"
+>suspended</I
+> bit. The actual
 state is a combination of <I
-CLASS="EMPHASIS">
-suspended</I>
- and the
+CLASS="EMPHASIS"
+>suspended</I
+> and the
 previous state, for example <I
-CLASS="EMPHASIS">
-configured</I>
- and
+CLASS="EMPHASIS"
+>configured</I
+> and
 <I
-CLASS="EMPHASIS">
-suspended</I>
- rather than just
+CLASS="EMPHASIS"
+>suspended</I
+> rather than just
 <I
-CLASS="EMPHASIS">
-suspended</I>
-. When the peripheral subsequently
+CLASS="EMPHASIS"
+>suspended</I
+>. When the peripheral subsequently
 detects USB traffic it would switch back to the
 <I
-CLASS="EMPHASIS">
-configured</I>
- state.</P>
-<P>
-The USB device driver and the common USB slave package will maintain
+CLASS="EMPHASIS"
+>configured</I
+> state.</P
+><P
+>The USB device driver and the common USB slave package will maintain
 the current state in the control endpoint's
 <TT
-CLASS="STRUCTFIELD">
-<I>
-state</I>
-</TT>
- field. There should be no need for
+CLASS="STRUCTFIELD"
+><I
+>state</I
+></TT
+> field. There should be no need for
 any other code to change this field, but it can be examined whenever
 appropriate. In addition whenever a state change occurs the generic
 code can invoke a state change callback function. By default, no such
@@ -394,58 +396,58 @@ also update this field. If multiple part
 state changes, for example both a class-specific package and
 application code, then typically the application code will install its
 state change handler after the class-specific package and is
-responsible for chaining into the package's handler.</P>
-<P>
-The state change callback function is invoked with four arguments. The
+responsible for chaining into the package's handler.</P
+><P
+>The state change callback function is invoked with four arguments. The
 first identifies the control endpoint. The second is an arbitrary
 pointer: higher-level code can fill in the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-state_change_data</I>
-</TT>
- field to set this. The
+CLASS="STRUCTFIELD"
+><I
+>state_change_data</I
+></TT
+> field to set this. The
 third argument specifies the state change that has occurred, and the
 last argument supplies the previous state (the new state is readily
-available from the control endpoint structure).</P>
-<P>
-eCos does not provide any utility functions for updating or examining
+available from the control endpoint structure).</P
+><P
+>eCos does not provide any utility functions for updating or examining
 the <TT
-CLASS="STRUCTFIELD">
-<I>
-state_change_fn</I>
-</TT>
- or
+CLASS="STRUCTFIELD"
+><I
+>state_change_fn</I
+></TT
+> or
 <TT
-CLASS="STRUCTFIELD">
-<I>
-state_change_data</I>
-</TT>
- fields. Instead, it is
+CLASS="STRUCTFIELD"
+><I
+>state_change_data</I
+></TT
+> fields. Instead, it is
 expected that the fields in the
 <SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
- data structure will be
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+> data structure will be
 manipulated directly. Any utility functions would do just this, but
-at the cost of increased code and cpu overheads.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN545">
-</A>
-<H3>
-Standard Control Messages</H3>
-<TABLE
+at the cost of increased code and cpu overheads.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN545"
+></A
+><H3
+>Standard Control Messages</H3
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-typedef struct usbs_control_endpoint {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>typedef struct usbs_control_endpoint {
     &#8230;
     unsigned char       control_buffer[8];
     usbs_control_return (*standard_control_fn)(struct usbs_control_endpoint*, void*);
@@ -459,96 +461,96 @@ typedef enum {
     USBS_CONTROL_RETURN_STALL   = 2
 } usbs_control_return;
 
-extern usbs_control_return usbs_handle_standard_control(struct usbs_control_endpoint*);</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-When a USB peripheral is connected to the host it must always respond
+extern usbs_control_return usbs_handle_standard_control(struct usbs_control_endpoint*);</PRE
+></TD
+></TR
+></TABLE
+><P
+>When a USB peripheral is connected to the host it must always respond
 to control messages sent to endpoint 0. Control messages always
 consist of an initial eight-byte header, containing fields such as a
 request type. This may be followed by a further data transfer, either
 from host to peripheral or from peripheral to host. The way this is
 handled is described in the <A
-HREF="usbs-control.html#AEN578">
-Buffer Management</A>
- section below.</P>
-<P>
-The USB device driver will always accept the initial eight-byte
+HREF="usbs-control.html#AEN578"
+>Buffer Management</A
+> section below.</P
+><P
+>The USB device driver will always accept the initial eight-byte
 header, storing it in the <TT
-CLASS="STRUCTFIELD">
-<I>
-control_buffer</I>
-</TT>
-
+CLASS="STRUCTFIELD"
+><I
+>control_buffer</I
+></TT
+>
 field. Then it determines the request type: standard, class, vendor,
 or reserved. The way in which the last three of these are processed is
 described in the section <A
-HREF="usbs-control.html#AEN570">
-Other
-Control Messages</A>
-. Some
+HREF="usbs-control.html#AEN570"
+>Other
+Control Messages</A
+>. Some
 standard control messages will be handled by the device driver itself;
 typically the <I
-CLASS="EMPHASIS">
-set-address</I>
- request and the
+CLASS="EMPHASIS"
+>set-address</I
+> request and the
 <I
-CLASS="EMPHASIS">
-get-status</I>
-, <I
-CLASS="EMPHASIS">
-set-feature</I>
- and
+CLASS="EMPHASIS"
+>get-status</I
+>, <I
+CLASS="EMPHASIS"
+>set-feature</I
+> and
 <I
-CLASS="EMPHASIS">
-clear-feature</I>
- requests when applied to endpoints.</P>
-<P>
-If a standard control message cannot be handled by the device driver
+CLASS="EMPHASIS"
+>clear-feature</I
+> requests when applied to endpoints.</P
+><P
+>If a standard control message cannot be handled by the device driver
 itself, the driver checks the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-standard_control_fn</I>
-</TT>
- field in the control
+CLASS="STRUCTFIELD"
+><I
+>standard_control_fn</I
+></TT
+> field in the control
 endpoint data structure. If higher-level code has installed a suitable
 callback function then this will be invoked with two argument, the
 control endpoint data structure itself and the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-standard_control_data</I>
-</TT>
- field. The latter
+CLASS="STRUCTFIELD"
+><I
+>standard_control_data</I
+></TT
+> field. The latter
 allows the higher level code to associate arbitrary data with the
 control endpoint. The callback function can return one of three
 values: <I
-CLASS="EMPHASIS">
-HANDLED</I>
- to indicate that the request has
+CLASS="EMPHASIS"
+>HANDLED</I
+> to indicate that the request has
 been processed; <I
-CLASS="EMPHASIS">
-UNKNOWN</I>
- if the message should be
+CLASS="EMPHASIS"
+>UNKNOWN</I
+> if the message should be
 handled by the default code; or <I
-CLASS="EMPHASIS">
-STALL</I>
- to indicate
+CLASS="EMPHASIS"
+>STALL</I
+> to indicate
 an error condition. If higher level code has not installed a callback
 function or if the callback function has returned
 <I
-CLASS="EMPHASIS">
-UNKNOWN</I>
- then the device driver will invoke a
+CLASS="EMPHASIS"
+>UNKNOWN</I
+> then the device driver will invoke a
 default handler, <TT
-CLASS="FUNCTION">
-usbs_handle_standard_control</TT>
-
-provided by the common USB slave package.</P>
-<P>
-The default handler can cope with all of the standard control messages
+CLASS="FUNCTION"
+>usbs_handle_standard_control</TT
+>
+provided by the common USB slave package.</P
+><P
+>The default handler can cope with all of the standard control messages
 for a simple USB peripheral. However, if the peripheral involves
 multiple configurations, multiple interfaces in a configuration, or
 alternate settings for an interface, then this cannot be handled by
@@ -560,43 +562,43 @@ when the host changes the current settin
 rate at which data is fed to or retrieved from the host. Therefore the
 higher-level code needs to install its own standard control callback
 and process appropriate messages, rather than leaving these to the
-default handler.</P>
-<P>
-The default handler will take care of the
+default handler.</P
+><P
+>The default handler will take care of the
 <I
-CLASS="EMPHASIS">
-get-descriptor</I>
- request used to obtain the
+CLASS="EMPHASIS"
+>get-descriptor</I
+> request used to obtain the
 enumeration data. It has support for string descriptors but ignores
 language encoding issues. If language encoding is important for the
 peripheral then this will have to be handled by an
-application-specific standard control handler.</P>
-<P>
-The header file <TT
-CLASS="FILENAME">
-&lt;cyg/io/usb/usb.h&gt;</TT>
- defines various
+application-specific standard control handler.</P
+><P
+>The header file <TT
+CLASS="FILENAME"
+>&lt;cyg/io/usb/usb.h&gt;</TT
+> defines various
 constants related to control messages, for example the function codes
 corresponding to the standard request types. This header file is
 provided by the common USB package, not by the USB slave package,
-since the information is also relevant to USB hosts.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN570">
-</A>
-<H3>
-Other Control Messages</H3>
-<TABLE
+since the information is also relevant to USB hosts.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN570"
+></A
+><H3
+>Other Control Messages</H3
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-typedef struct usbs_control_endpoint {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>typedef struct usbs_control_endpoint {
     &#8230;
     usbs_control_return (*class_control_fn)(struct usbs_control_endpoint*, void*);
     void*               class_control_data;
@@ -605,55 +607,55 @@ typedef struct usbs_control_endpoint {
     usbs_control_return (*reserved_control_fn)(struct usbs_control_endpoint*, void*);
     void*               reserved_control_data;
     &#8230;
-} usbs_control_endpoint;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-Non-standard control messages always have to be processed by
+} usbs_control_endpoint;</PRE
+></TD
+></TR
+></TABLE
+><P
+>Non-standard control messages always have to be processed by
 higher-level code. This could be class-specific packages. For example,
 the USB-ethernet package will handle requests for getting the MAC
 address and for enabling or disabling promiscuous mode. In all cases
 the device driver will store the initial request in the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-control_buffer</I>
-</TT>
- field, check for an
+CLASS="STRUCTFIELD"
+><I
+>control_buffer</I
+></TT
+> field, check for an
 appropriate handler, and invoke it with details of the control
 endpoint and any handler-specific data that has been installed
 alongside the handler itself. The handler should return either
 <TT
-CLASS="LITERAL">
-USBS_CONTROL_RETURN_HANDLED</TT>
- to report success or
+CLASS="LITERAL"
+>USBS_CONTROL_RETURN_HANDLED</TT
+> to report success or
 <TT
-CLASS="LITERAL">
-USBS_CONTROL_RETURN_STALL</TT>
- to report failure. The
-device driver will report this to the host.</P>
-<P>
-If there are multiple parties interested in a particular type of
+CLASS="LITERAL"
+>USBS_CONTROL_RETURN_STALL</TT
+> to report failure. The
+device driver will report this to the host.</P
+><P
+>If there are multiple parties interested in a particular type of
 control messages, it is the responsibility of application code to
-install an appropriate handler and process the requests appropriately. </P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN578">
-</A>
-<H3>
-Buffer Management</H3>
-<TABLE
+install an appropriate handler and process the requests appropriately. </P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN578"
+></A
+><H3
+>Buffer Management</H3
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-typedef struct usbs_control_endpoint {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>typedef struct usbs_control_endpoint {
     &#8230;
     unsigned char*      buffer;
     int                 buffer_size;
@@ -662,35 +664,35 @@ typedef struct usbs_control_endpoint {
     int                 fill_index;
     usbs_control_return (*complete_fn)(struct usbs_control_endpoint*, int);
     &#8230;
-} usbs_control_endpoint;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-Many USB control messages involve transferring more data than just the
+} usbs_control_endpoint;</PRE
+></TD
+></TR
+></TABLE
+><P
+>Many USB control messages involve transferring more data than just the
 initial eight-byte header. The header indicates the direction of the
 transfer, OUT for host to peripheral or IN for peripheral to host.
 It also specifies a length field, which is exact for an OUT transfer
 or an upper bound for an IN transfer. Control message handlers can
 manipulate six fields within the control endpoint data structure to
-ensure that the transfer happens correctly.</P>
-<P>
-For an OUT transfer, the handler should examine the length field in
+ensure that the transfer happens correctly.</P
+><P
+>For an OUT transfer, the handler should examine the length field in
 the header and provide a single buffer for all the data. A
 class-specific protocol would typically impose an upper bound on the
 amount of data, allowing the buffer to be allocated statically.
 The handler should update the <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_fn</I>
-</TT>
- fields. When all the data has
+CLASS="STRUCTFIELD"
+><I
+>complete_fn</I
+></TT
+> fields. When all the data has
 been transferred the completion callback will be invoked, and its
 return value determines the response sent back to the host. The USB
 standard allows for a new control message to be sent before the
@@ -699,233 +701,234 @@ operation. When this happens the complet
 invoked. The second argument to the completion function specifies what
 has happened, with a value of 0 indicating success and an error code
 such as <TT
-CLASS="LITERAL">
--EPIPE</TT>
- or <TT
-CLASS="LITERAL">
--EIO</TT>
-
-indicating that the current transfer has been cancelled.</P>
-<P>
-IN transfers are a little bit more complicated. The required
+CLASS="LITERAL"
+>-EPIPE</TT
+> or <TT
+CLASS="LITERAL"
+>-EIO</TT
+>
+indicating that the current transfer has been cancelled.</P
+><P
+>IN transfers are a little bit more complicated. The required
 information, for example the enumeration data, may not be in a single
 contiguous buffer. Instead a mechanism is provided by which the buffer
 can be refilled, thus allowing the transfer to move from one record to
-the next. Essentially, the transfer operates as follows:</P>
-<P>
-</P>
-<OL
-TYPE="1">
-<LI>
-<P>
-When the host requests another chunk of data (typically eight bytes),
+the next. Essentially, the transfer operates as follows:</P
+><P
+></P
+><OL
+TYPE="1"
+><LI
+><P
+>When the host requests another chunk of data (typically eight bytes),
 the USB device driver will examine the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- field. If non-zero then
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> field. If non-zero then
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
- contains at least one more byte of
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+> contains at least one more byte of
 data, and then <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- is decremented.</P>
-</LI>
-<LI>
-<P>
-When <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- has dropped to 0, the
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> is decremented.</P
+></LI
+><LI
+><P
+>When <TT
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> has dropped to 0, the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-fill_buffer_fn</I>
-</TT>
- field will be examined. If
-non-null it will be invoked to refill the buffer.</P>
-</LI>
-<LI>
-<P>
-The <TT
-CLASS="STRUCTFIELD">
-<I>
-fill_data</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>fill_buffer_fn</I
+></TT
+> field will be examined. If
+non-null it will be invoked to refill the buffer.</P
+></LI
+><LI
+><P
+>The <TT
+CLASS="STRUCTFIELD"
+><I
+>fill_data</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-fill_index</I>
-</TT>
- fields are not used by the
+CLASS="STRUCTFIELD"
+><I
+>fill_index</I
+></TT
+> fields are not used by the
 device driver. Instead these fields are available to the refill
-function to keep track of the current state of the transfer.</P>
-</LI>
-<LI>
-<P>
-When <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- is 0 and
+function to keep track of the current state of the transfer.</P
+></LI
+><LI
+><P
+>When <TT
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> is 0 and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-fill_buffer_fn</I>
-</TT>
- is NULL, no more data is
-available and the transfer has completed.</P>
-</LI>
-<LI>
-<P>
-Optionally a completion function can be installed. This will be
+CLASS="STRUCTFIELD"
+><I
+>fill_buffer_fn</I
+></TT
+> is NULL, no more data is
+available and the transfer has completed.</P
+></LI
+><LI
+><P
+>Optionally a completion function can be installed. This will be
 invoked with 0 if the transfer completes successfully, or with an
 error code if the transfer is cancelled because of another control
-messsage. </P>
-</LI>
-</OL>
-<P>
-If the requested data is contiguous then the only fields that need
+messsage. </P
+></LI
+></OL
+><P
+>If the requested data is contiguous then the only fields that need
 to be manipulated are <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
-, and optionally
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+>, and optionally
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_fn</I>
-</TT>
-. If the requested data is not
+CLASS="STRUCTFIELD"
+><I
+>complete_fn</I
+></TT
+>. If the requested data is not
 contiguous then the initial control message handler should update
 <TT
-CLASS="STRUCTFIELD">
-<I>
-fill_buffer_fn</I>
-</TT>
- and some or all of the other
+CLASS="STRUCTFIELD"
+><I
+>fill_buffer_fn</I
+></TT
+> and some or all of the other
 fields, as required. An example of this is the handling of the
 standard <I
-CLASS="EMPHASIS">
-get-descriptor</I>
- control message by
+CLASS="EMPHASIS"
+>get-descriptor</I
+> control message by
 <TT
-CLASS="FUNCTION">
-usbs_handle_standard_control</TT>
-.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN615">
-</A>
-<H3>
-Polling Support</H3>
-<TABLE
+CLASS="FUNCTION"
+>usbs_handle_standard_control</TT
+>.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN615"
+></A
+><H3
+>Polling Support</H3
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-typedef struct usbs_control_endpoint {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>typedef struct usbs_control_endpoint {
     void                (*poll_fn)(struct usbs_control_endpoint*);
     int                 interrupt_vector;
     &#8230;
-} usbs_control_endpoint;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-In nearly all circumstances USB I/O should be interrupt-driven.
+} usbs_control_endpoint;</PRE
+></TD
+></TR
+></TABLE
+><P
+>In nearly all circumstances USB I/O should be interrupt-driven.
 However, there are special environments such as RedBoot where polled
 operation may be appropriate. If the device driver can operate in
 polled mode then it will provide a suitable function via the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-poll_fn</I>
-</TT>
- field, and higher-level code can
+CLASS="STRUCTFIELD"
+><I
+>poll_fn</I
+></TT
+> field, and higher-level code can
 invoke this regularly. This polling function will take care of all
 endpoints associated with the device, not just the control endpoint.
 If the USB hardware involves a single interrupt vector then this will
-be identified in the data structure as well.</P>
-</DIV>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+be identified in the data structure as well.</P
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-halt.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-halt.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-data.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-data.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Halted Endpoints</TD>
-<TD
+VALIGN="top"
+>Halted Endpoints</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Data Endpoints</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Data Endpoints</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-data.html
+++ b/packages/io/usb/slave/current/doc/usbs-data.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Data Endpoints</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Data Endpoints</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,83 +26,83 @@ TITLE="Control Endpoints"
 HREF="usbs-control.html"><LINK
 REL="NEXT"
 TITLE="Writing a USB Device Driver"
-HREF="usbs-writing.html"></HEAD>
-<BODY
+HREF="usbs-writing.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-control.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-control.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-writing.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-writing.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-DATA">
-Data Endpoints</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN623">
-</A>
-<H2>
-Name</H2>
-Data Endpoints&nbsp;--&nbsp;Data endpoint data structures</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN626">
-</A>
-<H2>
-Synopsis</H2>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-DATA"
+>Data Endpoints</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN623"
+></A
+><H2
+>Name</H2
+>Data Endpoints&nbsp;--&nbsp;Data endpoint data structures</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN626"
+></A
+><H2
+>Synopsis</H2
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="SYNOPSIS">
-#include &lt;cyg/io/usb/usbs.h&gt;
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="SYNOPSIS"
+>#include &lt;cyg/io/usb/usbs.h&gt;
 
 typedef struct usbs_rx_endpoint {
     void                 (*start_rx_fn)(struct usbs_rx_endpoint*);
@@ -120,255 +122,256 @@ typedef struct usbs_tx_endpoint {
     const unsigned char* buffer;
     int                  buffer_size;
     cyg_bool             halted;
-} usbs_tx_endpoint;</PRE>
-</TD>
-</TR>
-</TABLE>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN628">
-</A>
-<H2>
-Receive and Transmit Data Structures</H2>
-<P>
-In addition to a single <SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
-
+} usbs_tx_endpoint;</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN628"
+></A
+><H2
+>Receive and Transmit Data Structures</H2
+><P
+>In addition to a single <SPAN
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+>
 data structure per USB slave device, the USB device driver should also
 provide receive and transmit data structures corresponding to the
 other endpoints. The names of these are determined by the device
 driver. For example, the SA1110 USB device driver package provides
 <TT
-CLASS="LITERAL">
-usbs_sa11x0_ep1</TT>
- for receives and
+CLASS="LITERAL"
+>usbs_sa11x0_ep1</TT
+> for receives and
 <TT
-CLASS="LITERAL">
-usbs_sa11x0_ep2</TT>
- for transmits.</P>
-<P>
-Unlike control endpoints, the common USB slave package does provide a
+CLASS="LITERAL"
+>usbs_sa11x0_ep2</TT
+> for transmits.</P
+><P
+>Unlike control endpoints, the common USB slave package does provide a
 number of utility routines to manipulate data endpoints. For example
 <A
-HREF="usbs-start-rx.html">
-<TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
-</A>
-
+HREF="usbs-start-rx.html"
+><TT
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+></A
+>
 can be used to receive data from the host into a buffer. In addition
 the USB device driver can provide devtab entries such as
 <TT
-CLASS="LITERAL">
-/dev/usbs1r</TT>
- and <TT
-CLASS="LITERAL">
-/dev/usbs2w</TT>
-, so
+CLASS="LITERAL"
+>/dev/usbs1r</TT
+> and <TT
+CLASS="LITERAL"
+>/dev/usbs2w</TT
+>, so
 higher-level code can <TT
-CLASS="FUNCTION">
-open</TT>
- these devices and then
+CLASS="FUNCTION"
+>open</TT
+> these devices and then
 perform blocking <TT
-CLASS="FUNCTION">
-read</TT>
- and
+CLASS="FUNCTION"
+>read</TT
+> and
 <TT
-CLASS="FUNCTION">
-write</TT>
- operations.</P>
-<P>
-However, the operation of data endpoints and the various
+CLASS="FUNCTION"
+>write</TT
+> operations.</P
+><P
+>However, the operation of data endpoints and the various
 endpoint-related functions is relatively straightforward. First
 consider a <SPAN
-CLASS="STRUCTNAME">
-usbs_rx_endpoint</SPAN>
- structure. The
+CLASS="STRUCTNAME"
+>usbs_rx_endpoint</SPAN
+> structure. The
 device driver will provide the members
 <TT
-CLASS="STRUCTFIELD">
-<I>
-start_rx_fn</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>start_rx_fn</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-set_halted_fn</I>
-</TT>
-, and it will maintain the
+CLASS="STRUCTFIELD"
+><I
+>set_halted_fn</I
+></TT
+>, and it will maintain the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-halted</I>
-</TT>
- field. To receive data, higher-level
+CLASS="STRUCTFIELD"
+><I
+>halted</I
+></TT
+> field. To receive data, higher-level
 code sets the <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_fn</I>
-</TT>
- and optionally the
+CLASS="STRUCTFIELD"
+><I
+>complete_fn</I
+></TT
+> and optionally the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_data</I>
-</TT>
- fields. Next the
+CLASS="STRUCTFIELD"
+><I
+>complete_data</I
+></TT
+> fields. Next the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-start_rx_fn</I>
-</TT>
- member should be called. When
+CLASS="STRUCTFIELD"
+><I
+>start_rx_fn</I
+></TT
+> member should be called. When
 the transfer has finished the device driver will invoke the completion
 function, using <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_data</I>
-</TT>
- as the first
+CLASS="STRUCTFIELD"
+><I
+>complete_data</I
+></TT
+> as the first
 argument and a size field for the second argument. A negative size
 indicates an error of some sort: <TT
-CLASS="LITERAL">
--EGAIN</TT>
- indicates
+CLASS="LITERAL"
+>-EGAIN</TT
+> indicates
 that the endpoint has been halted, usually at the request of the host;
 <TT
-CLASS="LITERAL">
--EPIPE</TT>
- indicates that the connection between the
+CLASS="LITERAL"
+>-EPIPE</TT
+> indicates that the connection between the
 host and the peripheral has been broken. Certain device drivers may
-generate other error codes.</P>
-<P>
-If higher-level code needs to halt or unhalt an endpoint then it can
+generate other error codes.</P
+><P
+>If higher-level code needs to halt or unhalt an endpoint then it can
 invoke the <TT
-CLASS="STRUCTFIELD">
-<I>
-set_halted_fn</I>
-</TT>
- member. When an
+CLASS="STRUCTFIELD"
+><I
+>set_halted_fn</I
+></TT
+> member. When an
 endpoint is halted, invoking <TT
-CLASS="STRUCTFIELD">
-<I>
-start_rx_fn</I>
-</TT>
-
+CLASS="STRUCTFIELD"
+><I
+>start_rx_fn</I
+></TT
+>
 wit <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- set to 0 indicates that
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> set to 0 indicates that
 higher-level code wants to block until the endpoint is no longer
-halted; at that point the completion function will be invoked.</P>
-<P>
-USB device drivers are allowed to assume that higher-level protocols
+halted; at that point the completion function will be invoked.</P
+><P
+>USB device drivers are allowed to assume that higher-level protocols
 ensure that host and peripheral agree on the amount of data that will
 be transferred, or at least on an upper bound. Therefore there is no
 need for the device driver to maintain its own buffers, and copy
 operations are avoided. If the host sends more data than expected then
-the resulting behaviour is undefined.</P>
-<P>
-Transmit endpoints work in essentially the same way as receive
+the resulting behaviour is undefined.</P
+><P
+>Transmit endpoints work in essentially the same way as receive
 endpoints. Higher-level code should set the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- fields to point at the data to
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> fields to point at the data to
 be transferred, then call <TT
-CLASS="STRUCTFIELD">
-<I>
-start_tx_fn</I>
-</TT>
-, and
+CLASS="STRUCTFIELD"
+><I
+>start_tx_fn</I
+></TT
+>, and
 the device driver will invoked the completion function when the
-transfer has completed.</P>
-<P>
-USB device drivers are not expected to perform any locking. If at any
+transfer has completed.</P
+><P
+>USB device drivers are not expected to perform any locking. If at any
 time there are two concurrent receive operations for a given endpoint,
 or two concurrent transmit operations, then the resulting behaviour is
 undefined. It is the responsibility of higher-level code to perform
 any synchronisation that may be necessary. In practice, conflicts are
 unlikely because typically a given endpoint will only be accessed
-sequentially by just one part of the overall system.</P>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+sequentially by just one part of the overall system.</P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-control.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-control.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-writing.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-writing.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Control Endpoints</TD>
-<TD
+VALIGN="top"
+>Control Endpoints</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Writing a USB Device Driver</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Writing a USB Device Driver</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-devtab.html
+++ b/packages/io/usb/slave/current/doc/usbs-devtab.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Devtab Entries</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Devtab Entries</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,173 +26,173 @@ TITLE="Starting up a USB Device"
 HREF="usbs-start.html"><LINK
 REL="NEXT"
 TITLE="Receiving Data from the Host"
-HREF="usbs-start-rx.html"></HEAD>
-<BODY
+HREF="usbs-start-rx.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-start.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-start.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-start-rx.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-start-rx.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-DEVTAB">
-Devtab Entries</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN200">
-</A>
-<H2>
-Name</H2>
-Devtab Entries&nbsp;--&nbsp;Data endpoint data structure</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN203">
-</A>
-<H2>
-Synopsis</H2>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-DEVTAB"
+>Devtab Entries</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN200"
+></A
+><H2
+>Name</H2
+>Devtab Entries&nbsp;--&nbsp;Data endpoint data structure</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN203"
+></A
+><H2
+>Synopsis</H2
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="SYNOPSIS">
-/dev/usb0c
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="SYNOPSIS"
+>/dev/usb0c
 /dev/usb1r
-/dev/usb2w</PRE>
-</TD>
-</TR>
-</TABLE>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN205">
-</A>
-<H2>
-Devtab Entries</H2>
-<P>
-USB device drivers provide two ways of transferring data between host
+/dev/usb2w</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN205"
+></A
+><H2
+>Devtab Entries</H2
+><P
+>USB device drivers provide two ways of transferring data between host
 and peripheral. The first involves USB-specific functionality such as
 <A
-HREF="usbs-start-rx.html">
-<TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
-</A>
-.
+HREF="usbs-start-rx.html"
+><TT
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+></A
+>.
 This provides non-blocking I/O: a transfer is started, and some time
 later the device driver will call a supplied completion function. The
 second uses the conventional I/O model: there are entries in the
 device table corresponding to the various endpoints. Standard calls
 such as <TT
-CLASS="FUNCTION">
-open</TT>
- can then be used to get a suitable
+CLASS="FUNCTION"
+>open</TT
+> can then be used to get a suitable
 handle. Actual I/O happens via blocking <TT
-CLASS="FUNCTION">
-read</TT>
- and
+CLASS="FUNCTION"
+>read</TT
+> and
 <TT
-CLASS="FUNCTION">
-write</TT>
- calls. In practice the blocking operations
+CLASS="FUNCTION"
+>write</TT
+> calls. In practice the blocking operations
 are simply implemented using the underlying non-blocking
-functionality.</P>
-<P>
-Each endpoint will have its own devtab entry. The exact names are
+functionality.</P
+><P
+>Each endpoint will have its own devtab entry. The exact names are
 controlled by the device driver package, but typically the root will
 be <TT
-CLASS="LITERAL">
-/dev/usb</TT>
-. This is followed by one or more
+CLASS="LITERAL"
+>/dev/usb</TT
+>. This is followed by one or more
 decimal digits giving the endpoint number, followed by
 <TT
-CLASS="LITERAL">
-c</TT>
- for a control endpoint, <TT
-CLASS="LITERAL">
-r</TT>
- for
+CLASS="LITERAL"
+>c</TT
+> for a control endpoint, <TT
+CLASS="LITERAL"
+>r</TT
+> for
 a receive endpoint (host to peripheral), and <TT
-CLASS="LITERAL">
-w</TT>
- for
+CLASS="LITERAL"
+>w</TT
+> for
 a transmit endpoint (peripheral to host). If the target hardware
 involves more than one USB device then different roots should be used,
 for example <TT
-CLASS="LITERAL">
-/dev/usb0c</TT>
- and
+CLASS="LITERAL"
+>/dev/usb0c</TT
+> and
 <TT
-CLASS="LITERAL">
-/dev/usb1_0c</TT>
-. This may require explicit
+CLASS="LITERAL"
+>/dev/usb1_0c</TT
+>. This may require explicit
 manipulation of device driver configuration options by the application
-developer.</P>
-<P>
-At present the devtab entry for a control endpoint does not support
-any I/O operations. </P>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN221">
-</A>
-<H3>
-<TT
-CLASS="FUNCTION">
-write</TT>
- operations</H3>
-<P>
-<TT
-CLASS="FUNCTION">
-cyg_io_write</TT>
- and similar functions in
+developer.</P
+><P
+>At present the devtab entry for a control endpoint does not support
+any I/O operations. </P
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN221"
+></A
+><H3
+><TT
+CLASS="FUNCTION"
+>write</TT
+> operations</H3
+><P
+><TT
+CLASS="FUNCTION"
+>cyg_io_write</TT
+> and similar functions in
 higher-level packages can be used to perform a transfer from
 peripheral to host. Successive write operations will not be coalesced.
 For example, when doing a 1000 byte write to an endpoint that uses the
@@ -198,213 +200,213 @@ bulk transfer protocol this will involve
 and a terminating 40-byte packet. USB device drivers are not expected
 to do any locking, and if higher-level code performs multiple
 concurrent write operations on a single endpoint then the resulting
-behaviour is undefined.</P>
-<P>
-A USB <TT
-CLASS="FUNCTION">
-write</TT>
- operation will never transfer less
+behaviour is undefined.</P
+><P
+>A USB <TT
+CLASS="FUNCTION"
+>write</TT
+> operation will never transfer less
 data than specified. It is the responsibility of higher-level code to
 ensure that the amount of data being transferred is acceptable to the
 host-side code. Usually this will be defined by a higher-level
 protocol. If an attempt is made to transfer more data than the host
-expects then the resulting behaviour is undefined.</P>
-<P>
-There are two likely error conditions. <TT
-CLASS="LITERAL">
-EPIPE</TT>
-
+expects then the resulting behaviour is undefined.</P
+><P
+>There are two likely error conditions. <TT
+CLASS="LITERAL"
+>EPIPE</TT
+>
 indicates that the connection between host and target has been broken.
 <TT
-CLASS="LITERAL">
-EAGAIN</TT>
- indicates that the endpoint has been
+CLASS="LITERAL"
+>EAGAIN</TT
+> indicates that the endpoint has been
 stalled, either at the request of the host or by other activity
-inside the peripheral.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN231">
-</A>
-<H3>
-<TT
-CLASS="FUNCTION">
-read</TT>
- operations</H3>
-<P>
-<TT
-CLASS="FUNCTION">
-cyg_io_read</TT>
- and similar functions in higher-level
+inside the peripheral.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN231"
+></A
+><H3
+><TT
+CLASS="FUNCTION"
+>read</TT
+> operations</H3
+><P
+><TT
+CLASS="FUNCTION"
+>cyg_io_read</TT
+> and similar functions in higher-level
 packages can be used to perform a transfer from host to peripheral.
 This should be a complete transfer: higher-level protocols should
 define an upper bound on the amount of data being transferred, and the
 <TT
-CLASS="FUNCTION">
-read</TT>
- operation should involve at least this
+CLASS="FUNCTION"
+>read</TT
+> operation should involve at least this
 amount of data. The return value will indicate the actual transfer
-size, which may be less than requested.</P>
-<P>
-Some device drivers may support partial reads, but USB device drivers
+size, which may be less than requested.</P
+><P
+>Some device drivers may support partial reads, but USB device drivers
 are not expected to perform any buffering because that involves both
 memory and code overheads. One technique that may work for bulk
 transfers is to exploit the fact that such transfers happen in 64-byte
 packets. It is possible to <TT
-CLASS="FUNCTION">
-read</TT>
- an initial 64
+CLASS="FUNCTION"
+>read</TT
+> an initial 64
 bytes, corresponding to the first packet in the transfer. These 64
 bytes can then be examined to determine the total transfer size, and
 the remaining data can be transferred in another
 <TT
-CLASS="FUNCTION">
-read</TT>
- operation. This technique is not guaranteed
+CLASS="FUNCTION"
+>read</TT
+> operation. This technique is not guaranteed
 to work with all USB hardware. Also, if the delay between accepting
 the first packet and the remainder of the transfer is excessive then
 this could cause timeout problems for the host-side software. For
-these reasons the use of partial reads should be avoided.</P>
-<P>
-There are two likely error conditions. <TT
-CLASS="LITERAL">
-EPIPE</TT>
-
+these reasons the use of partial reads should be avoided.</P
+><P
+>There are two likely error conditions. <TT
+CLASS="LITERAL"
+>EPIPE</TT
+>
 indicates that the connection between host and target has been broken.
 <TT
-CLASS="LITERAL">
-EAGAIN</TT>
- indicates that the endpoint has been
+CLASS="LITERAL"
+>EAGAIN</TT
+> indicates that the endpoint has been
 stalled, either at the request of the host or by other activity
-inside the peripheral.</P>
-<P>
-USB device drivers are not expected to do any locking. If higher-level
+inside the peripheral.</P
+><P
+>USB device drivers are not expected to do any locking. If higher-level
 code performs multiple concurrent read operations on a single endpoint
-then the resulting behaviour is undefined.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN244">
-</A>
-<H3>
+then the resulting behaviour is undefined.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN244"
+></A
+><H3
+><TT
+CLASS="FUNCTION"
+>select</TT
+> operations</H3
+><P
+>Typical USB device drivers will not provide any support for
 <TT
-CLASS="FUNCTION">
-select</TT>
- operations</H3>
-<P>
-Typical USB device drivers will not provide any support for
-<TT
-CLASS="FUNCTION">
-select</TT>
-. Consider bulk transfers from the host to
+CLASS="FUNCTION"
+>select</TT
+>. Consider bulk transfers from the host to
 the peripheral. At the USB device driver level there is no way of
 knowing in advance how large a transfer will be, so it is not feasible
 for the device driver to buffer the entire transfer. It may be
 possible to buffer part of the transfer, for example the first 64-byte
 packet, and copy this into application space at the start of a
 <TT
-CLASS="FUNCTION">
-read</TT>
-, but this adds code and memory overheads.
+CLASS="FUNCTION"
+>read</TT
+>, but this adds code and memory overheads.
 Worse, it means that there is an unknown but potentially long delay
 between a peripheral accepting the first packet of a transfer and the
 remaining packets, which could confuse or upset the host-side
-software.</P>
-<P>
-With some USB hardware it may be possible for the device driver to
+software.</P
+><P
+>With some USB hardware it may be possible for the device driver to
 detect OUT tokens from the host without actually accepting the data,
 and this would indicate that a  <TT
-CLASS="FUNCTION">
-read</TT>
- is likely to
+CLASS="FUNCTION"
+>read</TT
+> is likely to
 succeed. However, it would not be reliable since the host-side I/O
 operation could time out. A similar mechanism could be used to
 implement <TT
-CLASS="FUNCTION">
-select</TT>
- for outgoing data, but again
-this would not be reliable.</P>
-<P>
-Some device drivers may provide partial support for
+CLASS="FUNCTION"
+>select</TT
+> for outgoing data, but again
+this would not be reliable.</P
+><P
+>Some device drivers may provide partial support for
 <TT
-CLASS="FUNCTION">
-select</TT>
- anyway, possibly under the control of a
+CLASS="FUNCTION"
+>select</TT
+> anyway, possibly under the control of a
 configuration option. The device driver's documentation should be
 consulted for further information. It is also worth noting that the
 USB-specific non-blocking API can often be used as an alternative to
 <TT
-CLASS="FUNCTION">
-select</TT>
-.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN256">
-</A>
-<H3>
-<TT
-CLASS="FUNCTION">
-get_config</TT>
- and
+CLASS="FUNCTION"
+>select</TT
+>.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN256"
+></A
+><H3
+><TT
+CLASS="FUNCTION"
+>get_config</TT
+> and
 <TT
-CLASS="FUNCTION">
-set_config</TT>
- operations</H3>
-<P>
-There are no <TT
-CLASS="FUNCTION">
-set_config</TT>
- or
+CLASS="FUNCTION"
+>set_config</TT
+> operations</H3
+><P
+>There are no <TT
+CLASS="FUNCTION"
+>set_config</TT
+> or
 <TT
-CLASS="FUNCTION">
-get_config</TT>
- (also known as
+CLASS="FUNCTION"
+>get_config</TT
+> (also known as
 <TT
-CLASS="FUNCTION">
-ioctl</TT>
-) operations defined for USB devices.
-Some device drivers may provide hardware-specific facilities this way. </P>
-<DIV
-CLASS="NOTE">
-<BLOCKQUOTE
-CLASS="NOTE">
-<P>
-<B>
-Note: </B>
-Currently the USB-specific functions related to <A
-HREF="usbs-halt.html">
-halted endpoints</A>
- cannot be accessed readily
+CLASS="FUNCTION"
+>ioctl</TT
+>) operations defined for USB devices.
+Some device drivers may provide hardware-specific facilities this way. </P
+><DIV
+CLASS="NOTE"
+><BLOCKQUOTE
+CLASS="NOTE"
+><P
+><B
+>Note: </B
+>Currently the USB-specific functions related to <A
+HREF="usbs-halt.html"
+>halted endpoints</A
+> cannot be accessed readily
 via devtab entries. This functionality should probably be made
 available via <TT
-CLASS="FUNCTION">
-set_config</TT>
- and
+CLASS="FUNCTION"
+>set_config</TT
+> and
 <TT
-CLASS="FUNCTION">
-get_config</TT>
-. It may also prove useful to provide
+CLASS="FUNCTION"
+>get_config</TT
+>. It may also prove useful to provide
 a <TT
-CLASS="FUNCTION">
-get_config</TT>
- operation that maps from the
-devtab entries to the underlying endpoint data structures.</P>
-</BLOCKQUOTE>
-</DIV>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN270">
-</A>
-<H3>
-Presence</H3>
-<P>
-The devtab entries are optional. If the USB device is accessed
+CLASS="FUNCTION"
+>get_config</TT
+> operation that maps from the
+devtab entries to the underlying endpoint data structures.</P
+></BLOCKQUOTE
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN270"
+></A
+><H3
+>Presence</H3
+><P
+>The devtab entries are optional. If the USB device is accessed
 primarily by class-specific code such as the USB-ethernet package and
 that package uses the USB-specific API directly, the devtab entries
 are redundant. Even if application code does need to access the USB
@@ -414,64 +416,65 @@ serve no useful purpose, but they still 
 is possible to suppress the presence of these entries by disabling the
 configuration option
 <TT
-CLASS="LITERAL">
-CYGGLO_IO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES</TT>
-.</P>
-</DIV>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+CLASS="LITERAL"
+>CYGGLO_IO_USB_SLAVE_PROVIDE_DEVTAB_ENTRIES</TT
+>.</P
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-start.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-start.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-start-rx.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-start-rx.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Starting up a USB Device</TD>
-<TD
+VALIGN="top"
+>Starting up a USB Device</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Receiving Data from the Host</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Receiving Data from the Host</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-enum.html
+++ b/packages/io/usb/slave/current/doc/usbs-enum.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-USB Enumeration Data</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>USB Enumeration Data</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,83 +26,83 @@ TITLE="Introduction"
 HREF="usbs-intro.html"><LINK
 REL="NEXT"
 TITLE="Starting up a USB Device"
-HREF="usbs-start.html"></HEAD>
-<BODY
+HREF="usbs-start.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-intro.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-intro.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-start.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-start.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-ENUM">
-USB Enumeration Data</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN68">
-</A>
-<H2>
-Name</H2>
-Enumeration Data&nbsp;--&nbsp;The USB enumeration data structures</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN71">
-</A>
-<H2>
-Synopsis</H2>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-ENUM"
+>USB Enumeration Data</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN68"
+></A
+><H2
+>Name</H2
+>Enumeration Data&nbsp;--&nbsp;The USB enumeration data structures</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN71"
+></A
+><H2
+>Synopsis</H2
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="SYNOPSIS">
-#include &lt;cyg/io/usb/usb.h&gt;
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="SYNOPSIS"
+>#include &lt;cyg/io/usb/usb.h&gt;
 #include &lt;cyg/io/usb/usbs.h&gt;
 
 typedef struct usb_device_descriptor {
@@ -128,20 +130,20 @@ typedef struct usbs_enumeration_data {
     const usb_interface_descriptor*     interfaces;
     const usb_endpoint_descriptor*      endpoints;
     const unsigned char**               strings;
-} usbs_enumeration_data;</PRE>
-</TD>
-</TR>
-</TABLE>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN73">
-</A>
-<H2>
-USB Enumeration Data</H2>
-<P>
-When a USB host detects that a peripheral has been plugged in or
+} usbs_enumeration_data;</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN73"
+></A
+><H2
+>USB Enumeration Data</H2
+><P
+>When a USB host detects that a peripheral has been plugged in or
 powered up, one of the first steps is to ask the peripheral to
 describe itself by supplying enumeration data. Some of this data
 depends on the class of peripheral. Other fields are vendor-specific.
@@ -150,24 +152,24 @@ endpoints are available should be used. 
 for generic code to provide this information, so it is the
 responsibility of application code to provide a suitable
 <SPAN
-CLASS="STRUCTNAME">
-usbs_enumeration_data</SPAN>
- data structure and
+CLASS="STRUCTNAME"
+>usbs_enumeration_data</SPAN
+> data structure and
 install it in the endpoint 0 data structure during initialization.
 This must happen before the USB device is enabled by a call to
 <TT
-CLASS="FUNCTION">
-usbs_start</TT>
-, for example:</P>
-<TABLE
+CLASS="FUNCTION"
+>usbs_start</TT
+>, for example:</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-const usbs_enumeration_data usb_enum_data = {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>const usbs_enumeration_data usb_enum_data = {
     &#8230;
 };
 
@@ -178,65 +180,65 @@ main(int argc, char** argv)
     &#8230;
     usbs_start(&amp;usbs_sa11x0_ep0);
     &#8230;
-}</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-For most applications the enumeration data will be static, although
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>For most applications the enumeration data will be static, although
 the <SPAN
-CLASS="STRUCTNAME">
-usbs_enumeration_data</SPAN>
- structure can be
+CLASS="STRUCTNAME"
+>usbs_enumeration_data</SPAN
+> structure can be
 filled in at run-time if necessary. Full details of the enumeration
 data can be found in the Universal Serial Bus specification obtainable
 from the <A
 HREF="http://www.usb.org/"
-TARGET="_top">
-USB Implementers Forum web
-site</A>
-, although the meaning of most fields is fairly obvious.
+TARGET="_top"
+>USB Implementers Forum web
+site</A
+>, although the meaning of most fields is fairly obvious.
 The various data structures and utility macros are defined in the
 header files <TT
-CLASS="FILENAME">
-cyg/io/usb/usb.h</TT>
-
+CLASS="FILENAME"
+>cyg/io/usb/usb.h</TT
+>
 and <TT
-CLASS="FILENAME">
-cyg/io/usb/usbs.h</TT>
-. Note
+CLASS="FILENAME"
+>cyg/io/usb/usbs.h</TT
+>. Note
 that the example code below makes use of the gcc labelled element
-extension.</P>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN84">
-</A>
-<H3>
+extension.</P
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN84"
+></A
+><H3
+><SPAN
+CLASS="STRUCTNAME"
+>usb_device_descriptor</SPAN
+></H3
+><P
+>The main information about a USB peripheral comes from a single
 <SPAN
-CLASS="STRUCTNAME">
-usb_device_descriptor</SPAN>
-</H3>
-<P>
-The main information about a USB peripheral comes from a single
-<SPAN
-CLASS="STRUCTNAME">
-usb_device_descriptor</SPAN>
- structure, which is
+CLASS="STRUCTNAME"
+>usb_device_descriptor</SPAN
+> structure, which is
 embedded in the <SPAN
-CLASS="STRUCTNAME">
-usbs_enumeration_data</SPAN>
-
-structure. A typical example might look like this:</P>
-<TABLE
+CLASS="STRUCTNAME"
+>usbs_enumeration_data</SPAN
+>
+structure. A typical example might look like this:</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-const usbs_enumeration_data usb_enum_data = {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>const usbs_enumeration_data usb_enum_data = {
     {
         length:                 USB_DEVICE_DESCRIPTOR_LENGTH,
         type:                   USB_DEVICE_DESCRIPTOR_TYPE,
@@ -258,28 +260,28 @@ const usbs_enumeration_data usb_enum_dat
         number_configurations:  1
     },
     &#8230;
-};</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-The length and type fields are specified by the USB standard. The
+};</PRE
+></TD
+></TR
+></TABLE
+><P
+>The length and type fields are specified by the USB standard. The
 <TT
-CLASS="STRUCTFIELD">
-<I>
-usb_spec_lo</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>usb_spec_lo</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-usb_spec_hi</I>
-</TT>
- fields identify the particular
+CLASS="STRUCTFIELD"
+><I
+>usb_spec_hi</I
+></TT
+> fields identify the particular
 revision of the standard that the peripheral implements, for example
-revision 1.1.</P>
-<P>
-The device class, subclass, and protocol fields are used by generic
+revision 1.1.</P
+><P
+>The device class, subclass, and protocol fields are used by generic
 host-side USB software to determine which host-side device driver
 should be loaded to interact with the peripheral. A number of standard
 classes are defined, for example mass-storage devices and
@@ -287,110 +289,110 @@ human-interface devices. If a peripheral
 standard classes then a standard existing host-side device driver may
 exist, eliminating the need to write a custom driver. The value
 <TT
-CLASS="LITERAL">
-0xFF</TT>
- (<TT
-CLASS="LITERAL">
-VENDOR</TT>
-) is reserved for
+CLASS="LITERAL"
+>0xFF</TT
+> (<TT
+CLASS="LITERAL"
+>VENDOR</TT
+>) is reserved for
 peripherals that implement a vendor-specific protocol rather than a
 standard one. Such peripherals will require a custom host-side device
 driver. The value <TT
-CLASS="LITERAL">
-0x00</TT>
-
+CLASS="LITERAL"
+>0x00</TT
+>
 (<TT
-CLASS="LITERAL">
-INTERFACE</TT>
-) is reserved and indicates that the
+CLASS="LITERAL"
+>INTERFACE</TT
+>) is reserved and indicates that the
 protocol used by the peripheral is defined at the interface level
-rather than for the peripheral as a whole.</P>
-<P>
-The <TT
-CLASS="STRUCTFIELD">
-<I>
-max_package_size</I>
-</TT>
- field specifies the
+rather than for the peripheral as a whole.</P
+><P
+>The <TT
+CLASS="STRUCTFIELD"
+><I
+>max_package_size</I
+></TT
+> field specifies the
 maximum length of a control message. There is a lower bound of eight
 bytes, and typical hardware will not support anything larger because
-control messages are usually small and not performance-critical.</P>
-<P>
-The <TT
-CLASS="STRUCTFIELD">
-<I>
-vendor_lo</I>
-</TT>
- and
+control messages are usually small and not performance-critical.</P
+><P
+>The <TT
+CLASS="STRUCTFIELD"
+><I
+>vendor_lo</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-vendor_hi</I>
-</TT>
- fields specify a vendor id, which
+CLASS="STRUCTFIELD"
+><I
+>vendor_hi</I
+></TT
+> fields specify a vendor id, which
 must be obtained from the USB Implementor's Forum. The numbers used in
 the code fragment above are examples only and must not be used in real
 USB peripherals. The product identifier is determined by the vendor,
 and different USB peripherals should use different identifiers. The
 device identifier field should indicate a release number in
-binary-coded decimal.</P>
-<P>
-The above fields are all numerical in nature. A USB peripheral can
+binary-coded decimal.</P
+><P
+>The above fields are all numerical in nature. A USB peripheral can
 also provide a number of strings as described <A
-HREF="usbs-enum.html#AEN159">
-below</A>
-, for example the name of the
+HREF="usbs-enum.html#AEN159"
+>below</A
+>, for example the name of the
 vendor can be provided. The various <TT
-CLASS="STRUCTFIELD">
-<I>
-_str</I>
-</TT>
-
+CLASS="STRUCTFIELD"
+><I
+>_str</I
+></TT
+>
 fields act as indices into an array of strings, with index 0
-indicating that no string is available. </P>
-<P>
-A typical USB peripheral involves just a single configuration. However
+indicating that no string is available. </P
+><P
+>A typical USB peripheral involves just a single configuration. However
 more complicated peripherals can support multiple configurations. Only
 one configuration will be active at any one time, and the host will
 switch between them as appropriate. If a peripheral does involve
 multiple configurations then typically it will be the responsibility
 of application code to <A
-HREF="usbs-control.html#AEN545">
-handle</A>
- the standard
-set-configuration control message.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN109">
-</A>
-<H3>
-<SPAN
-CLASS="STRUCTNAME">
-usb_configuration_descriptor</SPAN>
-</H3>
-<P>
-A USB peripheral involves at least one and possible several different
+HREF="usbs-control.html#AEN545"
+>handle</A
+> the standard
+set-configuration control message.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN109"
+></A
+><H3
+><SPAN
+CLASS="STRUCTNAME"
+>usb_configuration_descriptor</SPAN
+></H3
+><P
+>A USB peripheral involves at least one and possible several different
 configurations. The <SPAN
-CLASS="STRUCTNAME">
-usbs_enumeration_data</SPAN>
-
+CLASS="STRUCTNAME"
+>usbs_enumeration_data</SPAN
+>
 structure requires a pointer to an array, possibly of length 1, of
 <SPAN
-CLASS="STRUCTNAME">
-usb_configuration_descriptor</SPAN>
- structures.
-Usually a single structure suffices:</P>
-<TABLE
+CLASS="STRUCTNAME"
+>usb_configuration_descriptor</SPAN
+> structures.
+Usually a single structure suffices:</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-const usb_configuration_descriptor usb_configuration = {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>const usb_configuration_descriptor usb_configuration = {
     length:             USB_CONFIGURATION_DESCRIPTOR_LENGTH,
     type:               USB_CONFIGURATION_DESCRIPTOR_TYPE,
     total_length_lo:    USB_CONFIGURATION_DESCRIPTOR_TOTAL_LENGTH_LO(1, 2),
@@ -407,102 +409,102 @@ const usbs_enumeration_data usb_enum_dat
     &#8230;
     configurations:             &amp;usb_configuration,
     &#8230;
-};</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-The values for the <TT
-CLASS="STRUCTFIELD">
-<I>
-length</I>
-</TT>
- and
+};</PRE
+></TD
+></TR
+></TABLE
+><P
+>The values for the <TT
+CLASS="STRUCTFIELD"
+><I
+>length</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-type</I>
-</TT>
- fields are determined by the standard.
+CLASS="STRUCTFIELD"
+><I
+>type</I
+></TT
+> fields are determined by the standard.
 The <TT
-CLASS="STRUCTFIELD">
-<I>
-total_length</I>
-</TT>
- field depends on the
+CLASS="STRUCTFIELD"
+><I
+>total_length</I
+></TT
+> field depends on the
 number of interfaces and endpoints used by this configuration, and
 convenience macros are provided to calculate this: the first argument
 to the macros specify the number of interfaces, the second the number
 of endpoints. The <TT
-CLASS="STRUCTFIELD">
-<I>
-number_interfaces</I>
-</TT>
- field
+CLASS="STRUCTFIELD"
+><I
+>number_interfaces</I
+></TT
+> field
 is self-explanatory. If the peripheral involves multiple
 configurations then each one must have a unique id, and this will be
 used in the set-configuration control message. The id
 <TT
-CLASS="LITERAL">
-0</TT>
- is reserved, and a set-configuration control
+CLASS="LITERAL"
+>0</TT
+> is reserved, and a set-configuration control
 message that uses this id indicates that the peripheral should be
 inactive. Configurations can have a string description if required.
 The <TT
-CLASS="STRUCTFIELD">
-<I>
-attributes</I>
-</TT>
- field must have the
+CLASS="STRUCTFIELD"
+><I
+>attributes</I
+></TT
+> field must have the
 <TT
-CLASS="LITERAL">
-REQUIRED</TT>
- bit set; the
+CLASS="LITERAL"
+>REQUIRED</TT
+> bit set; the
 <TT
-CLASS="LITERAL">
-SELF_POWERED</TT>
- bit informs the host that the
+CLASS="LITERAL"
+>SELF_POWERED</TT
+> bit informs the host that the
 peripheral has its own power supply and will not draw any power over
 the bus, leaving more bus power available to other peripherals; the
 <TT
-CLASS="LITERAL">
-REMOTE_WAKEUP</TT>
- bit is used if the peripheral can
+CLASS="LITERAL"
+>REMOTE_WAKEUP</TT
+> bit is used if the peripheral can
 interrupt the host when the latter is in power-saving mode. For
 peripherals that are not self-powered, the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-max_power</I>
-</TT>
- field specifies the power
-requirements in units of 2mA.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN127">
-</A>
-<H3>
-<SPAN
-CLASS="STRUCTNAME">
-usb_interface_descriptor</SPAN>
-</H3>
-<P>
-A USB configuration involves one or more interfaces, typically
+CLASS="STRUCTFIELD"
+><I
+>max_power</I
+></TT
+> field specifies the power
+requirements in units of 2mA.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN127"
+></A
+><H3
+><SPAN
+CLASS="STRUCTNAME"
+>usb_interface_descriptor</SPAN
+></H3
+><P
+>A USB configuration involves one or more interfaces, typically
 corresponding to different streams of data. For example, one interface
 might involve video data while another interface is for audio.
 Multiple interfaces in a single configuration will be active at the
-same time.</P>
-<TABLE
+same time.</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-const usb_interface_descriptor usb_interface = {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>const usb_interface_descriptor usb_interface = {
     length:             USB_INTERFACE_DESCRIPTOR_LENGTH,
     type:               USB_INTERFACE_DESCRIPTOR_TYPE,
     interface_id:       0,
@@ -519,90 +521,90 @@ const usbs_enumeration_data usb_enum_dat
     total_number_interfaces:    1,
     interfaces:                 &amp;usb_interface,
     &#8230;
-};</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-Again, the <TT
-CLASS="STRUCTFIELD">
-<I>
-length</I>
-</TT>
- and
+};</PRE
+></TD
+></TR
+></TABLE
+><P
+>Again, the <TT
+CLASS="STRUCTFIELD"
+><I
+>length</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-type</I>
-</TT>
- fields are specified by the standard.
+CLASS="STRUCTFIELD"
+><I
+>type</I
+></TT
+> fields are specified by the standard.
 Each interface within a configuration requires its own id. However, a
 given interface may have several alternate settings, in other words
 entries in the interfaces array with the same id but different
 <TT
-CLASS="STRUCTFIELD">
-<I>
-alternate_setting</I>
-</TT>
- fields. For example,
+CLASS="STRUCTFIELD"
+><I
+>alternate_setting</I
+></TT
+> fields. For example,
 there might be one setting which requires a bandwidth of 100K/s and
 another setting that only needs 50K/s. The host can use the standard
 set-interface control message to choose the most appropriate setting.
 The handling of this request is the responsibility of higher-level
 code, so the application may have to <A
-HREF="usbs-control.html#AEN545">
-install</A>
- its own handler.</P>
-<P>
-The number of endpoints used by an interface is specified in the
+HREF="usbs-control.html#AEN545"
+>install</A
+> its own handler.</P
+><P
+>The number of endpoints used by an interface is specified in the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-number_endpoints</I>
-</TT>
- field. Exact details of
+CLASS="STRUCTFIELD"
+><I
+>number_endpoints</I
+></TT
+> field. Exact details of
 which endpoints are used is held in a separate array of endpoint
 descriptors. The class, subclass and protocol fields are used by
 host-side code to determine which host-side device driver should
 handle this specific interface. Usually this is determined on a
 per-peripheral basis in the
 <SPAN
-CLASS="STRUCTNAME">
-usb_device_descriptor</SPAN>
- structure, but that can
+CLASS="STRUCTNAME"
+>usb_device_descriptor</SPAN
+> structure, but that can
 defer the details to individual interfaces. A per-interface string
-is allowed as well.</P>
-<P>
-For USB peripherals involving multiple configurations, the array of
+is allowed as well.</P
+><P
+>For USB peripherals involving multiple configurations, the array of
 <SPAN
-CLASS="STRUCTNAME">
-usb_interface_descriptor</SPAN>
- structures should
+CLASS="STRUCTNAME"
+>usb_interface_descriptor</SPAN
+> structures should
 first contain all the interfaces for the first configuration, then all
-the interfaces for the second configuration, and so on.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN142">
-</A>
-<H3>
-<SPAN
-CLASS="STRUCTNAME">
-usb_endpoint_descriptor</SPAN>
-</H3>
-<P>
-The host also needs information about which endpoint should be used
-for what. This involves an array of endpoint descriptors:</P>
-<TABLE
+the interfaces for the second configuration, and so on.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN142"
+></A
+><H3
+><SPAN
+CLASS="STRUCTNAME"
+>usb_endpoint_descriptor</SPAN
+></H3
+><P
+>The host also needs information about which endpoint should be used
+for what. This involves an array of endpoint descriptors:</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-const usb_endpoint_descriptor usb_endpoints[] = {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>const usb_endpoint_descriptor usb_endpoints[] = {
     {
         length:         USB_ENDPOINT_DESCRIPTOR_LENGTH,
         type:           USB_ENDPOINT_DESCRIPTOR_TYPE,
@@ -628,107 +630,107 @@ const usbs_enumeration_data usb_enum_dat
     total_number_endpoints:     2,
     endpoints:                  usb_endpoints,
     &#8230;
-};</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-As usual the values for the <TT
-CLASS="STRUCTFIELD">
-<I>
-length</I>
-</TT>
- and
+};</PRE
+></TD
+></TR
+></TABLE
+><P
+>As usual the values for the <TT
+CLASS="STRUCTFIELD"
+><I
+>length</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-type</I>
-</TT>
- fields are specified by the standard.
+CLASS="STRUCTFIELD"
+><I
+>type</I
+></TT
+> fields are specified by the standard.
 The <TT
-CLASS="STRUCTFIELD">
-<I>
-endpoint</I>
-</TT>
- field gives both the endpoint
+CLASS="STRUCTFIELD"
+><I
+>endpoint</I
+></TT
+> field gives both the endpoint
 number and the direction, so in the above example endpoint 1 is used
 for OUT (host to peripheral) transfers and endpoint 2 is used for IN
 (peripheral to host) transfers. The
 <TT
-CLASS="STRUCTFIELD">
-<I>
-attributes</I>
-</TT>
- field indicates the USB protocol
+CLASS="STRUCTFIELD"
+><I
+>attributes</I
+></TT
+> field indicates the USB protocol
 that should be used on this endpoint: <TT
-CLASS="LITERAL">
-CONTROL</TT>
-,
+CLASS="LITERAL"
+>CONTROL</TT
+>,
 <TT
-CLASS="LITERAL">
-ISOCHRONOUS</TT>
-, <TT
-CLASS="LITERAL">
-BULK</TT>
- or
+CLASS="LITERAL"
+>ISOCHRONOUS</TT
+>, <TT
+CLASS="LITERAL"
+>BULK</TT
+> or
 <TT
-CLASS="LITERAL">
-INTERRUPT</TT>
-. The
+CLASS="LITERAL"
+>INTERRUPT</TT
+>. The
 <TT
-CLASS="STRUCTFIELD">
-<I>
-max_packet</I>
-</TT>
- field specifies the maximum size
+CLASS="STRUCTFIELD"
+><I
+>max_packet</I
+></TT
+> field specifies the maximum size
 of a single USB packet. For bulk transfers this will typically be 64
 bytes. For isochronous transfers this can be up to 1023 bytes. For
 interrupt transfers it can be up to 64 bytes, although usually a
 smaller value will be used. The <TT
-CLASS="STRUCTFIELD">
-<I>
-interval</I>
-</TT>
-
+CLASS="STRUCTFIELD"
+><I
+>interval</I
+></TT
+>
 field is ignored for control and bulk transfers. For isochronous
 transfers it should be set to 1. For interrupt transfers it can be a
 value between 1 and 255, and indicates the number of milliseconds
-between successive polling operations.</P>
-<P>
-For USB peripherals involving multiple configurations or interfaces
+between successive polling operations.</P
+><P
+>For USB peripherals involving multiple configurations or interfaces
 the array of endpoint descriptors should be organized sequentially:
 first the endpoints corresponding to the first interface of the first
 configuration, then the second interface in that configuration, and so
 on; then all the endpoints for all the interfaces in the second
-configuration; etc.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN159">
-</A>
-<H3>
-Strings</H3>
-<P>
-The enumeration data can contain a number of strings with additional
+configuration; etc.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN159"
+></A
+><H3
+>Strings</H3
+><P
+>The enumeration data can contain a number of strings with additional
 information. Unicode encoding is used for the strings, and it is
 possible for a peripheral to supply a given string in multiple
 languages using the appropriate characters. The first two bytes of
 each string give a length and type field. The first string is special;
 after the two bytes header it consists of an array of 2-byte language
 id codes, indicating the supported languages. The language code
-0x0409 corresponds to English (United States). </P>
-<TABLE
+0x0409 corresponds to English (United States). </P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-const unsigned char* usb_strings[] = {
-    "\x04\x03\x09\x04",
-    "\x10\x03R\0e\0d\0 \0H\0a\0t\0"
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>const unsigned char* usb_strings[] = {
+    "\004\003\011\004",
+    "\020\003R\000e\000d\000 \000H\000a\000t\000"
 };
 
 const usbs_enumeration_data usb_enum_data = {
@@ -736,96 +738,97 @@ const usbs_enumeration_data usb_enum_dat
     total_number_strings:       2,
     strings:                    usb_strings,
     &#8230;
-};</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-The default handler for standard control messages assumes that the
+};</PRE
+></TD
+></TR
+></TABLE
+><P
+>The default handler for standard control messages assumes that the
 peripheral only uses a single language. If this is not the case then
 higher-level code will have to handle the standard get-descriptor
-control messages when a string descriptor is requested.</P>
-</DIV>
-<DIV
-CLASS="REFSECT2">
-<A
-NAME="AEN164">
-</A>
-<H3>
-<SPAN
-CLASS="STRUCTNAME">
-usbs_enumeration_data</SPAN>
-</H3>
-<P>
-The <SPAN
-CLASS="STRUCTNAME">
-usbs_enumeration_data</SPAN>
- data structure
+control messages when a string descriptor is requested.</P
+></DIV
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN164"
+></A
+><H3
+><SPAN
+CLASS="STRUCTNAME"
+>usbs_enumeration_data</SPAN
+></H3
+><P
+>The <SPAN
+CLASS="STRUCTNAME"
+>usbs_enumeration_data</SPAN
+> data structure
 collects together all the various descriptors that make up the
 enumeration data. It is the responsibility of application code to
 supply a suitable data structure and install it in the control
 endpoints's <TT
-CLASS="STRUCTFIELD">
-<I>
-enumeration_data</I>
-</TT>
- field before
-the USB device is started.</P>
-</DIV>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+CLASS="STRUCTFIELD"
+><I
+>enumeration_data</I
+></TT
+> field before
+the USB device is started.</P
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-intro.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-intro.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-start.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-start.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Introduction</TD>
-<TD
+VALIGN="top"
+>Introduction</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Starting up a USB Device</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Starting up a USB Device</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-halt.html
+++ b/packages/io/usb/slave/current/doc/usbs-halt.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Halted Endpoints</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Halted Endpoints</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,169 +26,172 @@ TITLE="Sending Data to the Host"
 HREF="usbs-start-tx.html"><LINK
 REL="NEXT"
 TITLE="Control Endpoints"
-HREF="usbs-control.html"></HEAD>
-<BODY
+HREF="usbs-control.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-start-tx.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-start-tx.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-control.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-control.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-HALT">
-Halted Endpoints</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN420">
-</A>
-<H2>
-Name</H2>
-Halted Endpoints&nbsp;--&nbsp;Support for Halting and Halted Endpoints</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN423">
-</A>
-<H2>
-Synopsis</H2>
-<DIV
-CLASS="FUNCSYNOPSIS">
-<P>
-</P>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-HALT"
+>Halted Endpoints</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN420"
+></A
+><H2
+>Name</H2
+>Halted Endpoints&nbsp;--&nbsp;Support for Halting and Halted Endpoints</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN423"
+></A
+><H2
+>Synopsis</H2
+><DIV
+CLASS="FUNCSYNOPSIS"
+><A
+NAME="AEN424"
+></A
+><P
+></P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="FUNCSYNOPSISINFO">
-#include &lt;cyg/io/usb/usbs.h&gt;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-cyg_bool usbs_rx_endpoint_halted</CODE>
-(usbs_rx_endpoint* ep);</CODE>
-</P>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_set_rx_endpoint_halted</CODE>
-(usbs_rx_endpoint* ep, cyg_bool new_state);</CODE>
-</P>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_start_rx_endpoint_wait</CODE>
-(usbs_rx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE>
-</P>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-cyg_bool
-usbs_tx_endpoint_halted</CODE>
-(usbs_tx_endpoint* ep);</CODE>
-</P>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_set_tx_endpoint_halted</CODE>
-(usbs_tx_endpoint* ep, cyg_bool new_state);</CODE>
-</P>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_start_tx_endpoint_wait</CODE>
-(usbs_tx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE>
-</P>
-<P>
-</P>
-</DIV>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN468">
-</A>
-<H2>
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="FUNCSYNOPSISINFO"
+>#include &lt;cyg/io/usb/usbs.h&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>cyg_bool usbs_rx_endpoint_halted</CODE
+>(usbs_rx_endpoint* ep);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_set_rx_endpoint_halted</CODE
+>(usbs_rx_endpoint* ep, cyg_bool new_state);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_start_rx_endpoint_wait</CODE
+>(usbs_rx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>cyg_bool
+usbs_tx_endpoint_halted</CODE
+>(usbs_tx_endpoint* ep);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_set_tx_endpoint_halted</CODE
+>(usbs_tx_endpoint* ep, cyg_bool new_state);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_start_tx_endpoint_wait</CODE
+>(usbs_tx_endpoint* ep, void (*)(void*, int) complete_fn, void * complete_data);</CODE
+></P
+><P
+></P
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN468"
+></A
+><H2
+><TT
+CLASS="FUNCTION"
+>Description</TT
+></H2
+><P
+>Normal USB traffic involves straightforward handshakes, with either an
 <TT
-CLASS="FUNCTION">
-Description</TT>
-</H2>
-<P>
-Normal USB traffic involves straightforward handshakes, with either an
-<TT
-CLASS="LITERAL">
-ACK</TT>
- to indicate that a packet was transferred
+CLASS="LITERAL"
+>ACK</TT
+> to indicate that a packet was transferred
 without errors, or a <TT
-CLASS="LITERAL">
-NAK</TT>
- if an error occurred, or
+CLASS="LITERAL"
+>NAK</TT
+> if an error occurred, or
 if a peripheral is currently unable to process another packet from the
 host, or has no packet to send to the host. There is a third form of
 handshake, a <TT
-CLASS="LITERAL">
-STALL</TT>
-, which indicates that the
+CLASS="LITERAL"
+>STALL</TT
+>, which indicates that the
 endpoint is currently <I
-CLASS="EMPHASIS">
-halted</I>
-.</P>
-<P>
-When an endpoint is halted it means that the host-side code needs to
+CLASS="EMPHASIS"
+>halted</I
+>.</P
+><P
+>When an endpoint is halted it means that the host-side code needs to
 take some sort of recovery action before communication over that
 endpoint can resume. The exact circumstances under which this can
 happen are not defined by the USB specification, but one example would
@@ -198,109 +203,110 @@ endpoint. There are USB-specific functio
 the peripheral to achieve the same effect. Once an endpoint has been
 halted the host can then interact with the peripheral using class or
 vendor control messages to perform appropriate recovery, and then the
-halted condition can be cleared.</P>
-<P>
-Halting an endpoint does not constitute a device state change, and
+halted condition can be cleared.</P
+><P
+>Halting an endpoint does not constitute a device state change, and
 there is no mechanism by which higher-level code can be informed
 immediately. However, any ongoing receive or transmit operations will
 be aborted with an <TT
-CLASS="LITERAL">
--EAGAIN</TT>
- error, and any new
-receives or transmits will fail immediately with the same error.</P>
-<P>
-There are six functions to support halted endpoints, one set for
+CLASS="LITERAL"
+>-EAGAIN</TT
+> error, and any new
+receives or transmits will fail immediately with the same error.</P
+><P
+>There are six functions to support halted endpoints, one set for
 receive endpoints and another for transmit endpoints, with both sets
 behaving in essentially the same way. The first,
 <TT
-CLASS="FUNCTION">
-usbs_rx_endpoint_halted</TT>
-, can be used to determine
+CLASS="FUNCTION"
+>usbs_rx_endpoint_halted</TT
+>, can be used to determine
 whether or not an endpoint is currently halted: it takes a single
 argument that identifies the endpoint of interest. The second
 function, <TT
-CLASS="FUNCTION">
-usbs_set_rx_endpoint_halted</TT>
-, can be
+CLASS="FUNCTION"
+>usbs_set_rx_endpoint_halted</TT
+>, can be
 used to change the halted condition of an endpoint: it takes two
 arguments; one to identify the endpoint and another to specify the new
 state. The last function
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_endpoint_wait</TT>
- operates in much the
+CLASS="FUNCTION"
+>usbs_start_rx_endpoint_wait</TT
+> operates in much the
 same way as <TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
-: when the
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+>: when the
 endpoint is no longer halted the device driver will invoke the
 supplied completion function with a status of 0. The completion
 function has the same signature as that for a transfer operation.
 Often it will be possible to use a single completion function and have
 the foreground code invoke either
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- or
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> or
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_endpoint_wait</TT>
- depending on the
-current state of the endpoint.</P>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+CLASS="FUNCTION"
+>usbs_start_rx_endpoint_wait</TT
+> depending on the
+current state of the endpoint.</P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-start-tx.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-start-tx.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-control.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-control.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Sending Data to the Host</TD>
-<TD
+VALIGN="top"
+>Sending Data to the Host</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Control Endpoints</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Control Endpoints</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-intro.html
+++ b/packages/io/usb/slave/current/doc/usbs-intro.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Introduction</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Introduction</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,84 +26,84 @@ TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
 REL="NEXT"
 TITLE="USB Enumeration Data"
-HREF="usbs-enum.html"></HEAD>
-<BODY
+HREF="usbs-enum.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="io-usb-slave.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="io-usb-slave.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-enum.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-enum.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-INTRO">
-Introduction</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN6">
-</A>
-<H2>
-Name</H2>
-Introduction&nbsp;--&nbsp;eCos support for USB slave devices</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN9">
-</A>
-<H2>
-Introduction</H2>
-<P>
-The eCos USB slave support allows developers to produce USB
-peripherals. It consists of a number of different eCos packages:</P>
-<P>
-</P>
-<OL
-TYPE="1">
-<LI>
-<P>
-Device drivers for specific implementations of USB slave hardware, for
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-INTRO"
+>Introduction</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN6"
+></A
+><H2
+>Name</H2
+>Introduction&nbsp;--&nbsp;eCos support for USB slave devices</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN9"
+></A
+><H2
+>Introduction</H2
+><P
+>The eCos USB slave support allows developers to produce USB
+peripherals. It consists of a number of different eCos packages:</P
+><P
+></P
+><OL
+TYPE="1"
+><LI
+><P
+>Device drivers for specific implementations of USB slave hardware, for
 example the on-chip USB Device Controller provided by the Intel SA1110
 processor. A typical USB peripheral will only provide one USB slave
 port and therefore only one such device driver package will be needed.
@@ -109,58 +111,58 @@ Usually the device driver package will b
 you create an eCos configuration for target hardware that has a USB
 slave device. If you select a target which does have a USB slave
 device but no USB device driver is loaded, this implies that no such
-device driver is currently available.</P>
-</LI>
-<LI>
-<P>
-The common USB slave package. This serves two purposes. It defines the
+device driver is currently available.</P
+></LI
+><LI
+><P
+>The common USB slave package. This serves two purposes. It defines the
 API that specific device drivers should implement. It also provides
 various utilities that will be needed by most USB device drivers and
 applications, such as handlers for standard control messages.
 Usually this package will be loaded automatically at the same time as
-the USB device driver.</P>
-</LI>
-<LI>
-<P>
-The common USB package. This merely provides some information common
+the USB device driver.</P
+></LI
+><LI
+><P
+>The common USB package. This merely provides some information common
 to both the host and slave sides of USB, such as details of the
 control protocol. It is also used to place the other USB-related
 packages appropriately in the overall configuration hierarchy. Usually
-this package will be loaded at the same time as the USB device driver.</P>
-</LI>
-<LI>
-<P>
-Class-specific USB support packages. These make it easier to develop
+this package will be loaded at the same time as the USB device driver.</P
+></LI
+><LI
+><P
+>Class-specific USB support packages. These make it easier to develop
 specific classes of USB peripheral, such as a USB-ethernet device. If
 no suitable package is available for a given class of peripheral then
 the USB device driver can instead be accessed directly from
 application code. Such packages will never be loaded automatically
 since the configuration system has no way of knowing what class of USB
 peripheral is being developed. Instead developers have to add the
-appropriate package or packages explicitly.</P>
-</LI>
-</OL>
-<P>
-These packages only provide support for developing USB peripherals,
-not USB hosts.</P>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN22">
-</A>
-<H2>
-USB Concepts</H2>
-<P>
-Information about USB can be obtained from a number of sources
+appropriate package or packages explicitly.</P
+></LI
+></OL
+><P
+>These packages only provide support for developing USB peripherals,
+not USB hosts.</P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN22"
+></A
+><H2
+>USB Concepts</H2
+><P
+>Information about USB can be obtained from a number of sources
 including the <A
 HREF="http://www.usb.org/"
-TARGET="_top">
-USB Implementers Forum
-web site</A>
-. Only a brief summary is provided here.</P>
-<P>
-A USB network is asymmetrical: it consists of a single host, one or
+TARGET="_top"
+>USB Implementers Forum
+web site</A
+>. Only a brief summary is provided here.</P
+><P
+>A USB network is asymmetrical: it consists of a single host, one or
 more slave devices, and possibly some number of intermediate hubs. The
 host side is significantly more complicated than the slave side.
 Essentially, all operations are initiated by the host. For example, if
@@ -172,9 +174,9 @@ token followed by the data; the peripher
 currently unable to receive more data or if there was corruption,
 otherwise it will return an ACK. All transfers are check-summed and
 there is a clearly-defined error recovery process. USB peripherals can
-only interact with the host, not with each other.</P>
-<P>
-USB supports four different types of communication: control messages,
+only interact with the host, not with each other.</P
+><P
+>USB supports four different types of communication: control messages,
 interrupt transfers, isochronous transfers, and bulk transfers.
 Control messages are further subdivided into four categories:
 standard, class, vendor and a reserved category. All USB peripherals
@@ -185,9 +187,9 @@ control messages may be handled by an cl
 package, for example the USB-ethernet package will handle control
 messages such as getting the MAC address or enabling/disabling
 promiscuous mode. Alternatively, some or all of these messages will
-have to be handled by application code.</P>
-<P>
-Interrupt transfers are used for devices which need to be polled
+have to be handled by application code.</P
+><P
+>Interrupt transfers are used for devices which need to be polled
 regularly. For example, a USB keyboard might be polled once every
 millisecond. The host will not poll the device more frequently than
 this, so interrupt transfers are best suited to peripherals that
@@ -200,9 +202,9 @@ particular packet is corrupted then it w
 software is expected to recover from this. Bulk transfers are used for
 everything else: after taking care of any pending control, isochronous
 and interrupt transfers the host will use whatever bandwidth remains
-for bulk transfers. Bulk transfers are reliable.</P>
-<P>
-Transfers are organized into USB packets, with the details depending
+for bulk transfers. Bulk transfers are reliable.</P
+><P
+>Transfers are organized into USB packets, with the details depending
 on the transfer type. Control messages always involve an initial
 8-byte packet from host to peripheral, optionally followed by some
 additional packets; in theory these additional packets can be up to 64
@@ -217,9 +219,9 @@ which typically will be generated by the
 pre-defined limit on the size of a bulk transfer. Instead higher-level
 protocols are expected to handle this, so for a USB-ethernet
 peripheral the protocol could impose a limit of 1514 bytes of data
-plus maybe some additional protocol overhead.</P>
-<P>
-Transfers from the host to a peripheral are addressed not just to that
+plus maybe some additional protocol overhead.</P
+><P
+>Transfers from the host to a peripheral are addressed not just to that
 peripheral but to a specific endpoint within that peripheral.
 Similarly, the host requests incoming data from a specific endpoint
 rather than from the peripheral as a whole. For example, a combined
@@ -229,23 +231,23 @@ up to 16 endpoints for incoming data and
 However, given the comparatively high speed of USB I/O this endpoint
 addressing is typically implemented in hardware rather than software,
 and the hardware will only implement a small number of endpoints.
-Endpoint 0 is generally used only for control messages.</P>
-<P>
-In practice, many of these details are irrelevant to application code
+Endpoint 0 is generally used only for control messages.</P
+><P
+>In practice, many of these details are irrelevant to application code
 or to class packages. Instead, such higher-level code usually just
 performs blocking <TT
-CLASS="FUNCTION">
-read</TT>
- and
+CLASS="FUNCTION"
+>read</TT
+> and
 <TT
-CLASS="FUNCTION">
-write</TT>
-, or non-blocking USB-specific calls, to
+CLASS="FUNCTION"
+>write</TT
+>, or non-blocking USB-specific calls, to
 transfer data between host and target via a specific endpoint. Control
 messages are more complicated but are usually handled by existing
-code.</P>
-<P>
-When a USB peripheral is plugged into the host there is an initial
+code.</P
+><P
+>When a USB peripheral is plugged into the host there is an initial
 enumeration and configuration process. The peripheral provides
 information such as its class of device (audio, video, etc.), a
 vendor id, which endpoints should be used for what kind of data, and
@@ -257,9 +259,9 @@ peripheral and perform additional applic
 For example for a USB-ethernet device this would involve obtaining an
 ethernet MAC address. Most USB peripherals will be fairly simple, but
 it is possible to build multifunction peripherals with multiple
-configurations, interfaces, and alternate interface settings.</P>
-<P>
-It is not possible for any of the eCos packages to generate all the
+configurations, interfaces, and alternate interface settings.</P
+><P
+>It is not possible for any of the eCos packages to generate all the
 enumeration data automatically. Some of the required information such
 as the vendor id cannot be supplied by generic packages; only by the
 application developer. Class support code such as the USB-ethernet
@@ -270,124 +272,124 @@ responsibility of the application develo
 enumeration data and perform some additional initialisation. In
 addition, the common USB slave package can handle all the standard
 control messages for a simple USB peripheral, but for something like a
-multifunction peripheral additional application support is needed.</P>
-<DIV
-CLASS="NOTE">
-<BLOCKQUOTE
-CLASS="NOTE">
-<P>
-<B>
-Note: </B>
-The initial implementation of the eCos USB slave packages involved
+multifunction peripheral additional application support is needed.</P
+><DIV
+CLASS="NOTE"
+><BLOCKQUOTE
+CLASS="NOTE"
+><P
+><B
+>Note: </B
+>The initial implementation of the eCos USB slave packages involved
 hardware that only supported control and bulk transfers, not
 isochronous or interrupt. There may be future changes to the USB
 code and API to allow for isochronous and interrupt transfers,
 especially the former. Other changes may be required to support
 different USB devices. At present there is no support for USB remote
-wakeups, since again it is not supported by the hardware.</P>
-</BLOCKQUOTE>
-</DIV>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN38">
-</A>
-<H2>
-eCos USB I/O Facilities</H2>
-<P>
-For protocols other than control messages, eCos provides two ways of
+wakeups, since again it is not supported by the hardware.</P
+></BLOCKQUOTE
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN38"
+></A
+><H2
+>eCos USB I/O Facilities</H2
+><P
+>For protocols other than control messages, eCos provides two ways of
 performing USB I/O. The first involves device table or devtab entries such
 as <A
-HREF="usbs-devtab.html">
-<TT
-CLASS="LITERAL">
-/dev/usb1r</TT>
-</A>
-,
+HREF="usbs-devtab.html"
+><TT
+CLASS="LITERAL"
+>/dev/usb1r</TT
+></A
+>,
 with one entry per endpoint per USB device. It is possible to
 <TT
-CLASS="FUNCTION">
-open</TT>
- these devices and use conventional blocking
+CLASS="FUNCTION"
+>open</TT
+> these devices and use conventional blocking
 I/O functions such as <TT
-CLASS="FUNCTION">
-read</TT>
- and
+CLASS="FUNCTION"
+>read</TT
+> and
 <TT
-CLASS="FUNCTION">
-write</TT>
- to exchange data between host and
-peripheral.</P>
-<P>
-There is also a lower-level USB-specific API, consisting of functions
+CLASS="FUNCTION"
+>write</TT
+> to exchange data between host and
+peripheral.</P
+><P
+>There is also a lower-level USB-specific API, consisting of functions
 such as <A
-HREF="usbs-start-rx.html">
-<TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
-</A>
-.
+HREF="usbs-start-rx.html"
+><TT
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+></A
+>.
 A USB device driver will supply a data structure for each endpoint,
 for example a <A
-HREF="usbs-data.html">
-<SPAN
-CLASS="STRUCTNAME">
-usbs_rx_endpoint</SPAN>
-</A>
-
+HREF="usbs-data.html"
+><SPAN
+CLASS="STRUCTNAME"
+>usbs_rx_endpoint</SPAN
+></A
+>
 structure for every receive endpoint. The first argument to
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- should be a pointer to such
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> should be a pointer to such
 a data structure. The USB-specific API is non-blocking: the initial
 call merely starts the transfer; some time later, once the transfer
 has completed or has been aborted, the device driver will invoke a
-completion function.</P>
-<P>
-Control messages are different. With four different categories of
+completion function.</P
+><P
+>Control messages are different. With four different categories of
 control messages including application and vendor specific ones, the
 conventional
 <TT
-CLASS="FUNCTION">
-open</TT>
-/<TT
-CLASS="FUNCTION">
-read</TT>
-/<TT
-CLASS="FUNCTION">
-write</TT>
-
+CLASS="FUNCTION"
+>open</TT
+>/<TT
+CLASS="FUNCTION"
+>read</TT
+>/<TT
+CLASS="FUNCTION"
+>write</TT
+>
 model of I/O cannot easily be applied. Instead, a USB device driver
 will supply a <A
-HREF="usbs-control.html">
-<SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
-</A>
-
+HREF="usbs-control.html"
+><SPAN
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+></A
+>
 data structure which can be manipulated appropriately. In practice the
 standard control messages will usually be handled by the common USB
 slave package, and other control messages will be handled by
 class-specific code such as the USB-ethernet package. Typically,
 application code remains responsible for supplying the <A
-HREF="usbs-enum.html">
-enumeration data</A>
- and for actually <A
-HREF="usbs-start.html">
-starting</A>
- up the USB device.</P>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN60">
-</A>
-<H2>
-Enabling the USB code</H2>
-<P>
-If the target hardware contains a USB slave device then the
+HREF="usbs-enum.html"
+>enumeration data</A
+> and for actually <A
+HREF="usbs-start.html"
+>starting</A
+> up the USB device.</P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN60"
+></A
+><H2
+>Enabling the USB code</H2
+><P
+>If the target hardware contains a USB slave device then the
 appropriate USB device driver and the common packages will typically
 be loaded into the configuration automatically when that target is
 selected (assuming a suitable device driver exists). However, the
@@ -395,9 +397,9 @@ driver will not necessarily be active. F
 have an on-chip USB device, but not all applications using that
 processor will want to use USB functionality. Hence by default the USB
 device is disabled, ensuring that applications do not suffer any
-memory or other penalties for functionality that is not required.</P>
-<P>
-If the application developer explicitly adds a class support package
+memory or other penalties for functionality that is not required.</P
+><P
+>If the application developer explicitly adds a class support package
 such as the USB-ethernet one then this implies that the USB device is
 actually needed, and the device will be enabled automatically.
 However, if no suitable class package is available and the USB device
@@ -405,66 +407,67 @@ will instead be accessed by application 
 enable the USB device manually. Usually the easiest way to do this is
 to enable the configuration option
 <TT
-CLASS="LITERAL">
-CYGGLO_IO_USB_SLAVE_APPLICATION</TT>
-, and the USB device
+CLASS="LITERAL"
+>CYGGLO_IO_USB_SLAVE_APPLICATION</TT
+>, and the USB device
 driver and related packages will adjust accordingly. Alternatively,
 the device driver may provide some configuration options to provide
-more fine-grained control.</P>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+more fine-grained control.</P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-enum.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-enum.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-eCos USB Slave Support</TD>
-<TD
+VALIGN="top"
+>eCos USB Slave Support</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-USB Enumeration Data</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>USB Enumeration Data</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-start-rx.html
+++ b/packages/io/usb/slave/current/doc/usbs-start-rx.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Receiving Data from the Host</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Receiving Data from the Host</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,178 +26,181 @@ TITLE="Devtab Entries"
 HREF="usbs-devtab.html"><LINK
 REL="NEXT"
 TITLE="Sending Data to the Host"
-HREF="usbs-start-tx.html"></HEAD>
-<BODY
+HREF="usbs-start-tx.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-devtab.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-devtab.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-start-tx.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-start-tx.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-START-RX">
-Receiving Data from the Host</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN277">
-</A>
-<H2>
-Name</H2>
-<TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
-&nbsp;--&nbsp;Receiving Data from the Host</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN281">
-</A>
-<H2>
-Synopsis</H2>
-<DIV
-CLASS="FUNCSYNOPSIS">
-<P>
-</P>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-START-RX"
+>Receiving Data from the Host</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN277"
+></A
+><H2
+>Name</H2
+><TT
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+>&nbsp;--&nbsp;Receiving Data from the Host</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN281"
+></A
+><H2
+>Synopsis</H2
+><DIV
+CLASS="FUNCSYNOPSIS"
+><A
+NAME="AEN282"
+></A
+><P
+></P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="FUNCSYNOPSISINFO">
-#include &lt;cyg/io/usb/usbs.h&gt;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_start_rx_buffer</CODE>
-(usbs_rx_endpoint* ep, unsigned char* buffer, int length, void (*)(void*,int) complete_fn, void * complete_data);</CODE>
-</P>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_start_rx</CODE>
-(usbs_rx_endpoint* ep);</CODE>
-</P>
-<P>
-</P>
-</DIV>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN302">
-</A>
-<H2>
-<TT
-CLASS="FUNCTION">
-Description</TT>
-</H2>
-<P>
-<TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- is a USB-specific function
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="FUNCSYNOPSISINFO"
+>#include &lt;cyg/io/usb/usbs.h&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_start_rx_buffer</CODE
+>(usbs_rx_endpoint* ep, unsigned char* buffer, int length, void (*)(void*,int) complete_fn, void * complete_data);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_start_rx</CODE
+>(usbs_rx_endpoint* ep);</CODE
+></P
+><P
+></P
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN302"
+></A
+><H2
+><TT
+CLASS="FUNCTION"
+>Description</TT
+></H2
+><P
+><TT
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> is a USB-specific function
 to accept a transfer from host to peripheral. It can be used for bulk,
 interrupt or isochronous transfers, but not for control messages.
 Instead those involve manipulating the <A
-HREF="usbs-control.html">
-<SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
-</A>
-
-data structure directly. The function takes five arguments:</P>
-<P>
-</P>
-<OL
-TYPE="1">
-<LI>
-<P>
-The first argument identifies the specific endpoint that should be
+HREF="usbs-control.html"
+><SPAN
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+></A
+>
+data structure directly. The function takes five arguments:</P
+><P
+></P
+><OL
+TYPE="1"
+><LI
+><P
+>The first argument identifies the specific endpoint that should be
 used. Different USB devices will support different sets of endpoints
 and the device driver will provide appropriate data structures. The
 device driver's documentation should be consulted for details of which
-endpoints are available.</P>
-</LI>
-<LI>
-<P>
-The <TT
-CLASS="PARAMETER">
-<I>
-buffer</I>
-</TT>
- and <TT
-CLASS="PARAMETER">
-<I>
-length</I>
-</TT>
-
+endpoints are available.</P
+></LI
+><LI
+><P
+>The <TT
+CLASS="PARAMETER"
+><I
+>buffer</I
+></TT
+> and <TT
+CLASS="PARAMETER"
+><I
+>length</I
+></TT
+>
 arguments control the actual transfer. USB device drivers are not
 expected to perform any buffering or to support partial transfers, so
 the length specified should correspond to the maximum transfer that is
 currently possible and the buffer should be at least this large. For
 isochronous transfers the USB specification imposes an upper bound of
 1023 bytes, and a smaller limit may be set in the <A
-HREF="usbs-enum.html#AEN142">
-enumeration data</A>
-. Interrupt
+HREF="usbs-enum.html#AEN142"
+>enumeration data</A
+>. Interrupt
 transfers are similarly straightforward with an upper bound of 64
 bytes, or less as per the enumeration data. Bulk transfers are more
 complicated because they can involve multiple 64-byte packets plus a
 terminating packet of less than 64 bytes, so there is no predefined
 limit on the transfer size. Instead it is left to higher-level
-protocols to specify an appropriate upper bound.</P>
-<P>
-One technique that may work for bulk transfers is to exploit the fact
+protocols to specify an appropriate upper bound.</P
+><P
+>One technique that may work for bulk transfers is to exploit the fact
 that such transfers happen in 64-byte packets: it may be possible to
 receive an initial 64 bytes, corresponding to the first packet in the
 transfer; these 64 bytes can then be examined to determine the total
@@ -204,50 +209,50 @@ receive operation. This technique is not
 USB hardware. Also, if the delay between accepting the first packet and
 the remainder of the transfer is excessive then this could cause
 timeout problems for the host-side software. For these reasons this
-technique should be avoided.</P>
-</LI>
-<LI>
-<P>
-<TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- is non-blocking. It merely
+technique should be avoided.</P
+></LI
+><LI
+><P
+><TT
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> is non-blocking. It merely
 starts the receive operation, and does not wait for completion. At
 some later point the USB device driver will invoke the completion
 function parameter with two arguments: the completion data defined by
 the last parameter and a result field. A result &gt;=
 <TT
-CLASS="LITERAL">
-0</TT>
- indicates a successful transfer of that many
+CLASS="LITERAL"
+>0</TT
+> indicates a successful transfer of that many
 bytes, which may be less than the upper bound imposed by the
 <TT
-CLASS="PARAMETER">
-<I>
-length</I>
-</TT>
- argument. A result &lt;
+CLASS="PARAMETER"
+><I
+>length</I
+></TT
+> argument. A result &lt;
 <TT
-CLASS="LITERAL">
-0</TT>
- indicates an error. The most likely errors are
+CLASS="LITERAL"
+>0</TT
+> indicates an error. The most likely errors are
 <TT
-CLASS="LITERAL">
--EPIPE</TT>
- to indicate that the connection between the
+CLASS="LITERAL"
+>-EPIPE</TT
+> to indicate that the connection between the
 host and the target has been broken, and <TT
-CLASS="LITERAL">
--EAGAIN</TT>
-
+CLASS="LITERAL"
+>-EAGAIN</TT
+>
 for when the endpoint has been <A
-HREF="usbs-halt.html">
-halted</A>
-. Specific USB device drivers may
-specify additional error conditions.</P>
-</LI>
-</OL>
-<P>
-The normal sequence of events is that the USB device driver will
+HREF="usbs-halt.html"
+>halted</A
+>. Specific USB device drivers may
+specify additional error conditions.</P
+></LI
+></OL
+><P
+>The normal sequence of events is that the USB device driver will
 update the appropriate hardware registers. At some point after that
 the host will attempt to send data by transmitting an OUT token
 followed by a data packet, and since a receive operation is now in
@@ -261,66 +266,66 @@ multiple packets so the device driver ha
 was a full 64 bytes or whether it was a terminating packet of less
 than this. When the device driver DSR detects a complete transfer it
 will inform higher-level code by invoking the supplied completion
-function.</P>
-<P>
-This means that the completion function will normally be invoked by a
+function.</P
+><P
+>This means that the completion function will normally be invoked by a
 DSR and not in thread context - although some USB device drivers may
 have a different implementation. Therefore the completion function is
 restricted in what it can do. In particular it must not make any
 calls that will or may block such as locking a mutex or allocating
 memory. The kernel documentation should be consulted for more details
-of DSR's and interrupt handling generally.</P>
-<P>
-It is possible that the completion function will be invoked before
+of DSR's and interrupt handling generally.</P
+><P
+>It is possible that the completion function will be invoked before
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- returns. Such an event would
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> returns. Such an event would
 be unusual because the transfer cannot happen until the next time the
 host tries to send data to this peripheral, but it may happen if for
 example another interrupt happens and a higher priority thread is
 scheduled to run. Also, if the endpoint is currently halted then the
 completion function will be invoked immediately with
 <TT
-CLASS="LITERAL">
--EAGAIN</TT>
-: typically this will happen in the current
+CLASS="LITERAL"
+>-EAGAIN</TT
+>: typically this will happen in the current
 thread rather than in a separate DSR. The completion function is
 allowed to start another transfer immediately by calling
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- again.</P>
-<P>
-USB device drivers are not expected to perform any locking. It is the
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> again.</P
+><P
+>USB device drivers are not expected to perform any locking. It is the
 responsibility of higher-level code to ensure that there is only one
 receive operation for a given endpoint in progress at any one time. If
 there are concurrent calls to
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- then the resulting behaviour
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> then the resulting behaviour
 is undefined. For typical USB applications this does not present any
 problems, because only one piece of code will access a given endpoint
-at any particular time.</P>
-<P>
-The following code fragment illustrates a very simple use of
+at any particular time.</P
+><P
+>The following code fragment illustrates a very simple use of
 <TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
- to implement a blocking
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+> to implement a blocking
 receive, using a semaphore to synchronise between the foreground
 thread and the DSR. For a simple example like this no completion data
-is needed.</P>
-<TABLE
+is needed.</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-static int error_code = 0;
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>static int error_code = 0;
 static cyg_sem_t completion_wait;
 
 static void
@@ -337,102 +342,103 @@ blocking_receive(usbs_rx_endpoint* ep, u
     usbs_start_rx_buffer(ep, buf, len, &amp;completion_fn, NULL);
     cyg_semaphore_wait(&amp;completion_wait);
     return error_code;
-}</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-There is also a utility function <TT
-CLASS="FUNCTION">
-usbs_start_rx</TT>
-. This
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>There is also a utility function <TT
+CLASS="FUNCTION"
+>usbs_start_rx</TT
+>. This
 can be used by code that wants to manipulate <A
-HREF="usbs-data.html">
-data endpoints</A>
- directly, specifically the
+HREF="usbs-data.html"
+>data endpoints</A
+> directly, specifically the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_fn</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>complete_fn</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_data</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>complete_data</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- fields.
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> fields.
 <TT
-CLASS="FUNCTION">
-usbs_start_tx</TT>
- just invokes a function
-supplied by the device driver.</P>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+CLASS="FUNCTION"
+>usbs_start_tx</TT
+> just invokes a function
+supplied by the device driver.</P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-devtab.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-devtab.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-start-tx.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-start-tx.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Devtab Entries</TD>
-<TD
+VALIGN="top"
+>Devtab Entries</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Sending Data to the Host</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Sending Data to the Host</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-start-tx.html
+++ b/packages/io/usb/slave/current/doc/usbs-start-tx.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Sending Data to the Host</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Sending Data to the Host</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,161 +26,164 @@ TITLE="Receiving Data from the Host"
 HREF="usbs-start-rx.html"><LINK
 REL="NEXT"
 TITLE="Halted Endpoints"
-HREF="usbs-halt.html"></HEAD>
-<BODY
+HREF="usbs-halt.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-start-rx.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-start-rx.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-halt.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-halt.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-START-TX">
-Sending Data to the Host</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN349">
-</A>
-<H2>
-Name</H2>
-<TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
-&nbsp;--&nbsp;Sending Data to the Host</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN353">
-</A>
-<H2>
-Synopsis</H2>
-<DIV
-CLASS="FUNCSYNOPSIS">
-<P>
-</P>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-START-TX"
+>Sending Data to the Host</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN349"
+></A
+><H2
+>Name</H2
+><TT
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+>&nbsp;--&nbsp;Sending Data to the Host</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN353"
+></A
+><H2
+>Synopsis</H2
+><DIV
+CLASS="FUNCSYNOPSIS"
+><A
+NAME="AEN354"
+></A
+><P
+></P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="FUNCSYNOPSISINFO">
-#include &lt;cyg/io/usb/usbs.h&gt;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_start_tx_buffer</CODE>
-(usbs_tx_endpoint* ep, const unsigned char* buffer, int length, void (*)(void*,int) complete_fn, void * complete_data);</CODE>
-</P>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_start_tx</CODE>
-(usbs_tx_endpoint* ep);</CODE>
-</P>
-<P>
-</P>
-</DIV>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN374">
-</A>
-<H2>
-<TT
-CLASS="FUNCTION">
-Description</TT>
-</H2>
-<P>
-<TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
- is a USB-specific function
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="FUNCSYNOPSISINFO"
+>#include &lt;cyg/io/usb/usbs.h&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_start_tx_buffer</CODE
+>(usbs_tx_endpoint* ep, const unsigned char* buffer, int length, void (*)(void*,int) complete_fn, void * complete_data);</CODE
+></P
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_start_tx</CODE
+>(usbs_tx_endpoint* ep);</CODE
+></P
+><P
+></P
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN374"
+></A
+><H2
+><TT
+CLASS="FUNCTION"
+>Description</TT
+></H2
+><P
+><TT
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+> is a USB-specific function
 to transfer data from peripheral to host. It can be used for bulk,
 interrupt or isochronous transfers, but not for control messages;
 instead those involve manipulating the <A
-HREF="usbs-control.html">
-<SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
-</A>
-
-data structure directly. The function takes five arguments:</P>
-<P>
-</P>
-<OL
-TYPE="1">
-<LI>
-<P>
-The first argument identifies the specific endpoint that should be
+HREF="usbs-control.html"
+><SPAN
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+></A
+>
+data structure directly. The function takes five arguments:</P
+><P
+></P
+><OL
+TYPE="1"
+><LI
+><P
+>The first argument identifies the specific endpoint that should be
 used. Different USB devices will support different sets of endpoints
 and the device driver will provide appropriate data structures. The
 device driver's documentation should be consulted for details of which
-endpoints are available.</P>
-</LI>
-<LI>
-<P>
-The <TT
-CLASS="PARAMETER">
-<I>
-buffer</I>
-</TT>
- and <TT
-CLASS="PARAMETER">
-<I>
-length</I>
-</TT>
-
+endpoints are available.</P
+></LI
+><LI
+><P
+>The <TT
+CLASS="PARAMETER"
+><I
+>buffer</I
+></TT
+> and <TT
+CLASS="PARAMETER"
+><I
+>length</I
+></TT
+>
 arguments control the actual transfer. USB device drivers are not
 allowed to modify the buffer during the transfer, so the data can
 reside in read-only memory. The transfer will be for all the data
@@ -186,9 +191,9 @@ specified, and it is the responsibility 
 sure that the host is expecting this amount of data. For isochronous
 transfers the USB specification imposes an upper bound of 1023 bytes,
 but a smaller limit may be set in the <A
-HREF="usbs-enum.html#AEN142">
-enumeration data</A>
-. Interrupt
+HREF="usbs-enum.html#AEN142"
+>enumeration data</A
+>. Interrupt
 transfers have an upper bound of 64 bytes or less, as per the
 enumeration data. Bulk transfers are more complicated because they can
 involve multiple 64-byte packets plus a terminating packet of less
@@ -197,51 +202,51 @@ limit on the total transfer size. Instea
 protocols to specify an appropriate upper bound. If the peripheral
 attempts to send more data than the host is willing to accept then the
 resulting behaviour is undefined and may well depend on the specific
-host operating system being used.</P>
-<P>
-For bulk transfers, the USB device driver or the underlying hardware
+host operating system being used.</P
+><P
+>For bulk transfers, the USB device driver or the underlying hardware
 will automatically split the transfer up into the appropriate number
 of full-size 64-byte packets plus a single terminating packet, which
-may be 0 bytes.</P>
-</LI>
-<LI>
-<P>
-<TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
- is non-blocking. It merely
+may be 0 bytes.</P
+></LI
+><LI
+><P
+><TT
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+> is non-blocking. It merely
 starts the transmit operation, and does not wait for completion. At
 some later point the USB device driver will invoke the completion
 function parameter with two arguments: the completion data defined by
 the last parameter, and a result field. This result will be either an
 error code &lt; <TT
-CLASS="LITERAL">
-0</TT>
-, or the amount of data
+CLASS="LITERAL"
+>0</TT
+>, or the amount of data
 transferred which should correspond to the
 <TT
-CLASS="PARAMETER">
-<I>
-length</I>
-</TT>
- argument. The most likely errors are
+CLASS="PARAMETER"
+><I
+>length</I
+></TT
+> argument. The most likely errors are
 <TT
-CLASS="LITERAL">
--EPIPE</TT>
- to indicate that the connection between the
+CLASS="LITERAL"
+>-EPIPE</TT
+> to indicate that the connection between the
 host and the target has been broken, and <TT
-CLASS="LITERAL">
--EAGAIN</TT>
-
+CLASS="LITERAL"
+>-EAGAIN</TT
+>
 for when the endpoint has been <A
-HREF="usbs-halt.html">
-halted</A>
-. Specific USB device drivers may
-define additional error conditions.</P>
-</LI>
-</OL>
-<P>
-The normal sequence of events is that the USB device driver will
+HREF="usbs-halt.html"
+>halted</A
+>. Specific USB device drivers may
+define additional error conditions.</P
+></LI
+></OL
+><P
+>The normal sequence of events is that the USB device driver will
 update the appropriate hardware registers. At some point after that
 the host will attempt to fetch data by transmitting an IN token. Since
 a transmit operation is now in progress the peripheral can send a
@@ -253,66 +258,66 @@ transfers may involve multiple packets s
 check whether there is more data to send and set things up for the
 next packet. When the device driver DSR detects a complete transfer it
 will inform higher-level code by invoking the supplied completion
-function.</P>
-<P>
-This means that the completion function will normally be invoked by a
+function.</P
+><P
+>This means that the completion function will normally be invoked by a
 DSR and not in thread context - although some USB device drivers may
 have a different implementation. Therefore the completion function is
 restricted in what it can do, in particular it must not make any
 calls that will or may block such as locking a mutex or allocating
 memory. The kernel documentation should be consulted for more details
-of DSR's and interrupt handling generally.</P>
-<P>
-It is possible that the completion function will be invoked before
+of DSR's and interrupt handling generally.</P
+><P
+>It is possible that the completion function will be invoked before
 <TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
- returns. Such an event would
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+> returns. Such an event would
 be unusual because the transfer cannot happen until the next time the
 host tries to fetch data from this peripheral, but it may happen if,
 for example, another interrupt happens and a higher priority thread is
 scheduled to run. Also, if the endpoint is currently halted then the
 completion function will be invoked immediately with
 <TT
-CLASS="LITERAL">
--EAGAIN</TT>
-: typically this will happen in the current
+CLASS="LITERAL"
+>-EAGAIN</TT
+>: typically this will happen in the current
 thread rather than in a separate DSR. The completion function is
 allowed to start another transfer immediately by calling
 <TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
- again.</P>
-<P>
-USB device drivers are not expected to perform any locking. It is the
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+> again.</P
+><P
+>USB device drivers are not expected to perform any locking. It is the
 responsibility of higher-level code to ensure that there is only one
 transmit operation for a given endpoint in progress at any one time.
 If there are concurrent calls to
 <TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
- then the resulting behaviour
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+> then the resulting behaviour
 is undefined. For typical USB applications this does not present any
 problems because only piece of code will access a given endpoint at
-any particular time.</P>
-<P>
-The following code fragment illustrates a very simple use of
+any particular time.</P
+><P
+>The following code fragment illustrates a very simple use of
 <TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
- to implement a blocking
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+> to implement a blocking
 transmit, using a semaphore to synchronise between the foreground
 thread and the DSR. For a simple example like this no completion data
-is needed.</P>
-<TABLE
+is needed.</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-static int error_code = 0;
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>static int error_code = 0;
 static cyg_sem_t completion_wait;
 
 static void
@@ -329,102 +334,103 @@ blocking_transmit(usbs_tx_endpoint* ep, 
     usbs_start_tx_buffer(ep, buf, len, &amp;completion_fn, NULL);
     cyg_semaphore_wait(&amp;completion_wait);
     return error_code;
-}</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-There is also a utility function <TT
-CLASS="FUNCTION">
-usbs_start</TT>
-. This
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>There is also a utility function <TT
+CLASS="FUNCTION"
+>usbs_start</TT
+>. This
 can be used by code that wants to manipulate <A
-HREF="usbs-data.html">
-data endpoints</A>
- directly, specifically the
+HREF="usbs-data.html"
+>data endpoints</A
+> directly, specifically the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_fn</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>complete_fn</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_data</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>complete_data</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
- fields.
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+> fields.
 <TT
-CLASS="FUNCTION">
-usbs_start_tx</TT>
- just calls a function supplied by
-the device driver.</P>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+CLASS="FUNCTION"
+>usbs_start_tx</TT
+> just calls a function supplied by
+the device driver.</P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-start-rx.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-start-rx.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-halt.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-halt.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Receiving Data from the Host</TD>
-<TD
+VALIGN="top"
+>Receiving Data from the Host</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Halted Endpoints</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Halted Endpoints</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-start.html
+++ b/packages/io/usb/slave/current/doc/usbs-start.html
@@ -2,20 +2,22 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Starting up a USB Device</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Starting up a USB Device</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
@@ -24,132 +26,135 @@ TITLE="USB Enumeration Data"
 HREF="usbs-enum.html"><LINK
 REL="NEXT"
 TITLE="Devtab Entries"
-HREF="usbs-devtab.html"></HEAD>
-<BODY
+HREF="usbs-devtab.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-enum.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-enum.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-<A
-HREF="usbs-devtab.html">
-Next</A>
-</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+><A
+HREF="usbs-devtab.html"
+>Next</A
+></TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-START">
-Starting up a USB Device</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN173">
-</A>
-<H2>
-Name</H2>
-<TT
-CLASS="FUNCTION">
-usbs_start</TT>
-&nbsp;--&nbsp;Starting up a USB Device</DIV>
-<DIV
-CLASS="REFSYNOPSISDIV">
-<A
-NAME="AEN177">
-</A>
-<H2>
-Synopsis</H2>
-<DIV
-CLASS="FUNCSYNOPSIS">
-<P>
-</P>
-<TABLE
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-START"
+>Starting up a USB Device</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN173"
+></A
+><H2
+>Name</H2
+><TT
+CLASS="FUNCTION"
+>usbs_start</TT
+>&nbsp;--&nbsp;Starting up a USB Device</DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN177"
+></A
+><H2
+>Synopsis</H2
+><DIV
+CLASS="FUNCSYNOPSIS"
+><A
+NAME="AEN178"
+></A
+><P
+></P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="FUNCSYNOPSISINFO">
-#include &lt;cyg/io/usb/usbs.h&gt;</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-<CODE>
-<CODE
-CLASS="FUNCDEF">
-void usbs_start</CODE>
-(usbs_control_endpoint* ep0);</CODE>
-</P>
-<P>
-</P>
-</DIV>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN185">
-</A>
-<H2>
-Description</H2>
-<P>
-Initializing a USB device requires some support from higher-level
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="FUNCSYNOPSISINFO"
+>#include &lt;cyg/io/usb/usbs.h&gt;</PRE
+></TD
+></TR
+></TABLE
+><P
+><CODE
+><CODE
+CLASS="FUNCDEF"
+>void usbs_start</CODE
+>(usbs_control_endpoint* ep0);</CODE
+></P
+><P
+></P
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN185"
+></A
+><H2
+>Description</H2
+><P
+>Initializing a USB device requires some support from higher-level
 code, typically the application, in the form of enumeration data.
 Hence it is not possible for the low-level USB driver to activate a
 USB device itself. Instead the higher-level code has to take care of
 this by invoking <TT
-CLASS="FUNCTION">
-usbs_start</TT>
-. This function takes
+CLASS="FUNCTION"
+>usbs_start</TT
+>. This function takes
 a pointer to a USB control endpoint data structure. USB device drivers
 should provide exactly one such data structure for every USB device,
-so the pointer uniquely identifies the device.</P>
-<TABLE
+so the pointer uniquely identifies the device.</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-const usbs_enumeration_data usb_enum_data = {
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>const usbs_enumeration_data usb_enum_data = {
     &#8230;
 };
 
@@ -160,99 +165,100 @@ main(int argc, char** argv)
     &#8230;
     usbs_start(&amp;usbs_sa11x0_ep0);
     &#8230;
-}</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-The exact behaviour of <TT
-CLASS="FUNCTION">
-usbs_start</TT>
- depends on the
+}</PRE
+></TD
+></TR
+></TABLE
+><P
+>The exact behaviour of <TT
+CLASS="FUNCTION"
+>usbs_start</TT
+> depends on the
 USB hardware and the device driver. A typical implementation would
 change the USB data pins from tristated to active. If the peripheral
 is already plugged into a host then the latter should detect this
 change and start interacting with the peripheral, including requesting
 the enumeration data. Some of this may happen before
 <TT
-CLASS="FUNCTION">
-usbs_start</TT>
- returns, but given that multiple
+CLASS="FUNCTION"
+>usbs_start</TT
+> returns, but given that multiple
 interactions between USB host and peripheral are required it is likely
 that the function will return before the peripheral is fully
 configured. Control endpoints provide a <A
-HREF="usbs-control.html#AEN515">
-mechanism</A>
- for informing
+HREF="usbs-control.html#AEN515"
+>mechanism</A
+> for informing
 higher-level code of USB state changes.
 <TT
-CLASS="FUNCTION">
-usbs_start</TT>
- will return even if the peripheral is
+CLASS="FUNCTION"
+>usbs_start</TT
+> will return even if the peripheral is
 not currently connected to a host: it will not block until the
-connection is established.</P>
-<P>
-<TT
-CLASS="FUNCTION">
-usbs_start</TT>
- should only be called once for a given
+connection is established.</P
+><P
+><TT
+CLASS="FUNCTION"
+>usbs_start</TT
+> should only be called once for a given
 USB device. There are no defined error conditions. Note that the
 function affects the entire USB device and not just the control
-endpoint: there is no need to start any data endpoints as well.</P>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+endpoint: there is no need to start any data endpoints as well.</P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-enum.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-enum.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-<A
-HREF="usbs-devtab.html">
-Next</A>
-</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-devtab.html"
+>Next</A
+></TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-USB Enumeration Data</TD>
-<TD
+VALIGN="top"
+>USB Enumeration Data</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-Devtab Entries</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>Devtab Entries</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs-writing.html
+++ b/packages/io/usb/slave/current/doc/usbs-writing.html
@@ -2,102 +2,104 @@
 <!-- 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/)                            -->
+<!-- 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 obtained from the copyright holder                   -->
-<HTML>
-<HEAD>
-<TITLE>
-Writing a USB Device Driver</TITLE>
+<!-- permission is obtained from the copyright holder.               -->
+<HTML
+><HEAD
+><TITLE
+>Writing a USB Device Driver</TITLE
+><meta name="MSSmartTagsPreventParsing" content="TRUE">
 <META
 NAME="GENERATOR"
-CONTENT="Modular DocBook HTML Stylesheet Version 1.54"><LINK
+CONTENT="Modular DocBook HTML Stylesheet Version 1.64
+"><LINK
 REL="HOME"
 TITLE="eCos USB Slave Support"
 HREF="io-usb-slave.html"><LINK
 REL="PREVIOUS"
 TITLE="Data Endpoints"
-HREF="usbs-data.html"></HEAD>
-<BODY
+HREF="usbs-data.html"></HEAD
+><BODY
 CLASS="REFENTRY"
 BGCOLOR="#FFFFFF"
 TEXT="#000000"
 LINK="#0000FF"
 VLINK="#840084"
-ALINK="#0000FF">
-<DIV
-CLASS="NAVHEADER">
-<TABLE
+ALINK="#0000FF"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TH
+CELLSPACING="0"
+><TR
+><TH
 COLSPAN="3"
-ALIGN="center">
-eCos USB Slave Support</TH>
-</TR>
-<TR>
-<TD
+ALIGN="center"
+>eCos USB Slave Support</TH
+></TR
+><TR
+><TD
 WIDTH="10%"
 ALIGN="left"
-VALIGN="bottom">
-<A
-HREF="usbs-data.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="bottom"
+><A
+HREF="usbs-data.html"
+>Prev</A
+></TD
+><TD
 WIDTH="80%"
 ALIGN="center"
-VALIGN="bottom">
-</TD>
-<TD
+VALIGN="bottom"
+></TD
+><TD
 WIDTH="10%"
 ALIGN="right"
-VALIGN="bottom">
-&nbsp;</TD>
-</TR>
-</TABLE>
-<HR
+VALIGN="bottom"
+>&nbsp;</TD
+></TR
+></TABLE
+><HR
 ALIGN="LEFT"
-WIDTH="100%"></DIV>
-<H1>
-<A
-NAME="USBS-WRITING">
-Writing a USB Device Driver</A>
-</H1>
-<DIV
-CLASS="REFNAMEDIV">
-<A
-NAME="AEN668">
-</A>
-<H2>
-Name</H2>
-Writing a USB Device Driver&nbsp;--&nbsp;USB Device Driver Porting Guide</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN671">
-</A>
-<H2>
-Introduction</H2>
-<P>
-Often the best way to write a USB device driver will be to start with
+WIDTH="100%"></DIV
+><H1
+><A
+NAME="USBS-WRITING"
+>Writing a USB Device Driver</A
+></H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN668"
+></A
+><H2
+>Name</H2
+>Writing a USB Device Driver&nbsp;--&nbsp;USB Device Driver Porting Guide</DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN671"
+></A
+><H2
+>Introduction</H2
+><P
+>Often the best way to write a USB device driver will be to start with
 an existing one and modify it as necessary. The information given here
-is intended primarily as an outline rather than as a complete guide.</P>
-<DIV
-CLASS="NOTE">
-<BLOCKQUOTE
-CLASS="NOTE">
-<P>
-<B>
-Note: </B>
-At the time of writing only one USB device driver has been
+is intended primarily as an outline rather than as a complete guide.</P
+><DIV
+CLASS="NOTE"
+><BLOCKQUOTE
+CLASS="NOTE"
+><P
+><B
+>Note: </B
+>At the time of writing only one USB device driver has been
 implemented. Hence it is possible, perhaps probable, that some
 portability issues have not yet been addressed. One issue
 involves the different types of transfer, for example the initial
@@ -107,25 +109,25 @@ types. Another issue would be hardware w
 say endpoint 1, could be used for either receiving or transmitting
 data, but not both because a single fifo is used. Issues like these
 will have to be resolved as and when additional USB device drivers are
-written.</P>
-</BLOCKQUOTE>
-</DIV>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN676">
-</A>
-<H2>
-The Control Endpoint</H2>
-<P>
-A USB device driver should provide a single <A
-HREF="usbs-control.html">
-<SPAN
-CLASS="STRUCTNAME">
-usbs_control_endpoint</SPAN>
-</A>
-
+written.</P
+></BLOCKQUOTE
+></DIV
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN676"
+></A
+><H2
+>The Control Endpoint</H2
+><P
+>A USB device driver should provide a single <A
+HREF="usbs-control.html"
+><SPAN
+CLASS="STRUCTNAME"
+>usbs_control_endpoint</SPAN
+></A
+>
 data structure for every USB device. Typical peripherals will have
 only one USB port so there will be just one such data structure in the
 entire system, but theoretically it is possible to have multiple USB
@@ -133,103 +135,103 @@ devices. These may all involve the same 
 device driver should support multiple device instances, or they may
 involve different chips. The name or names of these data structures
 are determined by the device driver, but appropriate care should be
-taken to avoid name clashes. </P>
-<P>
-A USB device cannot be used unless the control endpoint data structure
+taken to avoid name clashes. </P
+><P
+>A USB device cannot be used unless the control endpoint data structure
 exists. However, the presence of USB hardware in the target processor
 or board does not guarantee that the application will necessarily want
 to use that hardware. To avoid unwanted code or data overheads, the
 device driver can provide a configuration option to determine whether
 or not the endpoint 0 data structure is actually provided. A default
 value of <TT
-CLASS="LITERAL">
-CYGINT_IO_USB_SLAVE_CLIENTS</TT>
- ensures that
+CLASS="LITERAL"
+>CYGINT_IO_USB_SLAVE_CLIENTS</TT
+> ensures that
 the USB driver will be enabled automatically if higher-level code does
-require USB support, while leaving ultimate control to the user.</P>
-<P>
-The USB device driver is responsible for filling in the
+require USB support, while leaving ultimate control to the user.</P
+><P
+>The USB device driver is responsible for filling in the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-start_fn</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>start_fn</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-poll_fn</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>poll_fn</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-interrupt_vector</I>
-</TT>
- fields. Usually this can
+CLASS="STRUCTFIELD"
+><I
+>interrupt_vector</I
+></TT
+> fields. Usually this can
 be achieved by static initialization. The driver is also largely
 responsible for maintaining the <TT
-CLASS="STRUCTFIELD">
-<I>
-state</I>
-</TT>
-
+CLASS="STRUCTFIELD"
+><I
+>state</I
+></TT
+>
 field. The <TT
-CLASS="STRUCTFIELD">
-<I>
-control_buffer</I>
-</TT>
- array should be
+CLASS="STRUCTFIELD"
+><I
+>control_buffer</I
+></TT
+> array should be
 used to hold the first packet of a control message. The
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
- and other fields related to data
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+> and other fields related to data
 transfers will be managed <A
-HREF="usbs-control.html#AEN578">
-jointly</A>
- by higher-level code and
+HREF="usbs-control.html#AEN578"
+>jointly</A
+> by higher-level code and
 the device driver. The remaining fields are generally filled in by
 higher-level code, although the driver should initialize them to NULL
-values.</P>
-<P>
-Hardware permitting, the USB device should be inactive until the
+values.</P
+><P
+>Hardware permitting, the USB device should be inactive until the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-start_fn</I>
-</TT>
- is invoked, for example by
+CLASS="STRUCTFIELD"
+><I
+>start_fn</I
+></TT
+> is invoked, for example by
 tristating the appropriate pins. This prevents the host from
 interacting with the peripheral before all other parts of the system
 have initialized. It is expected that the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-start_fn</I>
-</TT>
- will only be invoked once, shortly
-after power-up.</P>
-<P>
-Where possible the device driver should detect state changes, such as
+CLASS="STRUCTFIELD"
+><I
+>start_fn</I
+></TT
+> will only be invoked once, shortly
+after power-up.</P
+><P
+>Where possible the device driver should detect state changes, such as
 when the connection between host and peripheral is established, and
 <A
-HREF="usbs-control.html#AEN515">
-report</A>
- these to higher-level
+HREF="usbs-control.html#AEN515"
+>report</A
+> these to higher-level
 code via the <TT
-CLASS="STRUCTFIELD">
-<I>
-state_change_fn</I>
-</TT>
- callback, if
+CLASS="STRUCTFIELD"
+><I
+>state_change_fn</I
+></TT
+> callback, if
 any. The state change to and from configured state cannot easily be
 handled by the device driver itself, instead higher-level code such as
-the common USB slave package will take care of this.</P>
-<P>
-Once the connection between host and peripheral has been established,
+the common USB slave package will take care of this.</P
+><P
+>Once the connection between host and peripheral has been established,
 the peripheral must be ready to accept control messages at all times,
 and must respond to these within certain time constraints. For
 example, the standard set-address control message must be handled
@@ -238,134 +240,134 @@ constraints. The device driver is respon
 initial packet of a control message. This packet will always be eight
 bytes and should be stored in the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-control_buffer</I>
-</TT>
- field. Certain standard
+CLASS="STRUCTFIELD"
+><I
+>control_buffer</I
+></TT
+> field. Certain standard
 control messages should be detected and handled by the device driver
 itself. The most important is set-address, but usually the get-status,
 set-feature and clear-feature requests when applied to halted
 endpoints should also be handled by the driver. Other standard control
 messages should first be passed on to the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-standard_control_fn</I>
-</TT>
- callback (if any), and
+CLASS="STRUCTFIELD"
+><I
+>standard_control_fn</I
+></TT
+> callback (if any), and
 finally to the default handler
 <TT
-CLASS="FUNCTION">
-usbs_handle_standard_control</TT>
- provided by the
+CLASS="FUNCTION"
+>usbs_handle_standard_control</TT
+> provided by the
 common USB slave package. Class, vendor and reserved control messages
 should always be dispatched to the appropriate callback and there is
-no default handler for these.</P>
-<P>
-Some control messages will involve further data transfer, not just the
+no default handler for these.</P
+><P
+>Some control messages will involve further data transfer, not just the
 initial packet. The device driver must handle this in accordance with
 the USB specification and the <A
-HREF="usbs-control.html#AEN578">
-buffer management strategy</A>
-. The
+HREF="usbs-control.html#AEN578"
+>buffer management strategy</A
+>. The
 driver is also responsible for keeping track of whether or not the
 control operation has succeeded and generating an ACK or STALL
-handshake. </P>
-<P>
-The polling support is optional and may not be feasible on all
+handshake. </P
+><P
+>The polling support is optional and may not be feasible on all
 hardware. It is only used in certain specialised environments such as
 RedBoot. A typical implementation of the polling function would just
 check whether or not an interrupt would have occurred and, if so, call
-the same code that the interrupt handler would.</P>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN704">
-</A>
-<H2>
-Data Endpoints</H2>
-<P>
-In addition to the control endpoint data structure, a USB device
+the same code that the interrupt handler would.</P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN704"
+></A
+><H2
+>Data Endpoints</H2
+><P
+>In addition to the control endpoint data structure, a USB device
 driver should also provide appropriate <A
-HREF="usbs-data.html">
-data
-endpoint</A>
- data structures. Obviously this is only relevant if
+HREF="usbs-data.html"
+>data
+endpoint</A
+> data structures. Obviously this is only relevant if
 the USB support generally is desired, that is if the control endpoint is
 provided. In addition, higher-level code may not require all the
 endpoints, so it may be useful to provide configuration options that
 control the presence of each endpoint. For example, the intended
 application might only involve a single transmit endpoint and of
 course control messages, so supporting receive endpoints might waste
-memory.</P>
-<P>
-Conceptually, data endpoints are much simpler than the control
+memory.</P
+><P
+>Conceptually, data endpoints are much simpler than the control
 endpoint. The device driver has to supply two functions, one for
 data transfers and another to control the halted condition. These
 implement the functionality for
 <A
-HREF="usbs-start-rx.html">
-<TT
-CLASS="FUNCTION">
-usbs_start_rx_buffer</TT>
-</A>
-,
+HREF="usbs-start-rx.html"
+><TT
+CLASS="FUNCTION"
+>usbs_start_rx_buffer</TT
+></A
+>,
 <A
-HREF="usbs-start-tx.html">
-<TT
-CLASS="FUNCTION">
-usbs_start_tx_buffer</TT>
-</A>
-,
+HREF="usbs-start-tx.html"
+><TT
+CLASS="FUNCTION"
+>usbs_start_tx_buffer</TT
+></A
+>,
 <A
-HREF="usbs-halt.html">
-<TT
-CLASS="FUNCTION">
-usbs_set_rx_endpoint_halted</TT>
-</A>
- and
+HREF="usbs-halt.html"
+><TT
+CLASS="FUNCTION"
+>usbs_set_rx_endpoint_halted</TT
+></A
+> and
 <A
-HREF="usbs-halt.html">
-<TT
-CLASS="FUNCTION">
-usbs_set_tx_endpoint_halted</TT>
-</A>
-.
+HREF="usbs-halt.html"
+><TT
+CLASS="FUNCTION"
+>usbs_set_tx_endpoint_halted</TT
+></A
+>.
 The device driver is also responsible for maintaining the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-halted</I>
-</TT>
- status.</P>
-<P>
-For data transfers, higher-level code will have filled in the
+CLASS="STRUCTFIELD"
+><I
+>halted</I
+></TT
+> status.</P
+><P
+>For data transfers, higher-level code will have filled in the
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>buffer</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-buffer_size</I>
-</TT>
-,
+CLASS="STRUCTFIELD"
+><I
+>buffer_size</I
+></TT
+>,
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_fn</I>
-</TT>
- and
+CLASS="STRUCTFIELD"
+><I
+>complete_fn</I
+></TT
+> and
 <TT
-CLASS="STRUCTFIELD">
-<I>
-complete_data</I>
-</TT>
- fields. The transfer function
+CLASS="STRUCTFIELD"
+><I
+>complete_data</I
+></TT
+> fields. The transfer function
 should arrange for the transfer to start, allowing the host to send or
 receive packets. Typically this will result in an interrupt at the end
 of the transfer or after each packet. Once the entire transfer has
@@ -375,58 +377,58 @@ context, depending on the driver's imple
 of special cases to consider. If the endpoint is halted when the
 transfer is started then the completion function can be invoked
 immediately with <TT
-CLASS="LITERAL">
--EAGAIN</TT>
-. If the transfer cannot be
+CLASS="LITERAL"
+>-EAGAIN</TT
+>. If the transfer cannot be
 completed because the connection is broken then the completion
 function should be invoked with <TT
-CLASS="LITERAL">
--EPIPE</TT>
-. If the
+CLASS="LITERAL"
+>-EPIPE</TT
+>. If the
 endpoint is stalled during the transfer, either because of a standard
 control message or because higher-level code calls the appropriate
 <TT
-CLASS="STRUCTFIELD">
-<I>
-set_halted_fn</I>
-</TT>
-, then again the completion
+CLASS="STRUCTFIELD"
+><I
+>set_halted_fn</I
+></TT
+>, then again the completion
 function should be invoked with <TT
-CLASS="LITERAL">
--EAGAIN</TT>
-. Finally,
+CLASS="LITERAL"
+>-EAGAIN</TT
+>. Finally,
 the &#60;<TT
-CLASS="FUNCTION">
-usbs_start_rx_endpoint_wait</TT>
- and
+CLASS="FUNCTION"
+>usbs_start_rx_endpoint_wait</TT
+> and
 <TT
-CLASS="FUNCTION">
-usbs_start_tx_endpoint_wait</TT>
- functions involve
+CLASS="FUNCTION"
+>usbs_start_tx_endpoint_wait</TT
+> functions involve
 calling the device driver's data transfer function with a buffer size
-of 0 bytes.</P>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN729">
-</A>
-<H2>
-Devtab Entries</H2>
-<P>
-For some applications or higher-level packages it may be more
+of 0 bytes.</P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN729"
+></A
+><H2
+>Devtab Entries</H2
+><P
+>For some applications or higher-level packages it may be more
 convenient to use traditional open/read/write I/O calls rather than
 the non-blocking USB I/O calls. To support this the device driver can
-provide a devtab entry for each endpoint, for example:</P>
-<TABLE
+provide a devtab entry for each endpoint, for example:</P
+><TABLE
 BORDER="0"
 BGCOLOR="#E0E0E0"
-WIDTH="100%">
-<TR>
-<TD>
-<PRE
-CLASS="PROGRAMLISTING">
-#ifdef CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY
+WIDTH="100%"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>#ifdef CYGVAR_DEVS_USB_SA11X0_EP1_DEVTAB_ENTRY
 
 static CHAR_DEVIO_TABLE(usbs_sa11x0_ep1_devtab_functions,
                         &amp;cyg_devio_cwrite,
@@ -444,63 +446,63 @@ static CHAR_DEVTAB_ENTRY(usbs_sa11x0_ep1
                          &amp;usbs_sa11x0_devtab_dummy_init,
                          0,
                          (void*) &amp;usbs_sa11x0_ep1);
-#endif</PRE>
-</TD>
-</TR>
-</TABLE>
-<P>
-Again care must be taken to avoid name clashes. This can be achieved
+#endif</PRE
+></TD
+></TR
+></TABLE
+><P
+>Again care must be taken to avoid name clashes. This can be achieved
 by having a configuration option to control the base name, with a
 default value of e.g. <TT
-CLASS="LITERAL">
-/dev/usbs</TT>
-, and appending an
+CLASS="LITERAL"
+>/dev/usbs</TT
+>, and appending an
 endpoint-specific string. This gives the application developer
 sufficient control to eliminate any name clashes. The common USB slave
 package provides functions <TT
-CLASS="FUNCTION">
-usbs_devtab_cwrite</TT>
- and
+CLASS="FUNCTION"
+>usbs_devtab_cwrite</TT
+> and
 <TT
-CLASS="FUNCTION">
-usbs_devtab_cread</TT>
-, which can be used in the
+CLASS="FUNCTION"
+>usbs_devtab_cread</TT
+>, which can be used in the
 function tables for transmit and receive endpoints respectively. The
 private field <TT
-CLASS="STRUCTFIELD">
-<I>
-priv</I>
-</TT>
- of the devtab entry
-should be a pointer to the underlying endpoint data structure.</P>
-<P>
-Because devtab entries are never accessed directly, only indirectly,
+CLASS="STRUCTFIELD"
+><I
+>priv</I
+></TT
+> of the devtab entry
+should be a pointer to the underlying endpoint data structure.</P
+><P
+>Because devtab entries are never accessed directly, only indirectly,
 they would usually be eliminated by the linker. To avoid this the
 devtab entries should normally be defined in a separate source file
 which ends up the special library <TT
-CLASS="FILENAME">
-libextras.a</TT>
-
+CLASS="FILENAME"
+>libextras.a</TT
+>
 rather than in the default library <TT
-CLASS="FILENAME">
-libtarget.a</TT>
-.</P>
-<P>
-Not all applications or higher-level packages will want to use the
+CLASS="FILENAME"
+>libtarget.a</TT
+>.</P
+><P
+>Not all applications or higher-level packages will want to use the
 devtab entries and the blocking I/O facilities. It may be appropriate
 for the device driver to provide additional configuration options that
 control whether or not any or all of the devtab entries should be
-provided, to avoid unnecessary memory overheads.</P>
-</DIV>
-<DIV
-CLASS="REFSECT1">
-<A
-NAME="AEN742">
-</A>
-<H2>
-Interrupt Handling</H2>
-<P>
-A typical USB device driver will need to service interrupts for all of
+provided, to avoid unnecessary memory overheads.</P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN742"
+></A
+><H2
+>Interrupt Handling</H2
+><P
+>A typical USB device driver will need to service interrupts for all of
 the endpoints and possibly for additional USB events such as entering
 or leaving suspended mode. Usually these interrupts need not be
 serviced directly by the ISR. Instead, they can be left to a DSR. If
@@ -509,9 +511,9 @@ the hardware will generate a NAK and the
 bit later. If high throughput is required then it may be desirable to
 handle the bulk transfer protocol largely at ISR level, that is take
 care of each packet in the ISR and only activate the DSR once the
-whole transfer has completed.</P>
-<P>
-Control messages may involve invoking arbitrary callback functions in
+whole transfer has completed.</P
+><P
+>Control messages may involve invoking arbitrary callback functions in
 higher-level code. This should normally happen at DSR level. Doing it
 at ISR level could seriously affect the system's interrupt latency and
 impose unacceptable constraints on what operations can be performed by
@@ -521,58 +523,59 @@ usually it is not worthwhile to add a ne
 for this; higher-level code is expected to write callbacks that
 function sensibly at DSR level. Much the same applies to the
 completion functions associated with data transfers. These should also
-be invoked at DSR or thread level.</P>
-</DIV>
-<DIV
-CLASS="NAVFOOTER">
-<HR
+be invoked at DSR or thread level.</P
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><HR
 ALIGN="LEFT"
 WIDTH="100%"><TABLE
 WIDTH="100%"
 BORDER="0"
 CELLPADDING="0"
-CELLSPACING="0">
-<TR>
-<TD
+CELLSPACING="0"
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-<A
-HREF="usbs-data.html">
-Prev</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="usbs-data.html"
+>Prev</A
+></TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-<A
-HREF="io-usb-slave.html">
-Home</A>
-</TD>
-<TD
+VALIGN="top"
+><A
+HREF="io-usb-slave.html"
+>Home</A
+></TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-&nbsp;</TD>
-</TR>
-<TR>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+></TR
+><TR
+><TD
 WIDTH="33%"
 ALIGN="left"
-VALIGN="top">
-Data Endpoints</TD>
-<TD
+VALIGN="top"
+>Data Endpoints</TD
+><TD
 WIDTH="34%"
 ALIGN="center"
-VALIGN="top">
-&nbsp;</TD>
-<TD
+VALIGN="top"
+>&nbsp;</TD
+><TD
 WIDTH="33%"
 ALIGN="right"
-VALIGN="top">
-&nbsp;</TD>
-</TR>
-</TABLE>
-</DIV>
-</BODY>
-</HTML>
+VALIGN="top"
+>&nbsp;</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
\ No newline at end of file
--- a/packages/io/usb/slave/current/doc/usbs.sgml
+++ b/packages/io/usb/slave/current/doc/usbs.sgml
@@ -696,8 +696,8 @@ 0x0409 corresponds to English (United St
 </para>
 <programlisting width=72>
 const unsigned char* usb_strings[] = {
-    "\x04\x03\x09\x04",
-    "\x10\x03R\0e\0d\0 \0H\0a\0t\0"
+    "\004\003\011\004",
+    "\020\003R\000e\000d\000 \000H\000a\000t\000"
 };
 
 const usbs_enumeration_data usb_enum_data = {
--- a/packages/io/usb/slave/current/include/usbs.h
+++ b/packages/io/usb/slave/current/include/usbs.h
@@ -378,7 +378,7 @@ extern Cyg_ErrNo usbs_devtab_set_config(
 typedef struct usbs_testing_endpoint {
     int         endpoint_type;          // One of ATTR_CONTROL, ATTR_BULK, ...
     int         endpoint_number;        // Between 0 and 15
-    cyg_bool    in_endpoint;            // host->slave?
+    int         endpoint_direction;     // ENDPOINT_IN or ENDPOINT_OUT
     void*       endpoint;               // pointer to the usbs_control_endpoint, usbs_rx_endpoint, ...
     const char* devtab_entry;           // e.g. "/dev/usbs1r", or 0 if inaccessible via devtab
     int         min_size;               // Minimum transfer size
@@ -387,22 +387,24 @@ typedef struct usbs_testing_endpoint {
                                         // Primarily for SA11x0 hardware. It is assumed
                                         // for now that no other hardware will exhibit
                                         // comparable problems.
+    int         alignment;              // Buffer should be aligned to a suitable boundary
 } usbs_testing_endpoint;
 
 // A specific instance provided by the device driver. The end of
 // the table is indicated by a NULL endpoint field.    
 extern usbs_testing_endpoint usbs_testing_endpoints[];    
 
-#define USBS_TESTING_ENDPOINTS_TERMINATOR                       \
-    {                                                           \
-        endpoint_type   : USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, \
-        endpoint_number : 0,                                    \
-        in_endpoint     : false,                                \
-        endpoint        : (void*) 0,                            \
-        devtab_entry    : (const char*) 0,                      \
-        min_size        : 0,                                    \
-        max_size        : 0,                                    \
-        max_in_padding  : 0                                     \
+#define USBS_TESTING_ENDPOINTS_TERMINATOR                           \
+    {                                                               \
+        endpoint_type       : USB_ENDPOINT_DESCRIPTOR_ATTR_CONTROL, \
+        endpoint_number     : 0,                                    \
+        endpoint_direction  : USB_ENDPOINT_DESCRIPTOR_ENDPOINT_IN,  \
+        endpoint            : (void*) 0,                            \
+        devtab_entry        : (const char*) 0,                      \
+        min_size            : 0,                                    \
+        max_size            : 0,                                    \
+        max_in_padding      : 0,                                    \
+        alignment           : 0                                     \
     }
 
 #define USBS_TESTING_ENDPOINTS_IS_TERMINATOR(_endpoint_) ((void*)0 == (_endpoint_).endpoint)
--- a/packages/io/usb/slave/current/src/usbs.c
+++ b/packages/io/usb/slave/current/src/usbs.c
@@ -538,7 +538,8 @@ usbs_handle_standard_control(usbs_contro
                     }
                     CYG_ASSERT( start_interface < endpoint->enumeration_data->total_number_interfaces, \
                                 "Valid interface count in enumeration data");
-                    CYG_ASSERT( start_endpoint < endpoint->enumeration_data->total_number_endpoints, \
+                    CYG_ASSERT( ((0 == endpoint->enumeration_data->total_number_endpoints) && (0 == start_endpoint)) || \
+                                (start_endpoint < endpoint->enumeration_data->total_number_endpoints), \
                                 "Valid endpoint count in enumeration data");
 
                     req->type           = (unsigned char) start_interface;
--- a/packages/isoinfra/current/ChangeLog
+++ b/packages/isoinfra/current/ChangeLog
@@ -1,3 +1,17 @@
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/isoinfra.cdl: Add netdb services and proto function support.
+	* include/netdb.h: New file.
+
+2001-09-24  Jesper Skov  <jskov@redhat.com>
+
+	* cdl/isoinfra.cdl: Added CYGINT_ISO_DNS and
+	CYGBLD_ISO_DNS_HEADER.
+
+2001-09-12  Jesper Skov  <jskov@redhat.com>
+
+	* include/limits.h: Work around glibc header problem.
+
 2001-09-10  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* cdl/isoinfra.cdl: Add CYGINT_ISO_PTHREAD_MUTEX and
--- a/packages/isoinfra/current/cdl/isoinfra.cdl
+++ b/packages/isoinfra/current/cdl/isoinfra.cdl
@@ -435,8 +435,6 @@ cdl_package CYGPKG_ISOINFRA {
             flavor        booldata
             default_value 0
         }
-
-        
     }
 
 # ====================================================================
@@ -1110,6 +1108,51 @@ cdl_package CYGPKG_ISOINFRA {
     }
 
 # ====================================================================
+
+    cdl_component CYGPKG_ISO_NETDB {
+        display       "NetDB utility functions"
+        flavor        none
+        no_define
+
+        cdl_interface CYGINT_ISO_DNS {
+            display       "DNS implementations"
+            flavor        bool
+            requires      { 1 >= CYGINT_ISO_DNS }
+        }
+    
+        cdl_option CYGBLD_ISO_DNS_HEADER {
+            display       "DNS implementation header"
+            flavor        booldata
+            default_value 0
+        }
+        
+        cdl_interface CYGINT_ISO_NETDB_PROTO {
+            display       "Protocol network database implementations"
+            flavor        bool
+            requires      { 1 >= CYGINT_ISO_NETDB_PROTO }
+        }
+    
+        cdl_option CYGBLD_ISO_NETDB_PROTO_HEADER {
+            display       "Protocol network database implementation header"
+            flavor        booldata
+            default_value 0
+        }
+        
+        cdl_interface CYGINT_ISO_NETDB_SERV {
+            display       "Services network database implementations"
+            flavor        bool
+            requires      { 1 >= CYGINT_ISO_NETDB_SERV }
+        }
+    
+        cdl_option CYGBLD_ISO_NETDB_SERV_HEADER {
+            display       "Services network database implementation header"
+            flavor        booldata
+            default_value 0
+        }
+        
+    }
+
+# ====================================================================
     
         cdl_component CYGPKG_ISOINFRA_OPTIONS {
         display "Build options"
--- a/packages/isoinfra/current/include/limits.h
+++ b/packages/isoinfra/current/include/limits.h
@@ -200,6 +200,11 @@
 # endif
 #endif
 
+/* 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_ */
+#define _LIBC_LIMITS_H_
+
 #include_next <limits.h>
 
 #endif /* CYGONCE_ISO_LIMITS_H multiple inclusion protection */
new file mode 100644
--- /dev/null
+++ b/packages/isoinfra/current/include/netdb.h
@@ -0,0 +1,71 @@
+#ifndef CYGONCE_ISO_NETDB_H
+#define CYGONCE_ISO_NETDB_H
+/*==========================================================================
+//
+//      netdb.h
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     jskov,jlarmour
+// Contributors: 
+// Date:          2001-09-28
+// Purpose:       Provides network database types and function API.
+// Description:   Much of the real contents of this file get set from the
+//                configuration (set by the implementation)
+// Usage:         #include <netdb.h>
+//              
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================*/
+
+#include <pkgconf/isoinfra.h>
+
+#ifdef CYGINT_ISO_DNS
+# ifdef CYGBLD_ISO_DNS_HEADER
+#  include CYGBLD_ISO_DNS_HEADER
+# endif
+#endif
+
+#ifdef CYGINT_ISO_NETDB_PROTO
+# ifdef CYGBLD_ISO_NETDB_PROTO_HEADER
+#  include CYGBLD_ISO_NETDB_PROTO_HEADER
+# endif
+#endif
+
+#ifdef CYGINT_ISO_NETDB_SERV
+# ifdef CYGBLD_ISO_NETDB_SERV_HEADER
+#  include CYGBLD_ISO_NETDB_SERV_HEADER
+# endif
+#endif
+
+#endif /* CYGONCE_ISO_NETDB_H multiple inclusion protection */
+
+/* EOF netdb.h */
--- a/packages/kernel/current/ChangeLog
+++ b/packages/kernel/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-20  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* host/instr/dump_instr.c (main): Fix argc check.
+
 2001-09-07  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/thread.inl (measure_stack_usage): Deal with stack limits.
--- a/packages/kernel/current/host/instr/dump_instr.c
+++ b/packages/kernel/current/host/instr/dump_instr.c
@@ -67,7 +67,7 @@ int main(int argc, char * argv[])
   struct Instrument_Record record;
   int cnt=0;
 
-  if (argc != 1) {
+  if (argc != 2) {
     usage(argv[0]);
     exit(1);
   }
--- a/packages/language/c/libm/current/ChangeLog
+++ b/packages/language/c/libm/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-28  Jesper Skov  <jskov@redhat.com>
+
+	* src/double/portable-api/s_expm1.c (expm1): Init c before it's used.
+
 2001-07-20  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* src/double/portable-api/s_expm1.c: Reimport from newlib
--- 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
@@ -274,7 +274,7 @@ Q5  =  -2.01099218183624371326e-07; /* B
 	    t = huge+x;	/* return x with inexact flags when x!=0 */
 	    return x - (t-(huge+x));	
 	}
-	else k = 0;
+	else k = 0, c = 0;
 
     /* x is now in primary range */
 	hfx = 0.5*x;
--- a/packages/net/snmp/lib/current/ChangeLog
+++ b/packages/net/snmp/lib/current/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-24  Jesper Skov  <jskov@redhat.com>
+
+	* include/config.h: Define HAVE_GETHOSTBYNAME only if a DNS
+	package is available.
+
 2001-05-28  Andrew Lunn  <Andrew.Lunn@ascom.ch>
 2001-05-28  Manu Sharma  <Manu.Sharma@ascom.ch>
 
--- a/packages/net/snmp/lib/current/include/config.h
+++ b/packages/net/snmp/lib/current/include/config.h
@@ -86,6 +86,7 @@ CONNECTION WITH THE USE OR PERFORMANCE O
 
 
 #include <pkgconf/system.h>
+#include <pkgconf/isoinfra.h>
 #include <pkgconf/snmplib.h>
 #include <pkgconf/snmpagent.h>
 
@@ -1162,7 +1163,9 @@ CONNECTION WITH THE USE OR PERFORMANCE O
 #define HAVE_LIBRPM 1
 
 /* define if you have gethostbyname */
-#define HAVE_GETHOSTBYNAME 1
+#if CYGINT_ISO_DNS
+# define HAVE_GETHOSTBYNAME 1
+#endif
 
 /* define if you have getservbyname */
 #define HAVE_GETSERVBYNAME 1
--- a/packages/net/tcpip/current/ChangeLog
+++ b/packages/net/tcpip/current/ChangeLog
@@ -1,3 +1,55 @@
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* cdl/net.cdl: Tell isoinfra we support getproto* and getserv*
+	NS functionality.
+	* include/netdb.h: Move to...
+	* include/net/netdb.h: ...here.
+
+2001-09-25  Jesper Skov  <jskov@redhat.com>
+
+	* cdl/net.cdl: Don't build tests/nc_test_master as it's a host
+	side tool.
+
+	* src/lib/getserv.c: Added domain service.
+
+	* include/netdb.h: Moved getbyhost()/getbyaddr() declarations and
+	hostent struct definition to the DNS package. 
+
+	* src/lib/gethost.c: Removed.
+
+	* cdl/net.cdl: Removed gethost.c (replaced by proper
+	implementation in CYGPKG_NS_DNS).
+
+2001-09-17  Hugo Tyson  <hmt@redhat.com>
+2001-09-17  Andrew Lunn <Andrew.Lunn@ascom.ch>
+
+	* src/sys/net/if_bridge.c (bridge_broadcast): Fix a null pointer
+	deference.  Supporting VLANs, it seems that during the net_init()
+	function, it sends a packet to the bridge with the source
+	interface being NULL.  Stats counting assumed otherwise.
+
+2001-09-14  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/sys/kern/uipc_syscalls.c: Last change to uipc_syscalls.c
+	wasn't right. The parts that were __ECOS__ should simply have
+	been completely removed.
+
+2001-09-13  Hugo Tyson  <hmt@redhat.com>
+
+	* cdl/net.cdl: Add configury to control whether we can tickle the
+	network devices if there's a lack of network traffic, and to
+	control the delay time before so doing.
+
+	* src/ecos/timeout.c (alarm_thread): Use a timed wait, if so
+	configured, for the flag; and if it times out, tickle all the
+	devices via the common ether driver routine for so doing.
+
+2001-09-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* include/sys/socketvar.h: Use __ECOS, not __ECOS__.
+	* src/sys/kern/uipc_syscalls.c: Ditto.
+	* src/sys/kern/uipc_socket2.c (sblock): Ditto.
+
 2001-08-02  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* tests/linux_echo.c (echo_test): Set socket options before bind.
--- a/packages/net/tcpip/current/cdl/net.cdl
+++ b/packages/net/tcpip/current/cdl/net.cdl
@@ -63,6 +63,10 @@ cdl_package CYGPKG_NET {
     # Export our types to <sys/types.h>
     implements    CYGINT_ISO_BSDTYPES
     requires      { CYGBLD_ISO_BSDTYPES_HEADER == "<sys/bsdtypes.h>" }
+    implements    CYGINT_ISO_NETDB_PROTO
+    implements    CYGINT_ISO_NETDB_SERV
+    requires      { CYGBLD_ISO_NETDB_PROTO_HEADER == "<net/netdb.h>" }
+    requires      { CYGBLD_ISO_NETDB_SERV_HEADER == "<net/netdb.h>" }
     
     compile ecos/support.c \
         ecos/synch.c \
@@ -105,9 +109,7 @@ cdl_package CYGPKG_NET {
         lib/dhcp_prot.c \
         lib/network_support.c \
         lib/getproto.c \
-        lib/getserv.c \
-        lib/gethost.c
-
+        lib/getserv.c
 
     cdl_option CYGPKG_NET_API_LOCAL {
         display "Implement the socket API locally"
@@ -307,6 +309,36 @@ cdl_package CYGPKG_NET {
         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_option CYGPKG_NET_NBPF {
         display "Number of BPF filters"
         flavor  data
@@ -446,7 +478,6 @@ cdl_package CYGPKG_NET {
                     tests/socket_test \
                     tests/ftp_test \
                     tests/server_test \
-                    tests/nc_test_master \
                     tests/nc_test_slave \
                     tests/tftp_client_test \
                     tests/tftp_server_test \
new file mode 100644
--- /dev/null
+++ b/packages/net/tcpip/current/include/net/netdb.h
@@ -0,0 +1,89 @@
+//==========================================================================
+//
+//      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_
deleted file mode 100644
--- a/packages/net/tcpip/current/include/netdb.h
+++ /dev/null
@@ -1,102 +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);
-
-// 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 */
-
-struct hostent *gethostbyname(const char *host);
-struct hostent *gethostbyaddr(const char *addr, int len, int type);
-
-#ifdef __cplusplus
-}
-#endif
-#endif // _NETDB_H_
--- a/packages/net/tcpip/current/include/sys/socketvar.h
+++ b/packages/net/tcpip/current/include/sys/socketvar.h
@@ -237,7 +237,7 @@ struct socket {
  * Unless SB_NOINTR is set on sockbuf, sleep is interruptible.
  * Returns error without lock if sleep is interrupted.
  */
-#ifdef __ECOS__
+#ifdef __ECOS
 extern int  sblock(struct sockbuf *sb, int wf);
 extern void sbunlock(struct sockbuf *sb);
 #else
--- a/packages/net/tcpip/current/src/ecos/timeout.c
+++ b/packages/net/tcpip/current/src/ecos/timeout.c
@@ -157,14 +157,29 @@ alarm_thread(cyg_addrword_t param)
     // 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 = cyg_flag_wait(
+        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();
@@ -173,7 +188,14 @@ alarm_thread(cyg_addrword_t param)
 
         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();
 
deleted file mode 100644
--- a/packages/net/tcpip/current/src/lib/gethost.c
+++ /dev/null
@@ -1,69 +0,0 @@
-//==========================================================================
-//
-//      lib/gethost.c
-//
-//      gethostbyname(), gethostbyaddr()
-//
-//==========================================================================
-//####COPYRIGHTBEGIN####
-//                                                                          
-// -------------------------------------------                              
-// The contents of this file are subject to the Red Hat eCos Public License 
-// Version 1.1 (the "License"); you may not use this file except in         
-// compliance with the License.  You may obtain a copy of the License at    
-// http://www.redhat.com/                                                   
-//                                                                          
-// Software distributed under the License is distributed on an "AS IS"      
-// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 
-// License for the specific language governing rights and limitations under 
-// the License.                                                             
-//                                                                          
-// The Original Code is eCos - Embedded Configurable Operating System,      
-// released September 30, 1998.                                             
-//                                                                          
-// The Initial Developer of 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 <sys/param.h>
-#include <netdb.h>
-
-struct hostent *
-gethostbyname(const char *host)
-{
-    return (struct hostent *)NULL;
-}
-
-struct hostent *
-gethostbyaddr(const char *addr, int len, int type)
-{
-    return (struct hostent *)NULL;
-}
--- a/packages/net/tcpip/current/src/lib/getserv.c
+++ b/packages/net/tcpip/current/src/lib/getserv.c
@@ -67,6 +67,7 @@
 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" },
 
--- a/packages/net/tcpip/current/src/sys/kern/uipc_socket2.c
+++ b/packages/net/tcpip/current/src/sys/kern/uipc_socket2.c
@@ -369,7 +369,7 @@ sb_lock(sb)
 	return (0);
 }
 
-#ifdef __ECOS__
+#ifdef __ECOS
 /*
  * Set lock on sockbuf sb; sleep if lock is already held.
  * Unless SB_NOINTR is set on sockbuf, sleep is interruptible.
--- a/packages/net/tcpip/current/src/sys/kern/uipc_syscalls.c
+++ b/packages/net/tcpip/current/src/sys/kern/uipc_syscalls.c
@@ -197,11 +197,7 @@ sys_bind(p, v, retval)
 	struct mbuf *nam;
 	int error;
 
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, s), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
-#endif
 		return (error);
 	error = sockargs(&nam, (caddr_t)SCARG(uap, name), SCARG(uap, namelen),
 			 MT_SONAME);
@@ -232,11 +228,7 @@ sys_listen(p, v, retval)
 	struct file *fp;
 	int error;
 
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, s), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
-#endif
 		return (error);
 	return (solisten((struct socket *)fp->f_data, SCARG(uap, backlog)));
 }
@@ -267,11 +259,7 @@ sys_accept(p, v, retval)
 	if (SCARG(uap, name) && (error = copyin((caddr_t)SCARG(uap, anamelen),
 	    (caddr_t)&namelen, sizeof (namelen))))
 		return (error);
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, s), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
-#endif
 		return (error);
 	s = splsoftnet();
 	so = (struct socket *)fp->f_data;
@@ -363,11 +351,7 @@ sys_connect(p, v, retval)
 	struct mbuf *nam;
 	int error, s;
 
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, s), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
-#endif
 		return (error);
 	so = (struct socket *)fp->f_data;
 	if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING))
@@ -578,11 +562,7 @@ sendit(p, s, mp, flags, retsize)
 	struct iovec *ktriov = NULL;
 #endif
 	
-#ifdef __ECOS__
-	if ((error = getsock(s, &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, s, &fp)) != 0)
-#endif
 		return (error);
 	auio.uio_iov = mp->msg_iov;
 	auio.uio_iovcnt = mp->msg_iovlen;
@@ -802,11 +782,7 @@ recvit(p, s, mp, namelenp, retsize)
 	struct iovec *ktriov = NULL;
 #endif
 
-#ifdef __ECOS__
-	if ((error = getsock(s, &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, s, &fp)) != 0)
-#endif
 		return (error);
 	auio.uio_iov = mp->msg_iov;
 	auio.uio_iovcnt = mp->msg_iovlen;
@@ -962,11 +938,7 @@ sys_shutdown(p, v, retval)
 	struct file *fp;
 	int error;
 
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, s), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
-#endif
 		return (error);
 	return (soshutdown((struct socket *)fp->f_data, SCARG(uap, how)));
 }
@@ -995,11 +967,7 @@ sys_setsockopt(p, v, retval)
 	struct mbuf *m = NULL;
 	int error;
 
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, s), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
-#endif
 		return (error);
 	if (SCARG(uap, valsize) > MCLBYTES)
 		return (EINVAL);
@@ -1051,11 +1019,7 @@ sys_getsockopt(p, v, retval)
 	socklen_t valsize;
 	int error;
 
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, s), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
-#endif
 		return (error);
 	if (SCARG(uap, val)) {
 		error = copyin((caddr_t)SCARG(uap, avalsize),
@@ -1183,11 +1147,7 @@ sys_getsockname(p, v, retval)
 	socklen_t len;
 	int error;
 
-#ifdef __ECOS__
-	if ((error = getsock(SCARG(uap, fdes), &fp)) != 0)
-#else
 	if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0)
-#endif
 		return (error);
 	error = copyin((caddr_t)SCARG(uap, alen), (caddr_t)&len, sizeof (len));
 	if (error)
--- a/packages/net/tcpip/current/src/sys/net/if_bridge.c
+++ b/packages/net/tcpip/current/src/sys/net/if_bridge.c
@@ -1271,7 +1271,7 @@ bridge_broadcast(sc, ifp, eh, m)
 
 		sc->sc_if.if_opackets++;
 		sc->sc_if.if_obytes += mc->m_pkthdr.len;
-		if ((eh->ether_shost[0] & 1) == 0)
+		if (ifp && ((eh->ether_shost[0] & 1) == 0) )
 			ifp->if_omcasts++;
 
 		IF_ENQUEUE(&p->ifp->if_snd, mc);
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,19 +1,74 @@
+2001-10-02  Gary Thomas  <gthomas@redhat.com>
+
+	* src/xyzModem.h: 
+	* src/xyzModem.c (xyzModem_stream_open): 
+	* src/load.c (do_load): Add new option "-c <N>" to let the user
+	specify the I/O channel to use - xyModem only.
+
+2001-10-01  Gary Thomas  <gthomas@redhat.com>
+
+	* src/net/udp.c (__udp_recvfrom): Don't change server address (returned
+	by this function) until a packet has been received with no timeout.
+
+2001-09-28  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/flash.c (fis_create): if not copying, still update directory.
+
+2001-09-28  Gary Thomas  <gthomas@redhat.com>
+
+	* src/flash.c (_expand_aliases): Properly null terminate expanded 
+	string - failed if alias was at end of line.
+
+2001-09-14  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* src/version.c: Simplify _CERTIFICATE handling.
+
+2001-09-13  Fabrice Gautier <Fabrice_Gautier@sdesigns.com>
+
+	* cdl/redboot.cdl: Added configuration options to deactivate BOOTP and
+	enable net debug.
+	* src/net/net_io.c (net_init): Use them.
+
+2001-09-13  Gary Thomas  <gthomas@redhat.com>
+
+	* src/flash.c: Cleanups - removing some redundant code.
+
+2001-09-12  Jonathan Larmour  <jlarmour@redhat.com>
+
+        * src/flash.c (do_flash_init): Only allocate fis block when
+        CYGOPT_REDBOOT_FIS enabled.
+        Conditionalize fis_work_block and fisdir_size.
+
+2001-09-12  Gary Thomas  <gthomas@redhat.com>
+
+        * src/flash.c (load_flash_config): Use additional space in the
+        FLASH work area (at end of RAM) for 'fconfig' data.  This reduces
+        overall stack requirements as there is no need for 'fconfig' data
+        to be held on the stack anymore.
+
+        * src/flash.c: 
+        * include/fis.h: Define flash addresses using CYG_ADDRESS which
+        is more portable than (unsigned long).
+
 2001-09-11  Jonathan Larmour  <jlarmour@redhat.com>
 
-	* cdl/redboot.cdl (CYGPKG_REDBOOT_FLASH): Be conditional on an
-	actual flash device, not just the generic flash layer.
+        * cdl/redboot.cdl (CYGPKG_REDBOOT_FLASH): Be conditional on an
+        actual flash device, not just the generic flash layer.
 
 2001-09-11  Gary Thomas  <gthomas@redhat.com>
 
-	* src/version.c (_CERTIFICATE): Add information about product
-	certification (either Red Hat certified or not).
+        * src/version.c (_CERTIFICATE): Add information about product
+        certification (either Red Hat certified or not).
 
-	* src/flash.c (fis_delete): Deny user deleting "reserved" images.
+        * src/flash.c (fis_delete): Deny user deleting "reserved" images.
 
 2001-09-07  Andrew Lunn  <andrew.lunn@ascom.ch>
+	* src/flash.c: Extend the alias handling to allow configuration
+	information to be access using alias. Fixed alias expansion
+	when the alias is bigger than the replacement.
 	* src/parse.c: A semi colon can be used to separate multiple
 	commands on one line. 
-
+	
 2001-09-06  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* include/redboot.h: Include string function prototype header.
--- a/packages/redboot/current/cdl/redboot.cdl
+++ b/packages/redboot/current/cdl/redboot.cdl
@@ -23,7 +23,7 @@
 #                                                                          
 # The Initial Developer of the Original Code is Red Hat.                   
 # Portions created by Red Hat are                                          
-# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
+# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.
 # All Rights Reserved.                                                     
 # -------------------------------------------                              
 #                                                                          
@@ -127,7 +127,15 @@ cdl_package CYGPKG_REDBOOT {
             puts $::cdl_system_header "#define CYGNUM_HAL_VIRTUAL_VECTOR_AUX_CHANNELS 1"
         }
 
-        cdl_option CYGDAT_REDBOOT_DEFAULT_IP_ADDR {
+        cdl_option CYGDBG_REDBOOT_NET_DEBUG {
+            display          "Print net debug information"
+            flavor           bool
+            default_value    0
+            description      "
+                This option is overriden by the configuration stored in flash."
+        }
+
+        cdl_component CYGDAT_REDBOOT_DEFAULT_IP_ADDR {
             display          "Default IP address"
             flavor           booldata
             default_value    CYGSEM_REDBOOT_FLASH_CONFIG ? 0 : \
@@ -137,8 +145,21 @@ cdl_package CYGPKG_REDBOOT {
                 server does not respond. The numbers should be separated by
                 *commas*, and not dots. If an IP address is configured into
                 the Flash configuration, that will be used in preference."
+
+            cdl_option CYGSEM_REDBOOT_DEFAULT_NO_BOOTP {
+                 display          "Do not try to use BOOTP"
+                 flavor           bool
+                 default_value    0
+                 description      "
+                     By default Redboot tries to use BOOTP to get an IP
+                     address. If there's no BOOTP server on your network
+                     use this option to avoid to wait until the
+                     timeout. This option is overriden by the
+                     configuration stored in flash."
+            }
         }
 
+
         cdl_option CYGNUM_REDBOOT_NETWORKING_TCP_PORT {
             display          "TCP port to listen for incoming connections"
             flavor           data
@@ -162,7 +183,6 @@ cdl_package CYGPKG_REDBOOT {
                about 1514 bytes.  Note: there is little need to make this larger
                than the default."
         }
-    }
 
     cdl_option CYGPKG_REDBOOT_ANY_CONSOLE {
         display       "Allow RedBoot to use any I/O channel for it's console."
@@ -479,8 +499,8 @@ cdl_package CYGPKG_REDBOOT {
             default_value 1
             description "
               When this option is enabled, RedBoot will support IDE disks."
-	    compile -library=libextras.a fs/ide.c
-	}
+            compile -library=libextras.a fs/ide.c
+        }
 
         cdl_component CYGSEM_REDBOOT_DISK_EXT2FS {
             display       "Support Linux second extended filesystems."
@@ -488,8 +508,8 @@ cdl_package CYGPKG_REDBOOT {
             default_value 1
             description "
               When this option is enabled, RedBoot will support IDE disks."
-	    compile -library=libextras.a fs/e2fs.c
-	}
+            compile -library=libextras.a fs/e2fs.c
+        }
 
         cdl_component CYGSEM_REDBOOT_DISK_ISO9660 {
             display       "Support ISO9660 filesystems."
@@ -497,8 +517,8 @@ cdl_package CYGPKG_REDBOOT {
             calculated    0
             description "
               When this option is enabled, RedBoot will support ISO9660 filesystems."
-	    compile -library=libextras.a fs/iso9660fs.c
-	}
+            compile -library=libextras.a fs/iso9660fs.c
+        }
     }
 
     cdl_component CYGPKG_REDBOOT_BOOT_SCRIPT {
@@ -550,12 +570,12 @@ cdl_package CYGPKG_REDBOOT {
     }
 
     cdl_option CYGPRI_REDBOOT_ROM_MONITOR {
-	display      "Behave like a ROM monitor"
+        display      "Behave like a ROM monitor"
         active_if    { CYG_HAL_STARTUP == "ROM" || CYG_HAL_STARTUP == "ROMRAM" }
         requires     CYGSEM_HAL_ROM_MONITOR
         calculated   1
         no_define
-	description  "
+        description  "
           Enabling this option will allow RedBoot to provide ROM monitor-style
           services to programs which it executes."
     }
--- a/packages/redboot/current/include/fis.h
+++ b/packages/redboot/current/include/fis.h
@@ -25,7 +25,7 @@
 //                                                                          
 // The Initial Developer of the Original Code is Red Hat.                   
 // Portions created by Red Hat are                                          
-// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             
+// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc.                             
 // All Rights Reserved.                                                     
 // -------------------------------------------                              
 //                                                                          
@@ -47,12 +47,12 @@
 
 struct fis_image_desc {
     unsigned char name[16];      // Null terminated name
-    unsigned long flash_base;    // Address within FLASH of image
-    unsigned long mem_base;      // Address in memory where it executes
+    CYG_ADDRESS   flash_base;    // Address within FLASH of image
+    CYG_ADDRESS   mem_base;      // Address in memory where it executes
     unsigned long size;          // Length of image
-    unsigned long entry_point;   // Execution entry point
+    CYG_ADDRESS   entry_point;   // Execution entry point
     unsigned long data_length;   // Length of actual data
-    unsigned char _pad[256-(16+7*sizeof(unsigned long))];
+    unsigned char _pad[256-(16+4*sizeof(unsigned long)+3*sizeof(CYG_ADDRESS))];
     unsigned long desc_cksum;    // Checksum over image descriptor
     unsigned long file_cksum;    // Checksum over image data
 };
--- a/packages/redboot/current/include/net/net.h
+++ b/packages/redboot/current/include/net/net.h
@@ -49,6 +49,7 @@
 #include <pkgconf/redboot.h>
 #include <cyg/hal/hal_arch.h>
 #include <cyg/hal/basetype.h>
+#include <string.h>
 
 extern bool net_debug;
 
@@ -567,7 +568,7 @@ extern void net_init(void);
 extern void net_io_test(bool is_idle);
 
 // Conversion between IP addresses and printable strings
-extern bool  inet_aton(char *, in_addr_t *);
+extern bool  inet_aton(const char *, in_addr_t *);
 extern char *inet_ntoa(in_addr_t *);
 
 // FIXME
--- a/packages/redboot/current/include/redboot.h
+++ b/packages/redboot/current/include/redboot.h
@@ -247,9 +247,63 @@ typedef struct {
   CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS
 #endif
 
-//
+#ifdef CYGPKG_REDBOOT_NETWORKING
+//-----------------------------------------------------------------------------
+// DNS wrapper
+#ifdef CYGPKG_REDBOOT_NETWORKING_DNS
+
+// I would really like if we could just pull in cyg/ns/dns/dns.h, but
+// that would require adding dummy <network.h> and <netinet/in.h> files.
+
+// 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 int redboot_dns_res_init(void);
+externC struct hostent *gethostbyname(const char *host);
+
+// Error reporting
+externC int h_errno;
+
+#define DNS_SUCCESS  0
+#define HOST_NOT_FOUND 1
+#define TRY_AGAIN      2
+#define NO_RECOVERY    3
+#define NO_DATA        4
+
+static inline bool
+_gethostbyname(const char* name, in_addr_t* host)
+{ 
+    struct hostent* hent = gethostbyname(name);
+    if (hent) {
+        memcpy(host, hent->h_addr_list[0], sizeof(in_addr_t));
+        return true;
+    }
+    // Fall back to inet_aton - gethostbyname may already have tried
+    // it, but we can't know for sure (the DNS IP may not have been
+    // valid, preventing the inet_aton).
+    return inet_aton(name, host);
+}
+#else
+static inline bool
+_gethostbyname(const char* name, in_addr_t* host)
+{ 
+    return inet_aton(name, host);
+}
+#endif // CYGPKG_REDBOOT_NETWORKING_DNS
+#endif // CYGPKG_REDBOOT_NETWORKING
+
+//-----------------------------------------------------------------------------
+// String functions. Some of these are duplicates of the same functions in
+// the I18N package.
+
 // Validate a hex character
-//
 __inline__ static bool
 _is_hex(char c)
 {
@@ -258,9 +312,7 @@ typedef struct {
             ((c >= 'a') && (c <= 'f')));
 }
 
-//
 // Convert a single hex nibble
-//
 __inline__ static int
 _from_hex(char c) 
 {
@@ -276,10 +328,7 @@ typedef struct {
     return ret;
 }
 
-
-//
 // Convert a character to lower case
-//
 __inline__ static char
 _tolower(char c)
 {
@@ -289,4 +338,26 @@ typedef struct {
     return c;
 }
 
+// Validate alpha
+__inline__ static bool
+isalpha(int c)
+{
+    return (((c >= 'a') && (c <= 'z')) || 
+            ((c >= 'A') && (c <= 'Z')));
+}
+
+// Validate digit
+__inline__ static bool
+isdigit(int c)
+{
+    return ((c >= '0') && (c <= '9'));
+}
+
+// Validate alphanum
+__inline__ static bool
+isalnum(int c)
+{
+    return (isalpha(c) || isdigit(c));
+}
+
 #endif // _REDBOOT_H_
--- a/packages/redboot/current/src/flash.c
+++ b/packages/redboot/current/src/flash.c
@@ -145,8 +145,11 @@ extern struct cmd __FIS_cmds_TAB__[], __
 // Local data used by these routines
 static void *flash_start, *flash_end;
 static int block_size, blocks;
+#ifdef CYGOPT_REDBOOT_FIS
 static void *fis_work_block;
-static int fisdir_size;  // Size of FIS directory.  Note: zero if FIS not enabled
+static void *fis_addr;
+static int fisdir_size;  // Size of FIS directory.
+#endif
 #ifdef CYGSEM_REDBOOT_FLASH_CONFIG
 static void *cfg_base;   // Location in Flash of config data
 static int   cfg_size;   // Length of config data - rounded to Flash block size
@@ -161,22 +164,20 @@ fis_usage(char *why)
     cmd_usage(__FIS_cmds_TAB__, &__FIS_cmds_TAB_END__, "fis ");
 }
 
+static void        
+_show_invalid_flash_address(CYG_ADDRESS flash_addr, int stat)
+{
+    diag_printf("Invalid FLASH address %p: %s\n", (void *)flash_addr, flash_errmsg(stat));
+    diag_printf("   valid range is %p-%p\n", (void *)flash_start, (void *)flash_end);
+}
+
 #ifdef CYGOPT_REDBOOT_FIS
 struct fis_image_desc *
 fis_lookup(char *name)
 {
     int i;
-    void *fis_addr;
     struct fis_image_desc *img;
 
-    if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
-        fis_addr = (void *)((unsigned long)flash_end + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    } else {
-        fis_addr = (void *)((unsigned long)flash_start + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    }
-    memcpy(fis_work_block, fis_addr, block_size);
     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)) {
@@ -191,10 +192,11 @@ fis_init(int argc, char *argv[])
 {
     int stat;
     struct fis_image_desc *img;
-    void *fis_base, *err_addr;
+    void *err_addr;
     bool full_init = false;
     struct option_info opts[1];
-    unsigned long redboot_image_size, redboot_flash_start;
+    CYG_ADDRESS redboot_flash_start;
+    unsigned long redboot_image_size;
 
     init_opts(&opts[0], 'f', false, OPTION_ARG_TYPE_FLG, 
               (void **)&full_init, (bool *)0, "full initialization, erases all of flash");
@@ -217,12 +219,12 @@ fis_init(int argc, char *argv[])
 #ifdef CYGOPT_REDBOOT_FIS_RESERVED_BASE
     memset(img, 0, sizeof(*img));
     strcpy(img->name, "(reserved)");
-    img->flash_base = (unsigned long)flash_start;
-    img->mem_base = (unsigned long)flash_start;
+    img->flash_base = (CYG_ADDRESS)flash_start;
+    img->mem_base = (CYG_ADDRESS)flash_start;
     img->size = CYGNUM_REDBOOT_FLASH_RESERVED_BASE;
     img++;
 #endif
-    redboot_flash_start = (unsigned long)flash_start + CYGBLD_REDBOOT_FLASH_BOOT_OFFSET;
+    redboot_flash_start = (CYG_ADDRESS)flash_start + CYGBLD_REDBOOT_FLASH_BOOT_OFFSET;
 #ifdef CYGOPT_REDBOOT_FIS_REDBOOT
     memset(img, 0, sizeof(*img));
     strcpy(img->name, "RedBoot");
@@ -235,7 +237,7 @@ fis_init(int argc, char *argv[])
 #ifdef CYGOPT_REDBOOT_FIS_REDBOOT_POST
 #ifdef CYGNUM_REDBOOT_FIS_REDBOOT_POST_OFFSET
     // Take care to place the POST entry at the right offset:
-    redboot_flash_start = (unsigned long)flash_start + CYGNUM_REDBOOT_FIS_REDBOOT_POST_OFFSET;
+    redboot_flash_start = (CYG_ADDRESS)flash_start + CYGNUM_REDBOOT_FIS_REDBOOT_POST_OFFSET;
 #endif
     memset(img, 0, sizeof(*img));
     strcpy(img->name, "RedBoot[post]");
@@ -259,30 +261,16 @@ fis_init(int argc, char *argv[])
     // And a descriptor for the configuration data
     memset(img, 0, sizeof(*img));
     strcpy(img->name, "RedBoot config");
-    if (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK < 0) {
-        cfg_base = (void *)((unsigned long)flash_end + 
-                            (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size));
-    } else {
-        cfg_base = (void *)((unsigned long)flash_start + 
-                            (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size));
-    }
-    img->flash_base = (unsigned long)cfg_base;
-    img->mem_base = (unsigned long)cfg_base;
+    img->flash_base = (CYG_ADDRESS)cfg_base;
+    img->mem_base = (CYG_ADDRESS)cfg_base;
     img->size = cfg_size;
     img++;
 #endif
     // And a descriptor for the descriptor table itself
     memset(img, 0, sizeof(*img));
     strcpy(img->name, "FIS directory");
-    if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
-        fis_base = (void *)((unsigned long)flash_end + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    } else {
-        fis_base = (void *)((unsigned long)flash_start + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    }
-    img->flash_base = (unsigned long)fis_base;
-    img->mem_base = (unsigned long)fis_base;
+    img->flash_base = (CYG_ADDRESS)fis_addr;
+    img->mem_base = (CYG_ADDRESS)fis_addr;
     img->size = block_size;
     img++;
 
@@ -290,12 +278,14 @@ fis_init(int argc, char *argv[])
     // calculates where the high water mark of default RedBoot images is.
 
     if (full_init) {
-        unsigned long erase_start, erase_size;
+        unsigned long erase_size;
+        CYG_ADDRESS erase_start;
         // Erase everything except default RedBoot images, fis block, 
         // and config block.
         // First deal with the possible first part, before RedBoot images:
-        erase_start = (unsigned long)flash_start + CYGNUM_REDBOOT_FLASH_RESERVED_BASE;
-        erase_size =  (unsigned long)flash_start + CYGBLD_REDBOOT_FLASH_BOOT_OFFSET;
+#if (CYGBLD_REDBOOT_FLASH_BOOT_OFFSET > CYGNUM_REDBOOT_FLASH_RESERVED_BASE)
+        erase_start = (CYG_ADDRESS)flash_start + CYGNUM_REDBOOT_FLASH_RESERVED_BASE;
+        erase_size =  (CYG_ADDRESS)flash_start + CYGBLD_REDBOOT_FLASH_BOOT_OFFSET;
         if ( erase_size > erase_start ) {
             erase_size -= erase_start;
             if ((stat = flash_erase((void *)erase_start, erase_size,
@@ -304,15 +294,16 @@ fis_init(int argc, char *argv[])
                             err_addr, flash_errmsg(stat));
             }
         }
+#endif
         // second deal with the larger part in the main:
         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 (fis_base > cfg_base) {
-          erase_size = (unsigned long)cfg_base - erase_start; // the gap between HWM and config data
+        if (fis_addr > cfg_base) {
+          erase_size = (CYG_ADDRESS)cfg_base - erase_start; // the gap between HWM and config data
         } else {
-          erase_size = (unsigned long)fis_base - erase_start; // the gap between HWM and fis data
+          erase_size = (CYG_ADDRESS)fis_addr - erase_start; // the gap between HWM and fis data
         }
         if ((stat = flash_erase((void *)erase_start, erase_size,
                                 (void **)&err_addr)) != 0) {
@@ -320,10 +311,10 @@ fis_init(int argc, char *argv[])
                  err_addr, flash_errmsg(stat));
         }
         erase_start += (erase_size + block_size);
-        if (fis_base > cfg_base) {
-          erase_size = (unsigned long)fis_base - erase_start; // the gap between config and fis data
+        if (fis_addr > cfg_base) {
+          erase_size = (CYG_ADDRESS)fis_addr - erase_start; // the gap between config and fis data
         } else {
-          erase_size = (unsigned long)cfg_base - erase_start; // the gap between fis and config data
+          erase_size = (CYG_ADDRESS)cfg_base - erase_start; // the gap between fis and config data
         }
         if ((stat = flash_erase((void *)erase_start, erase_size,
                                 (void **)&err_addr)) != 0) {
@@ -332,7 +323,7 @@ fis_init(int argc, char *argv[])
         }
         erase_start += (erase_size + block_size);
 #else  // !CYGSEM_REDBOOT_FLASH_CONFIG        
-        erase_size = (unsigned long)fis_base - erase_start; // the gap between HWM and fis data
+        erase_size = (CYG_ADDRESS)fis_addr - erase_start; // the gap between HWM and fis data
         if ((stat = flash_erase((void *)erase_start, erase_size,
                                 (void **)&err_addr)) != 0) {
           diag_printf("   initialization failed %p: %s\n",
@@ -341,7 +332,7 @@ fis_init(int argc, char *argv[])
         erase_start += (erase_size + block_size);          
 #endif
         // Lastly, anything at the end
-        erase_size = (unsigned long)flash_end - erase_start;
+        erase_size = ((CYG_ADDRESS)flash_end - erase_start) + 1;
         if ((stat = flash_erase((void *)erase_start, erase_size,
                                 (void **)&err_addr)) != 0) {
             diag_printf("   initialization failed at %p: %s\n",
@@ -353,13 +344,13 @@ fis_init(int argc, char *argv[])
 
 #ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
     // Ensure [quietly] that the directory is unlocked before trying to update
-    flash_unlock((void *)fis_base, block_size, (void **)&err_addr);
+    flash_unlock((void *)fis_addr, block_size, (void **)&err_addr);
 #endif
-    if ((stat = flash_erase(fis_base, block_size, (void **)&err_addr)) != 0) {
+    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_base, fis_work_block, 
-                                  (unsigned long)img - (unsigned long)fis_work_block,
+        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));
@@ -367,7 +358,7 @@ fis_init(int argc, char *argv[])
     }
 #ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
     // Ensure [quietly] that the directory is locked after the update
-    flash_lock((void *)fis_base, block_size, (void **)&err_addr);
+    flash_lock((void *)fis_addr, block_size, (void **)&err_addr);
 #endif
 }
 
@@ -393,13 +384,7 @@ fis_list(int argc, char *argv[])
     {
         return;
     }
-    if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
-        img = (void *)((unsigned long)flash_end + 
-                       (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    } else {
-        img = (void *)((unsigned long)flash_start + 
-                       (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    }
+    img = (struct fis_image_desc *)fis_work_block;
     // Let diag_printf do the formatting in both cases, rather than counting
     // cols by hand....
     diag_printf("%-16s  %-10s  %-10s  %-10s  %-s\n",
@@ -430,15 +415,15 @@ fis_free(int argc, char *argv[])
     unsigned long *area_start;
 
     // Do not search the area reserved for pre-RedBoot systems:
-    fis_ptr = (unsigned long *)((unsigned long)flash_start + CYGNUM_REDBOOT_FLASH_RESERVED_BASE);
-    fis_end = (unsigned long *)(unsigned long)flash_end;
+    fis_ptr = (unsigned long *)((CYG_ADDRESS)flash_start + CYGNUM_REDBOOT_FLASH_RESERVED_BASE);
+    fis_end = (unsigned long *)(CYG_ADDRESS)flash_end;
     area_start = fis_ptr;
     while (fis_ptr < fis_end) {
         if (*fis_ptr != (unsigned long)0xFFFFFFFF) {
             if (area_start != fis_ptr) {
                 // Assume that this is something
                 diag_printf("  0x%08lX .. 0x%08lX\n",
-                            (unsigned long)area_start, (unsigned long)fis_ptr);
+                            (CYG_ADDRESS)area_start, (CYG_ADDRESS)fis_ptr);
             }
             // Find next blank block
             area_start = fis_ptr;
@@ -446,36 +431,36 @@ fis_free(int argc, char *argv[])
                 if (*area_start == (unsigned long)0xFFFFFFFF) {
                     break;
                 }
-                area_start += block_size / sizeof(unsigned long);
+                area_start += block_size / sizeof(CYG_ADDRESS);
             }
             fis_ptr = area_start;
         } else {
-            fis_ptr += block_size / sizeof(unsigned long);
+            fis_ptr += block_size / sizeof(CYG_ADDRESS);
         }
     }
     if (area_start != fis_ptr) {
         diag_printf("  0x%08lX .. 0x%08lX\n", 
-                    (unsigned long)area_start, (unsigned long)fis_ptr);
+                    (CYG_ADDRESS)area_start, (CYG_ADDRESS)fis_ptr);
     }
 }
 
 // Find the first unused area of flash which is long enough
 static bool
-fis_find_free(unsigned long *addr, unsigned long length)
+fis_find_free(CYG_ADDRESS *addr, unsigned long length)
 {
     unsigned long *fis_ptr, *fis_end;
     unsigned long *area_start;
 
     // Do not search the area reserved for pre-RedBoot systems:
-    fis_ptr = (unsigned long *)((unsigned long)flash_start + CYGNUM_REDBOOT_FLASH_RESERVED_BASE);
-    fis_end = (unsigned long *)(unsigned long)flash_end;
+    fis_ptr = (unsigned long *)((CYG_ADDRESS)flash_start + CYGNUM_REDBOOT_FLASH_RESERVED_BASE);
+    fis_end = (unsigned long *)(CYG_ADDRESS)flash_end;
     area_start = fis_ptr;
     while (fis_ptr < fis_end) {
         if (*fis_ptr != (unsigned long)0xFFFFFFFF) {
             if (area_start != fis_ptr) {
                 // Assume that this is something
                 if ((fis_ptr-area_start) >= (length/sizeof(unsigned))) {
-                    *addr = (unsigned long)area_start;
+                    *addr = (CYG_ADDRESS)area_start;
                     return true;
                 }
             }
@@ -485,16 +470,16 @@ fis_find_free(unsigned long *addr, unsig
                 if (*area_start == (unsigned long)0xFFFFFFFF) {
                     break;
                 }
-                area_start += block_size / sizeof(unsigned long);
+                area_start += block_size / sizeof(CYG_ADDRESS);
             }
             fis_ptr = area_start;
         } else {
-            fis_ptr += block_size / sizeof(unsigned long);
+            fis_ptr += block_size / sizeof(CYG_ADDRESS);
         }
     }
     if (area_start != fis_ptr) {
         if ((fis_ptr-area_start) >= (length/sizeof(unsigned))) {
-            *addr = (unsigned long)area_start;
+            *addr = (CYG_ADDRESS)area_start;
             return true;
         }
     }
@@ -505,7 +490,8 @@ static void
 fis_create(int argc, char *argv[])
 {
     int i, stat;
-    unsigned long mem_addr, exec_addr, flash_addr, entry_addr, length, img_size;
+    unsigned long length, img_size;
+    CYG_ADDRESS mem_addr, exec_addr, flash_addr, entry_addr;
     char *name;
     bool mem_addr_set = false;
     bool exec_addr_set = false;
@@ -514,11 +500,11 @@ fis_create(int argc, char *argv[])
     bool length_set = false;
     bool img_size_set = false;
     bool no_copy = false;
-    void *fis_addr, *err_addr;
+    void *err_addr;
     struct fis_image_desc *img;
     bool slot_found, defaults_assumed;
     struct option_info opts[7];
-    bool prog_ok = false;
+    bool prog_ok = true;
 
     init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 
               (void **)&mem_addr, (bool *)&mem_addr_set, "memory base address");
@@ -543,14 +529,6 @@ fis_create(int argc, char *argv[])
     defaults_assumed = false;
     if (name) {
         // Search existing files to acquire defaults for params not specified:
-        if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
-            fis_addr = (void *)((unsigned long)flash_end + 
-                                (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-        } else {
-            fis_addr = (void *)((unsigned long)flash_start + 
-                                (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-        }
-        memcpy(fis_work_block, fis_addr, block_size);
         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)) {
@@ -595,8 +573,7 @@ fis_create(int argc, char *argv[])
     if (flash_addr_set &&
         ((stat = flash_verify_addr((void *)flash_addr)) ||
          (stat = flash_verify_addr((void *)(flash_addr+img_size-1))))) {
-        diag_printf("Invalid FLASH address %p: %s\n", (void *)flash_addr, flash_errmsg(stat));
-        diag_printf("   valid range is %p-%p\n", (void *)flash_start, (void *)flash_end);
+        _show_invalid_flash_address(flash_addr, stat);
         return;
     }
     if (flash_addr_set && flash_addr & (block_size-1)) {
@@ -609,8 +586,8 @@ fis_create(int argc, char *argv[])
         return;
     }
     if (!no_copy) {
-        if ((mem_addr < (unsigned long)ram_start) ||
-            ((mem_addr+img_size) >= (unsigned long)ram_end)) {
+        if ((mem_addr < (CYG_ADDRESS)ram_start) ||
+            ((mem_addr+img_size) >= (CYG_ADDRESS)ram_end)) {
             diag_printf("** WARNING: RAM address: %p may be invalid\n", (void *)mem_addr);
             diag_printf("   valid range is %p-%p\n", (void *)ram_start, (void *)ram_end);
         }
@@ -622,14 +599,6 @@ 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;
-    if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
-        fis_addr = (void *)((unsigned long)flash_end + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    } else {
-        fis_addr = (void *)((unsigned long)flash_start + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    }
-    memcpy(fis_work_block, fis_addr, block_size);
     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)) {
@@ -672,7 +641,6 @@ fis_create(int argc, char *argv[])
             diag_printf("Can't program this region - contains code in use!\n");
             return;
         }
-        prog_ok = true;
         if (prog_ok) {
             // Erase area to be programmed
             if ((stat = flash_erase((void *)flash_addr, length, (void **)&err_addr)) != 0) {
@@ -694,7 +662,7 @@ fis_create(int argc, char *argv[])
         strcpy(img->name, name);
         img->flash_base = flash_addr;
         img->mem_base = exec_addr_set ? exec_addr : (flash_addr_set ? flash_addr : mem_addr);
-        img->entry_point = entry_addr_set ? entry_addr : (unsigned long)entry_address;  // Hope it's been set
+        img->entry_point = entry_addr_set ? entry_addr : (CYG_ADDRESS)entry_address;  // Hope it's been set
         img->size = length;
         img->data_length = img_size;
 #ifdef CYGSEM_REDBOOT_FIS_CRC_CHECK
@@ -725,7 +693,7 @@ fis_delete(int argc, char *argv[])
 {
     char *name;
     int num_reserved, i, stat;
-    void *fis_addr, *err_addr;
+    void *err_addr;
     struct fis_image_desc *img;
     bool slot_found;
 
@@ -735,14 +703,6 @@ fis_delete(int argc, char *argv[])
         return;
     }
     slot_found = false;
-    if (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK < 0) {
-        fis_addr = (void *)((unsigned long)flash_end + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    } else {
-        fis_addr = (void *)((unsigned long)flash_start + 
-                            (CYGNUM_REDBOOT_FIS_DIRECTORY_BLOCK*block_size));
-    }
-    memcpy(fis_work_block, fis_addr, block_size);
     img = (struct fis_image_desc *)fis_work_block;
     num_reserved = 0;
 #ifdef CYGOPT_REDBOOT_FIS_RESERVED_BASE
@@ -813,7 +773,7 @@ fis_load(int argc, char *argv[])
 {
     char *name;
     struct fis_image_desc *img;
-    unsigned long mem_addr;
+    CYG_ADDRESS mem_addr;
     bool mem_addr_set = false;
     bool show_cksum = false;
     struct option_info opts[3];
@@ -849,8 +809,8 @@ fis_load(int argc, char *argv[])
         mem_addr = img->mem_base;
     }
     // Load image from FLASH into RAM
-    if ((mem_addr < (unsigned long)user_ram_start) ||
-        ((mem_addr+img->size) >= (unsigned long)user_ram_end)) {
+    if ((mem_addr < (CYG_ADDRESS)user_ram_start) ||
+        ((mem_addr+img->size) >= (CYG_ADDRESS)user_ram_end)) {
         diag_printf("Not a loadable image\n");
         return;
     }
@@ -905,7 +865,8 @@ static void
 fis_write(int argc, char *argv[])
 {
     int stat;
-    unsigned long mem_addr, flash_addr, length;
+    unsigned long length;
+    CYG_ADDRESS mem_addr, flash_addr;
     bool mem_addr_set = false;
     bool flash_addr_set = false;
     bool length_set = false;
@@ -937,8 +898,7 @@ fis_write(int argc, char *argv[])
     if (flash_addr_set &&
         ((stat = flash_verify_addr((void *)flash_addr)) ||
          (stat = flash_verify_addr((void *)(flash_addr+length-1))))) {
-        diag_printf("Invalid FLASH address %p: (%s)\n", (void *)flash_addr, flash_errmsg(stat));
-        diag_printf("   valid range is %p-%p\n", (void *)flash_start, (void *)flash_end);
+        _show_invalid_flash_address(flash_addr, stat);
         return;
     }
     if (flash_addr_set && flash_addr & (block_size-1)) {
@@ -946,8 +906,8 @@ fis_write(int argc, char *argv[])
         diag_printf("   must be 0x%x aligned\n", block_size);
         return;
     }
-    if ((mem_addr < (unsigned long)ram_start) ||
-        ((mem_addr+length) >= (unsigned long)ram_end)) {
+    if ((mem_addr < (CYG_ADDRESS)ram_start) ||
+        ((mem_addr+length) >= (CYG_ADDRESS)ram_end)) {
         diag_printf("** WARNING: RAM address: %p may be invalid\n", (void *)mem_addr);
         diag_printf("   valid range is %p-%p\n", (void *)ram_start, (void *)ram_end);
     }
@@ -982,7 +942,8 @@ static void
 fis_erase(int argc, char *argv[])
 {
     int stat;
-    unsigned long flash_addr, length;
+    unsigned long length;
+    CYG_ADDRESS flash_addr;
     bool flash_addr_set = false;
     bool length_set = false;
     void *err_addr;
@@ -1005,8 +966,7 @@ fis_erase(int argc, char *argv[])
     if (flash_addr_set &&
         ((stat = flash_verify_addr((void *)flash_addr)) ||
          (stat = flash_verify_addr((void *)(flash_addr+length-1))))) {
-        diag_printf("Invalid FLASH address %p: %s\n", (void *)flash_addr, flash_errmsg(stat));
-        diag_printf("   valid range is %p-%p\n", (void *)flash_start, (void *)flash_end);
+        _show_invalid_flash_address(flash_addr, stat);
         return;
     }
     if (flash_addr_set && flash_addr & (block_size-1)) {
@@ -1030,7 +990,8 @@ static void
 fis_lock(int argc, char *argv[])
 {
     int stat;
-    unsigned long flash_addr, length;
+    unsigned long length;
+    CYG_ADDRESS flash_addr;
     bool flash_addr_set = false;
     bool length_set = false;
     void *err_addr;
@@ -1053,8 +1014,7 @@ fis_lock(int argc, char *argv[])
     if (flash_addr_set &&
         ((stat = flash_verify_addr((void *)flash_addr)) ||
          (stat = flash_verify_addr((void *)(flash_addr+length-1))))) {
-        diag_printf("Invalid FLASH address %p: %s\n", (void *)flash_addr, flash_errmsg(stat));
-        diag_printf("   valid range is %p-%p\n", (void *)flash_start, (void *)flash_end);
+        _show_invalid_flash_address(flash_addr, stat);
         return;
     }
     if ((stat = flash_lock((void *)flash_addr, length, (void **)&err_addr)) != 0) {
@@ -1066,7 +1026,8 @@ static void
 fis_unlock(int argc, char *argv[])
 {
     int stat;
-    unsigned long flash_addr, length;
+    unsigned long length;
+    CYG_ADDRESS flash_addr;
     bool flash_addr_set = false;
     bool length_set = false;
     void *err_addr;
@@ -1089,8 +1050,7 @@ fis_unlock(int argc, char *argv[])
     if (flash_addr_set &&
         ((stat = flash_verify_addr((void *)flash_addr)) ||
          (stat = flash_verify_addr((void *)(flash_addr+length-1))))) {
-        diag_printf("Invalid FLASH address %p: %s\n", (void *)flash_addr, flash_errmsg(stat));
-        diag_printf("   valid range is %p-%p\n", (void *)flash_start, (void *)flash_end);
+        _show_invalid_flash_address(flash_addr, stat);
         return;
     }
     if ((stat = flash_unlock((void *)flash_addr, length, (void **)&err_addr)) != 0) {
@@ -1099,6 +1059,7 @@ fis_unlock(int argc, char *argv[])
 }
 #endif
 
+// This is set non-zero if the FLASH subsystem has successfully been initialized
 static int __flash_init = 0;
 
 void
@@ -1106,7 +1067,7 @@ void
 {
     if (!__flash_init) return;
     diag_printf("FLASH: %p - %p, %d blocks of %p bytes each.\n", 
-           flash_start, flash_end, blocks, (void *)block_size);
+           flash_start, (CYG_ADDRWORD)flash_end + 1, blocks, (void *)block_size);
 }
 
 static bool
@@ -1122,10 +1083,15 @@ do_flash_init(void)
             return false;
         }
         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);
-        fis_work_block = (unsigned char *)(workspace_end-FLASH_MIN_WORKSPACE-block_size);
-        workspace_end = fis_work_block;
+        workspace_end = (unsigned char *)(workspace_end-FLASH_MIN_WORKSPACE);
+#ifdef CYGOPT_REDBOOT_FIS
+        workspace_end = (unsigned char *)(workspace_end-block_size);
+        fis_work_block = workspace_end;
         fisdir_size = block_size;
+#endif
     }
     return true;
 }
@@ -1143,7 +1109,20 @@ do_fis(int argc, char *argv[])
         fis_usage("too few arguments");
         return;
     }
-    if (!do_flash_init()) return;
+    if (!do_flash_init()) {
+        diag_printf("Sorry, no FLASH memory is available\n");
+        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);
+#endif
     if ((cmd = cmd_search(__FIS_cmds_TAB__, &__FIS_cmds_TAB_END__, 
                           argv[1])) != (struct cmd *)0) {
         (cmd->fun)(argc, argv);
@@ -1163,7 +1142,7 @@ static struct _config {
     unsigned char config_data[MAX_CONFIG_DATA-(4*4)];
     unsigned long key2;
     unsigned long cksum;
-} config;
+} *config, *backup_config;
 static bool config_ok;
 
 #define CONFIG_KEY1    0x0BADFACE
@@ -1365,7 +1344,7 @@ get_config(unsigned char *dp, char *titl
 #ifdef CYGPKG_REDBOOT_NETWORKING
     case CONFIG_IP:
         memcpy(&hold_ip_val.s_addr, &((in_addr_t *)val_ptr)->s_addr, sizeof(in_addr_t));
-        if (!inet_aton(line, &new_ip_val)) {
+        if (!_gethostbyname(line, &new_ip_val)) {
             return CONFIG_BAD;
         }
         if (hold_ip_val.s_addr != new_ip_val.s_addr) {
@@ -1459,7 +1438,6 @@ 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 _config hold_config;
     struct option_info opts[4];
     bool list_only;
     bool nicknames;
@@ -1473,8 +1451,11 @@ do_flash_config(int argc, char *argv[])
     bool doneone = false;
     bool init = false;
 
-    if (!do_flash_init()) return;
-    memcpy(&hold_config, &config, sizeof(config));
+    if (!__flash_init) {
+        diag_printf("Sorry, no FLASH memory is available\n");
+        return;
+    }
+    memcpy(backup_config, config, sizeof(struct _config));
     script = (unsigned char *)0;
 
     init_opts(&opts[0], 'l', false, OPTION_ARG_TYPE_FLG, 
@@ -1507,8 +1488,8 @@ do_flash_config(int argc, char *argv[])
         config_init();
     }
 
-    dp = &config.config_data[0];
-    while (dp < &config.config_data[sizeof(config.config_data)]) {
+    dp = &config->config_data[0];
+    while (dp < &config->config_data[sizeof(config->config_data)]) {
         if (CONFIG_OBJECT_TYPE(dp) == CONFIG_EMPTY) {
             break;
         }
@@ -1534,7 +1515,7 @@ do_flash_config(int argc, char *argv[])
         case CONFIG_DONE:
             goto done;
         case CONFIG_ABORT:
-            memcpy(&config, &hold_config, sizeof(config));
+            memcpy(config, backup_config, sizeof(struct _config));
             return;
         case CONFIG_CHANGED:
             need_update = true;
@@ -1542,7 +1523,7 @@ do_flash_config(int argc, char *argv[])
             dp += len;
             break;
         case CONFIG_BACK:
-            dp = &config.config_data[0];
+            dp = &config->config_data[0];
             continue;
         case CONFIG_BAD:
             // Nothing - make him do it again
@@ -1607,7 +1588,7 @@ do_alias(int argc, char *argv[])
         opt.enable = (char *)0;
         opt.enable_sense = 1;
         opt.key = name;
-        opt.dflt = (unsigned long)argv[2];
+        opt.dflt = (CYG_ADDRESS)argv[2];
         flash_add_config(&opt, true);
         break;
     default:
@@ -1615,20 +1596,64 @@ do_alias(int argc, char *argv[])
     }
 }
 
+// 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)
+lookup_alias(char *alias, char *alias_buf)
 {
     char name[80];
     char *val;
+    unsigned char * dp;
+    void *val_ptr;
+    int type;
+    bool hold_bool_val;
+    long hold_long_val;
+    int esa_ptr;
 
     make_alias(name, alias);
     if (flash_get_config(name, &val, CONFIG_STRING)) {
         return val;
     } else {
+        dp = flash_lookup_config(alias);
+        if (dp) {
+            val_ptr = (void *)CONFIG_OBJECT_VALUE(dp);
+            switch (type = CONFIG_OBJECT_TYPE(dp)) {
+            case CONFIG_BOOL:
+                memcpy(&hold_bool_val, val_ptr, sizeof(bool));
+                diag_sprintf(alias_buf, "%s", hold_bool_val ? "true" : "false");
+                break;
+            case CONFIG_INT:
+                memcpy(&hold_long_val, val_ptr, sizeof(unsigned long));
+                diag_sprintf(alias_buf,"%ld", hold_long_val);
+                break;
+#ifdef CYGPKG_REDBOOT_NETWORKING
+            case CONFIG_IP:
+                diag_sprintf(alias_buf,"%s", inet_ntoa((in_addr_t *)val_ptr));
+                break;
+            case CONFIG_ESA:
+                for (esa_ptr = 0;  esa_ptr < sizeof(enet_addr_t);  esa_ptr++) {
+                    diag_sprintf(alias_buf+(3*esa_ptr), "0x%02X", ((unsigned char *)val_ptr)[esa_ptr]);
+                    if (esa_ptr < (sizeof(enet_addr_t)-1)) diag_printf(":");
+                }
+                break;
+#endif
+            case CONFIG_SCRIPT:
+                return (char *) val_ptr;
+                break;
+            default:
+                return (char *)NULL;
+            }
+            return alias_buf;
+        } 
         return (char *)NULL;
     }
 }
 
+// Expand aliases, this is recursive. ie if one alias contains other
+// aliases, these will also be expanded from the insertion point
+// onwards.
 bool
 _expand_aliases(char *line, int len)
 {
@@ -1637,6 +1662,7 @@ bool
     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) {
@@ -1655,18 +1681,26 @@ bool
                 me = lp;
                 *me = '\0';
                 lp++;
-                if ((alias = lookup_alias(ms)) != (char *)NULL) {
+                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];
-                        me = &ep[offset];
-                        while (ep != (lp-1)) {
-                            ep[offset-1] = *ep--;
-                        }                    
-                        *me = '\0';
+			ep = &lp[strlen(lp)-1];
+			if (offset > 1) {
+                            ep[offset] = '\0';
+                            while (ep != (lp-1)) {
+                                ep[offset-1] = *ep--;
+                            }           
+			} else {
+                            if (offset <=0) {
+                                while ((lp-1) != ep) {
+                                    lp[offset-1] = *lp++;
+                                }
+                                lp[offset-1]='\0';
+                            }
+			}
                         // Insert the macro/alias data
                         lp = ms-2;
                         while (*alias) {
@@ -1674,6 +1708,7 @@ bool
                             *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
@@ -1708,17 +1743,10 @@ flash_write_config(void)
     int stat;
     void *err_addr;
 
-    config.len = sizeof(config);
-    config.key1 = CONFIG_KEY1;  
-    config.key2 = CONFIG_KEY2;
-    config.cksum = crc32((unsigned char *)&config, sizeof(config)-sizeof(config.cksum));
-    if (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK < 0) {
-        cfg_base = (void *)((unsigned long)flash_end + 
-                            (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size));
-    } else {
-        cfg_base = (void *)((unsigned long)flash_start + 
-                            (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size));
-    }
+    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_LOCK_SPECIAL
         // Insure [quietly] that the config page is unlocked before trying to update
@@ -1727,8 +1755,8 @@ flash_write_config(void)
         if ((stat = flash_erase(cfg_base, cfg_size, (void **)&err_addr)) != 0) {
             diag_printf("   initialization failed at %p: %s\n", err_addr, flash_errmsg(stat));
         } else {
-            if ((stat = flash_program(cfg_base, (void *)&config, 
-                                      sizeof(config), (void **)&err_addr)) != 0) {
+            if ((stat = flash_program(cfg_base, (void *)config, sizeof(struct _config), 
+                                      (void **)&err_addr)) != 0) {
                 diag_printf("Error writing config data at %p: %s\n", 
                             err_addr, flash_errmsg(stat));
             }
@@ -1751,8 +1779,8 @@ flash_lookup_config(char *key)
 
     if (!config_ok) return (unsigned char *)NULL;
 
-    dp = &config.config_data[0];
-    while (dp < &config.config_data[sizeof(config.config_data)]) {
+    dp = &config->config_data[0];
+    while (dp < &config->config_data[sizeof(config->config_data)]) {
         len = 4 + CONFIG_OBJECT_KEYLEN(dp) + CONFIG_OBJECT_ENABLE_KEYLEN(dp) +
             config_length(CONFIG_OBJECT_TYPE(dp));
         if (strcmp(key, CONFIG_OBJECT_KEY(dp)) == 0) {
@@ -1857,9 +1885,9 @@ flash_add_config(struct config_option *o
         return true;
     }
     // Add the data item
-    dp = &config.config_data[0];
+    dp = &config->config_data[0];
     size = 0;
-    while (size < sizeof(config.config_data)) {
+    while (size < sizeof(config->config_data)) {
         if (CONFIG_OBJECT_TYPE(dp) == CONFIG_EMPTY) {
             kp = opt->key;
             len = strlen(kp) + 1;
@@ -1870,7 +1898,7 @@ flash_add_config(struct config_option *o
             } else {
                 elen = 0;
             }
-            if (size > sizeof(config.config_data)) {
+            if (size > sizeof(config->config_data)) {
                 break;
             }
             CONFIG_OBJECT_TYPE(dp) = opt->type; 
@@ -1911,7 +1939,7 @@ config_init(void)
     struct config_option *optend = __CONFIG_options_TAB_END__;
     struct config_option *opt = __CONFIG_options_TAB__;
 
-    memset(&config, 0, sizeof(config));
+    memset(config, 0, sizeof(struct _config));
     while (opt != optend) {
         if (!flash_add_config(opt, false)) {
             return;
@@ -1934,19 +1962,24 @@ load_flash_config(void)
     config_ok = false;
     script = (unsigned char *)0;
     if (!do_flash_init()) return;
+    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(config)) ? sizeof(config) : 
-                                               _roundup(sizeof(config), block_size);
+    cfg_size = (block_size > sizeof(struct _config)) ? 
+        sizeof(struct _config) : 
+        _roundup(sizeof(struct _config), block_size);
     if (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK < 0) {
-        cfg_base = (void *)((unsigned long)flash_end + 
+        cfg_base = (void *)((CYG_ADDRESS)flash_end + 1 +
                             (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size));
     } else {
-        cfg_base = (void *)((unsigned long)flash_start + 
+        cfg_base = (void *)((CYG_ADDRESS)flash_start + 
                             (CYGNUM_REDBOOT_FLASH_CONFIG_BLOCK*block_size));
     }
-    memcpy(&config, cfg_base, sizeof(config));
-    if ((crc32((unsigned char *)&config, sizeof(config)-sizeof(config.cksum)) != config.cksum) ||
-        (config.key1 != CONFIG_KEY1)|| (config.key2 != CONFIG_KEY2)) {
+    memcpy(config, cfg_base, sizeof(struct _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_init();
         return;
--- a/packages/redboot/current/src/load.c
+++ b/packages/redboot/current/src/load.c
@@ -61,6 +61,9 @@ static char usage[] = "[-r] [-v] "
 #ifdef CYGPKG_REDBOOT_DISK
                       " | disk"
 #endif
+#if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1
+                      "-c <channel_number>"
+#endif
                       "}]\n        [-b <base_address>] <file_name>";
 
 // Exported CLI function
@@ -292,11 +295,13 @@ do_load(int argc, char *argv[])
 #ifdef CYGPKG_COMPRESS_ZLIB
     bool decompress;
 #endif
+    int chan = -1;
+    bool chan_set;
     unsigned long base = 0;
     unsigned long end = 0;
     char type[4];
     char *filename = 0;
-    struct option_info opts[6];
+    struct option_info opts[7];
 
 #ifdef CYGPKG_REDBOOT_NETWORKING
     memset((char *)&host, 0, sizeof(host));
@@ -320,9 +325,14 @@ do_load(int argc, char *argv[])
     init_opts(&opts[3], 'm', true, OPTION_ARG_TYPE_STR, 
               (void **)&mode_str, (bool *)&mode_str_set, "download mode (TFTP, xyzMODEM, or disk)");
     num_options = 4;
+#if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1
+    init_opts(&opts[num_options], 'c', true, OPTION_ARG_TYPE_NUM, 
+              (void **)&chan, (bool *)&chan_set, "I/O channel");
+    num_options++;
+#endif
 #ifdef CYGPKG_REDBOOT_NETWORKING
     init_opts(&opts[num_options], 'h', true, OPTION_ARG_TYPE_STR, 
-              (void **)&hostname, (bool *)&hostname_set, "host name (IP address)");
+              (void **)&hostname, (bool *)&hostname_set, "host name or IP address");
     num_options++;
 #endif
 #ifdef CYGPKG_COMPRESS_ZLIB
@@ -337,8 +347,15 @@ do_load(int argc, char *argv[])
     }
 #ifdef CYGPKG_REDBOOT_NETWORKING
     if (hostname_set) {
-        if (!inet_aton(hostname, (in_addr_t *)&host)) {
-            diag_printf("Invalid IP address: %s\n", hostname);
+        ip_route_t rt;
+        if (!_gethostbyname(hostname, (in_addr_t *)&host)) {
+            diag_printf("Invalid host: %s\n", hostname);
+            return;
+        }
+        /* check that the host can be accessed */
+        if (__arp_lookup((ip_addr_t *)&host.sin_addr, &rt) < 0) {
+            diag_printf("Unable to reach host %s (%s)\n",
+                        hostname, inet_ntoa((in_addr_t *)&host));
             return;
         }
     }
@@ -386,6 +403,20 @@ do_load(int argc, char *argv[])
         return;
     }
 #endif
+#if CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS > 1
+    if (chan_set) {
+        if ((mode != MODE_XMODEM) && (mode != MODE_YMODEM) && (mode != MODE_ZMODEM)) {
+            diag_printf("I/O channel can only be used with {xyz}Modem\n");
+            return;
+        }
+        if (chan >= CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS) {
+            diag_printf("Invalid I/O channel: %d\n", chan);
+            return;
+        }
+    } else {
+        chan = -1;
+    }
+#endif
 #ifdef CYGSEM_REDBOOT_VALIDATE_USER_RAM_LOADS
     if (base_addr_set &&
         ((base < (unsigned long)user_ram_start) ||
@@ -419,7 +450,7 @@ do_load(int argc, char *argv[])
     }
 #endif
     else {
-        res = xyzModem_stream_open(filename, mode, &err);
+        res = xyzModem_stream_open(filename, mode, chan, &err);
         if (res < 0) {
             diag_printf("Can't load '%s': %s\n", filename, xyzModem_error(err));
             return;
--- a/packages/redboot/current/src/net/bootp.c
+++ b/packages/redboot/current/src/net/bootp.c
@@ -43,6 +43,7 @@
 //
 //==========================================================================
 
+#include <redboot.h>
 #include <net/net.h>
 #include <net/bootp.h>
 
--- a/packages/redboot/current/src/net/inet_addr.c
+++ b/packages/redboot/current/src/net/inet_addr.c
@@ -47,7 +47,7 @@
 #include <net/net.h>
 
 bool
-inet_aton(char *s, in_addr_t *addr)
+inet_aton(const char *s, in_addr_t *addr)
 {
     int i, val, radix, digit;
     unsigned long res = 0;
--- a/packages/redboot/current/src/net/net_io.c
+++ b/packages/redboot/current/src/net/net_io.c
@@ -537,8 +537,16 @@ net_init(void)
     cyg_netdevtab_entry_t *t;
 
     // Set defaults as appropriate
+#ifdef CYGSEM_REDBOOT_DEFAULT_NO_BOOTP
+    use_bootp = CYGSEM_REDBOOT_DEFAULT_NO_BOOTP;
+#else
     use_bootp = true;
+#endif
+#ifdef CYGDBG_REDBOOT_NET_DEBUG
+    net_debug = CYGDBG_REDBOOT_NET_DEBUG;
+#else
     net_debug = false;
+#endif
     gdb_port = CYGNUM_REDBOOT_NETWORKING_TCP_PORT;
 #ifdef CYGSEM_REDBOOT_FLASH_CONFIG
     // Fetch values from saved config data, if available
@@ -608,4 +616,8 @@ net_init(void)
         diag_printf(", Default server: %s\n", inet_ntoa(&my_bootp_info.bp_siaddr));
         net_io_init();
     }
+
+#ifdef CYGPKG_REDBOOT_NETWORKING_DNS
+    redboot_dns_res_init();
+#endif
 }
--- a/packages/redboot/current/src/net/ping.c
+++ b/packages/redboot/current/src/net/ping.c
@@ -94,7 +94,7 @@ do_ping(int argc, char *argv[])
     init_opts(&opts[2], 'i', true, OPTION_ARG_TYPE_STR, 
               (void **)&local_ip_addr, (bool *)&local_ip_addr_set, "local IP address");
     init_opts(&opts[3], 'h', true, OPTION_ARG_TYPE_STR, 
-              (void **)&host_ip_addr, (bool *)&host_ip_addr_set, "host IP address");
+              (void **)&host_ip_addr, (bool *)&host_ip_addr_set, "host name or IP address");
     init_opts(&opts[4], 'l', true, OPTION_ARG_TYPE_NUM, 
               (void **)&length, (bool *)&length_set, "<length> - size of payload");
     init_opts(&opts[5], 'v', false, OPTION_ARG_TYPE_FLG, 
@@ -108,24 +108,25 @@ do_ping(int argc, char *argv[])
     // Set defaults; this has to be done _after_ the scan, since it will
     // have destroyed all values not explicitly set.
     if (local_ip_addr_set) {
-        if (!inet_aton(local_ip_addr, (in_addr_t *)&local_addr)) {
-            diag_printf("PING - Invalid IP address: %s\n", local_ip_addr);
+        if (!_gethostbyname(local_ip_addr, (in_addr_t *)&local_addr)) {
+            diag_printf("PING - Invalid local name: %s\n", local_ip_addr);
             return;
         }
     } else {
         memcpy((in_addr_t *)&local_addr, __local_ip_addr, sizeof(__local_ip_addr));
     }
     if (host_ip_addr_set) {
-        if (!inet_aton(host_ip_addr, (in_addr_t *)&host_addr)) {
-            diag_printf("PING - Invalid IP address: %s\n", host_ip_addr);
+        if (!_gethostbyname(host_ip_addr, (in_addr_t *)&host_addr)) {
+            diag_printf("PING - Invalid host name: %s\n", host_ip_addr);
             return;
         }
         if (__arp_lookup((ip_addr_t *)&host_addr.sin_addr, &dest_ip) < 0) {
-            diag_printf("PING: Can't find address of server '%s'\n", host_ip_addr);
+            diag_printf("PING: Cannot reach server '%s' (%s)\n", 
+                        host_ip_addr, inet_ntoa((in_addr_t *)&host_addr));
             return;
         }
     } else {
-        diag_printf("PING - host IP address required\n");
+        diag_printf("PING - host name or IP address required\n");
         return;
     }
 #define DEFAULT_LENGTH   64
--- a/packages/redboot/current/src/net/udp.c
+++ b/packages/redboot/current/src/net/udp.c
@@ -235,7 +235,6 @@ int
     udp_socket_t skt;
     unsigned long start;
 
-    server->sin_port = 0;
     my_port = ntohs(local->sin_port);
     if (__udp_install_listener(&skt, my_port, __udp_recvfrom_handler) < 0) {
         return -1;
--- a/packages/redboot/current/src/version.c
+++ b/packages/redboot/current/src/version.c
@@ -66,14 +66,16 @@
 
 #if defined(CYGDAT_REDBOOT_CUSTOM_VERSION)
 #define _REDBOOT_VERSION CYGDAT_REDBOOT_CUSTOM_VERSION
-#define _CERTIFICATE Non-certified
 #elif defined(CYGPKG_REDBOOT_current)
 #define _REDBOOT_VERSION UNKNOWN
-#define _CERTIFICATE Non-certified
 #else
 #define _REDBOOT_VERSION CYGPKG_REDBOOT
-#define _CERTIFICATE Red Hat certified
 #endif
+
+#ifndef _CERTIFICATE
+#define _CERTIFICATE Non-certified
+#endif
+
 #define __s(x) #x
 #define _s(x) __s(x)
 
--- a/packages/redboot/current/src/xyzModem.c
+++ b/packages/redboot/current/src/xyzModem.c
@@ -295,7 +295,7 @@ xyzModem_get_hdr(void)
 }
 
 int 
-xyzModem_stream_open(char *filename, int mode, int *err)
+xyzModem_stream_open(char *filename, int mode, int chan, int *err)
 {
     int console_chan, stat;
     int retries = xyzModem_MAX_RETRIES;
@@ -309,7 +309,11 @@ xyzModem_stream_open(char *filename, int
 
     // Set up the I/O channel.  Note: this allows for using a different port in the future
     console_chan = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
-    CYGACC_CALL_IF_SET_CONSOLE_COMM(console_chan);
+    if (chan >= 0) {
+        CYGACC_CALL_IF_SET_CONSOLE_COMM(chan);
+    } else {
+        CYGACC_CALL_IF_SET_CONSOLE_COMM(console_chan);
+    }
     xyz.__chan = CYGACC_CALL_IF_CONSOLE_PROCS();
     CYGACC_CALL_IF_SET_CONSOLE_COMM(console_chan);
     CYGACC_COMM_IF_CONTROL(*xyz.__chan, __COMMCTL_SET_TIMEOUT, xyzModem_CHAR_TIMEOUT);
--- a/packages/redboot/current/src/xyzModem.h
+++ b/packages/redboot/current/src/xyzModem.h
@@ -62,7 +62,7 @@
 #define xyzModem_close 1
 #define xyzModem_abort 2
 
-int   xyzModem_stream_open(char *filename, int mode, int *err);    
+int   xyzModem_stream_open(char *filename, int mode, int chan, int *err);    
 void  xyzModem_stream_close(int *err);    
 void  xyzModem_stream_terminate(int method, int (*getc)(void));    
 int   xyzModem_stream_read(char *buf, int size, int *err);    
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/ChangeLog
@@ -0,0 +1,74 @@
+2001-01-05  Nick Garnett  <nickg@cygnus.co.uk>
+
+	* include/ppc_elf.h:
+	* include/loader.hxx:
+	Added ppc_elf.h.
+
+	* include/arm_elf.h: Brought up to date with other files.
+
+	* docs/notes.txt: Added results of some more investigations.
+
+2000-12-15  Nick Garnett  <nickg@cygnus.co.uk>
+
+	* docs/notes.txt:
+	Notes added to describe what has and has not been done here.
+
+	* docs/i386.default.ld:
+	A lightly edited version of the default linker script for Linux
+	executables. See notes.txt for what this is for.
+
+	* cdl/loader.cdl:
+	Added support for dlxxx() API functions.
+	Various modifications to make rules for various things - these are
+	only guranteed to work for the linux synthetic target at present.
+
+	* src/crtbeginS.c: 
+	* src/crtendS.c:
+	Tidied and made to work (for synthetic target only).
+
+	* include/loader.hxx:
+	* src/loader.cxx:
+	Lots of changes as a result of implementation efforts.
+
+	* include/i386_elf.h:
+	Implemented relocations. Added Linker script customizations.
+
+	* include/elf.h:
+	Removed buckchain[] array from Elf_Hash structure.
+
+	* include/dlfcn.h:
+	Implementation header for the dlxxx() functions.
+
+	* src/dload.cxx:
+	Implementation of the dlxxx() functions.
+	
+	* include/mips_elf.h:
+	* include/arm_elf.h:
+	ARM support header added. MIPS support header made compilable.
+	These are both still incomplete.
+
+	* src/dynamic.ld: Regenerated by copying and editing Linux script
+	for shared libraries.
+
+	* tests/loadfoo.cxx:
+	Some test infrastructure added and modified to use dlxxx()
+	functions. Needs more tidying.
+
+2000-11-28  Nick Garnett  <nickg@cygnus.co.uk>
+
+	* cdl/loader.cdl:
+	* include/elf.h:
+	* include/loader.hxx:
+	* include/i386_elf.h:
+	* include/mips_elf.h:
+	* src/loader.cxx:
+	* src/crtbeginS.c:
+	* src/crtendS.c:
+	* src/dlforce.c:
+	* src/dynamic.ld:	
+	* tests/foo.c:
+	* tests/loadfoo.cxx:
+	* tests/entable.c:
+	Files created to implement dynamic loader.
+	This is incomplete - currently checked in for safety.
+	
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/cdl/loader.cdl
@@ -0,0 +1,236 @@
+# ====================================================================
+#
+#      loader.cdl
+#
+#      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####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):      nickg
+# Contributors:
+# Date:           2000-11-20
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_LOADER {
+    display       "Dynamic loader"
+    description   "
+                  This package provides support for dynamic code loading."
+    include_dir   cyg/loader
+    compile       loader.cxx dload.cxx
+
+    requires      { CYGBLD_ISO_DLFCN_HEADER == "<cyg/loader/dlfcn.h>" }
+    implements    CYGINT_ISO_DLFCN
+    
+# ====================================================================
+
+    cdl_component CYGPKG_LOADER_OPTIONS {
+        display "Common memory allocator package 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_LOADER_CFLAGS_ADD {
+            display "Additional compiler flags"
+            flavor  data
+            no_define
+            default_value { "" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are used in addition
+                to the set of global flags."
+        }
+
+        cdl_option CYGPKG_LOADER_CFLAGS_REMOVE {
+            display "Suppressed compiler flags"
+            flavor  data
+            no_define
+            default_value { "-O2 -fvtable-gc" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are removed from
+                the set of global flags if present."
+        }
+
+        cdl_option CYGPKG_LOADER_LDFLAGS_ADD {
+            display "Additional compiler flags"
+            flavor  data
+            no_define
+#            default_value { "-L$(PREFIX)/lib -ldlforce" }
+            default_value { "" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are used in addition
+                to the set of global flags."
+        }
+
+        cdl_option CYGPKG_LOADER_LDFLAGS_REMOVE {
+            display "Suppressed compiler flags"
+            flavor  data
+            no_define
+            default_value { "-Wl,-static -Wl,--gc-sections" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are removed from
+                the set of global flags if present."
+        }
+	
+    }
+
+# ====================================================================
+# Dynamic library build options
+
+    cdl_option CYGBLD_LOADER_DYNAMIC_LD {
+	display    "Build linker script for dynamic libraries"
+	flavor     bool
+	default_value 1
+	description "Build a linker script for creating dynamic libraries"
+
+	make -priority 50 {
+	    <PREFIX>/lib/dynamic.ld: <PACKAGE>/src/dynamic.ld
+	    $(CC) -E -P -Wp,-MD,dynamic.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $<
+	    @echo $@ ": \\" > $(notdir $@).deps
+	    @tail +2 dynamic.tmp >> $(notdir $@).deps
+	    @echo >> $(notdir $@).deps
+	    @rm dynamic.tmp
+
+	}
+    }
+
+    cdl_option CYGBLD_LOADER_CRTBEGINS {
+	display "Build special crtbeginS.o for dynamic libraries"
+	flavor   bool
+	default_value 1
+
+	make -priority 110 {
+        <PREFIX>/lib/crtbeginS.o : <PACKAGE>/src/crtbeginS.c
+        $(CC) -Wp,-MD,crtbeginS.tmp $(INCLUDE_PATH) -g0 -Wall -finhibit-size-directive -fno-inline-functions -fno-exceptions -c -o $@ $<	    
+        @echo $@ ": \\" > $(notdir $@).deps
+        @tail +2 crtbeginS.tmp >> $(notdir $@).deps
+        @echo >> $(notdir $@).deps
+        @rm crtbeginS.tmp
+	}
+    }
+
+    cdl_option CYGBLD_LOADER_CRTENDS {
+	display "Build special crtendS.o for dynamic libraries"
+	flavor   bool
+	default_value 1
+
+	make -priority 110 {
+        <PREFIX>/lib/crtendS.o : <PACKAGE>/src/crtendS.c
+        $(CC) -Wp,-MD,crtendS.tmp $(INCLUDE_PATH) -g0 -Wall -finhibit-size-directive -fno-inline-functions -fno-exceptions -c -o $@ $<	    
+        @echo $@ ": \\" > $(notdir $@).deps
+        @tail +2 crtendS.tmp >> $(notdir $@).deps
+        @echo >> $(notdir $@).deps
+        @rm crtendS.tmp
+	}
+    }
+    
+    cdl_option CYGBLD_LOADER_DLFORCE_LIB {
+	display    "Build dynamic load library"
+	flavor     bool
+	default_value 1
+	description "Build a shared library that is to be linked with the executable
+	             to force it to be built in such a way that it is suitable for
+	             having some other shared library load against it. This is the
+	             most portable way of achieving this."
+
+	make -priority 160 {
+	    <PREFIX>/lib/libdlforce.so : <PACKAGE>/src/dlforce.c
+	            $(CC) $(CFLAGS) -Wp,-MD,dlforce.tmp $(INCLUDE_PATH) -shared -c -o src/dlforce.o $<
+	            $(CC) -g -nostdlib -L$(PREFIX)/lib -shared -Tdynamic.ld -o $@ $(PREFIX)/lib/crtbeginS.o src/dlforce.o $(PREFIX)/lib/crtendS.o
+	            @echo $@ ": \\" > $(notdir $@).deps
+                    @tail +2 dlforce.tmp >> $(notdir $@).deps
+                    @echo >> $(notdir $@).deps
+                    @rm dlforce.tmp
+	}
+    }
+    
+# ====================================================================
+# Tests
+
+
+    cdl_option CYGBLD_LOADER_TEST_FOO_LIB {
+	display    "Build a dynamic load library"
+	flavor     bool
+	default_value 1
+	description "Build a shared library for testing."
+
+	make {
+	    tests/libfoo.so : <PACKAGE>/tests/foo.c
+	            mkdir -p tests
+	            $(CC) $(CFLAGS) -Wp,-MD,foo.tmp $(INCLUDE_PATH) -shared -c -o tests/foo.o $<
+	            $(CC) $(LDFLAGS) -L$(PREFIX)/lib -shared -Tdynamic.ld -o $@ $(PREFIX)/lib/crtbeginS.o tests/foo.o $(PREFIX)/lib/crtendS.o
+	            @echo $@ ": \\" > $(notdir $@).deps
+	            @tail +2 foo.tmp >> $(notdir $@).deps
+	            @echo >> $(notdir $@).deps
+	            @rm foo.tmp
+	            cc -o entable $(REPOSITORY)/$(PACKAGE)/tests/entable.c
+	            ./entable libfoo <tests/libfoo.so >tests/libfoo.so.c
+	}
+    }
+
+    cdl_option CYGBLD_LOADER_TEST_LOADFOO {
+	display   "Build library load test program"
+	flavor    bool
+	default_value 1
+	description "Build a test program that will load the test shared library"
+
+	make {
+	    <PREFIX>/tests/services/loader/current/tests/loadfoo : <PACKAGE>/tests/loadfoo.cxx
+	            mkdir -p $(PREFIX)/tests/services/loader/current/tests
+	            $(CC) $(CFLAGS) -Wp,-MD,loadfoo.tmp $(INCLUDE_PATH) -c -o tests/loadfoo.o $< 
+#	            $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -ldlforce -o $@ $(PREFIX)/lib/crtbeginS.o tests/loadfoo.o $(PREFIX)/lib/crtendS.o
+	            $(CC) $(LDFLAGS) -Wl,-E -L$(PREFIX)/lib -Ttarget.ld -ldlforce -o $@ tests/loadfoo.o
+	            @echo $@ ": \\" > $(notdir $@).deps
+	            @tail +2 loadfoo.tmp >> $(notdir $@).deps
+	            @echo >> $(notdir $@).deps
+	            @rm loadfoo.tmp
+	    
+	}
+    }
+    
+#    cdl_option CYGPKG_LOADER_TESTS {
+#	display "Tests"
+#	flavor  data
+#	no_define
+#	calculated { "tests/loadfoo" }
+#	description   "
+#	               This option specifies the set of tests for this package."
+#    }
+    
+}
+
+# ====================================================================
+# EOF loader.cdl
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/docs/i386.default.ld
@@ -0,0 +1,224 @@
+OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+	      "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+STARTUP(vectors.o)
+ENTRY(_start)
+INPUT(extras.o)
+GROUP(libtarget.a libgcc.a)
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/local/tools/i686-pc-linux-gnu/H-i686-pc-linux-gnu/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/local/tools/i686-pc-linux-gnu/H-i686-pc-linux-gnu/i686-pc-linux-gnu/lib);
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = 0 + SIZEOF_HEADERS;
+  .hash          : { *(.hash)		}
+  .dynsym        : { *(.dynsym)		}
+  .dynstr        : { *(.dynstr)		}
+  .gnu.version   : { *(.gnu.version)	}
+  .gnu.version_d   : { *(.gnu.version_d)	}
+  .gnu.version_r   : { *(.gnu.version_r)	}
+  .rel.init      : { *(.rel.init)	}
+  .rela.init     : { *(.rela.init)	}
+  .rel.text      :
+    {
+      *(.rel.text)
+      *(.rel.text.*)
+      *(.rel.gnu.linkonce.t*)
+    }
+  .rela.text     :
+    {
+      *(.rela.text)
+      *(.rela.text.*)
+      *(.rela.gnu.linkonce.t*)
+    }
+  .rel.fini      : { *(.rel.fini)	}
+  .rela.fini     : { *(.rela.fini)	}
+  .rel.rodata    :
+    {
+      *(.rel.rodata)
+      *(.rel.rodata.*)
+      *(.rel.gnu.linkonce.r*)
+    }
+  .rela.rodata   :
+    {
+      *(.rela.rodata)
+      *(.rela.rodata.*)
+      *(.rela.gnu.linkonce.r*)
+    }
+  .rel.data      :
+    {
+      *(.rel.data)
+      *(.rel.data.*)
+      *(.rel.gnu.linkonce.d*)
+    }
+  .rela.data     :
+    {
+      *(.rela.data)
+      *(.rela.data.*)
+      *(.rela.gnu.linkonce.d*)
+    }
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.got       : { *(.rel.got)		}
+  .rela.got      : { *(.rela.got)		}
+  .rel.sdata     :
+    {
+      *(.rel.sdata)
+      *(.rel.sdata.*)
+      *(.rel.gnu.linkonce.s*)
+    }
+  .rela.sdata     :
+    {
+      *(.rela.sdata)
+      *(.rela.sdata.*)
+      *(.rela.gnu.linkonce.s*)
+    }
+  .rel.sbss      : { *(.rel.sbss)		}
+  .rela.sbss     : { *(.rela.sbss)	}
+  .rel.bss       : { *(.rel.bss)		}
+  .rela.bss      : { *(.rela.bss)		}
+  .rel.plt       : { *(.rel.plt)		}
+  .rela.plt      : { *(.rela.plt)		}
+  .init          : 
+  { 
+    KEEP (*(.init))
+  } =0x9090
+  .plt      : { *(.plt)	}
+  .text      :
+  {
+    _stext = .;
+    *(.text)
+    *(.text.*)
+    *(.stub)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+    *(.gnu.linkonce.t*)
+  } =0x9090
+  _etext = .;
+  PROVIDE (etext = .);
+  .fini      :
+  {
+    KEEP (*(.fini))
+  } =0x9090
+  .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }
+  .rodata1   : { *(.rodata1) }
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  */
+  . = ALIGN(0x1000) + (. & (0x1000 - 1));
+  .data    :
+  {
+    *(.data)
+    *(.data.*)
+    *(.gnu.linkonce.d*)
+    SORT(CONSTRUCTORS)
+  }
+  .data1   : { *(.data1) }
+  .eh_frame : { KEEP (*(.eh_frame)) }
+  .gcc_except_table : { *(.gcc_except_table) }
+  .ctors   : 
+  {
+    /* 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.  */
+    __CTOR_LIST__ = ABSOLUTE(.);
+    KEEP (*crtbegin.o(.ctors))
+    /* We don't want to include the .ctor section from
+       from the crtend.o file until after the sorted ctors.
+       The .ctor section from the crtend file contains the
+       end of ctors marker and it must be last */
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+    __CTOR_END__ = ABSOLUTE(.);
+  }
+   .dtors         :
+  {
+    __DTOR_LIST__ = ABSOLUTE(.);
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+    __DTOR_END__ = ABSOLUTE(.);
+  }
+  .got		  : { *(.got.plt) *(.got) }
+  .dynamic       : { *(.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     : 
+  {
+    *(.sdata) 
+    *(.sdata.*)
+    *(.gnu.linkonce.s.*)
+  }
+  _edata = .;
+  PROVIDE (edata = .);
+  __bss_start = .;
+  .sbss      :
+  {
+    *(.dynsbss)
+    *(.sbss)
+    *(.sbss.*)
+    *(.scommon)
+  }
+  .bss       :
+  {
+   *(.dynbss)
+   *(.bss)
+   *(.bss.*)
+   *(COMMON)
+   /* Align here to ensure that the .bss section occupies space up to
+      _end.  Align after .bss to ensure correct alignment even if the
+      .bss section disappears because there are no input sections.  */
+   . = ALIGN(32 / 8);
+  }
+  . = ALIGN(32 / 8);
+  __bss_end = .;
+  _end = .;
+  __heap1   = ALIGN (0x10);
+  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  .  */
+}
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/docs/notes.txt
@@ -0,0 +1,107 @@
+
+These notes were written to record the current state of this code.
+Much of it was written during the investigation work.
+
+At present this stuff is only partially functional. Do not assume
+anything works. In particular things like constructor/destructors and
+init/fini sections have not been fully implemented. 
+
+
+Initial Investigations
+======================	
+
+Attempts to build a simple shared library using the existing
+tools. Command line is something like:
+
+xxx-gcc -shared -o libfoo.so foo.so
+
+
+arm-elf			no - includes crt0 which fails to find main() etc.
+thumb-elf		no - includes crt0 which fails to find main() etc.
+i686-pc-linux-gnu	yes
+i386-elf		no - tries to build program
+mn10300			no - tries to build program
+powerpc-eabi		no - implicit ref to libc.so
+sh-elf			no - tries to build program
+sparclite		no - fails to find crtn.o
+mips-tx39-elf		yes - but seriously mangles PHDR DYNAMIC section
+mips66vr4300-elf	yes - but seriously mangles PHDR DYNAMIC section
+
+
+Building new Toolchains
+=======================
+
+Given the poor results from our standard toolchains, it was decided to
+try and use Linux-targeted toolchains, which are guranteed to have the
+necessary support.
+
+These builds all use bindutils-2.1.1, gcc-2.95.2 and gdb-5.0.
+
+arm-unknown-linux-gnu	build of libgcc fails looking for asm/unistd.h
+
+All MIPS Linux toolchains use collect2 constructors, so no priorities.
+MIPS support also requires PIC code support, which needs HAL
+changes. In this case it is fairly easy since the assembler does a lot
+of the conversion for us but there are still some things that need
+fixing.
+
+MIPS BSD toolchains fail building libgcc, but adding files from
+openbsd sources allows these to build. However, these then fail to
+build proper PIC code and omit some features.
+
+PowerPC toolchains need to use the full ABI, not the ebedded one, with
+TOCs and all the trimmings. This requires major changes to the
+HAL. Or maybe not - not too sure about this one.
+
+Since we are having so much difficulty getting any of these to work,
+try to get it running on the i686-pc-linux-gnu synthetic target, since
+we know that works.
+
+
+Synthetic Target
+================
+
+To enable a progam to be capable of loading a shared library it must
+include a DYNAMIC section. This includes the symbol, string and hash
+tables needed to satisfy any references from the loaded library back
+to the executable. The only way I have so far worked out to make this
+happen is to link the executable against a dynamic library. This needs
+the -Wl,-static flag to be removed.
+
+A simple library, libdlforce.so has been created to make this
+happen. It is not even necessary for the progam to call into the
+library, just having it on the command line is enough.
+
+
+Generation of usable libraries and executables is very sensitive to
+the exact form of the linker scripts used.
+
+src/dynamic.ld has been replaced by a very lightly edited copy of 
+i686-pc-linux-gnu/H-i686-pc-linux-gnu/i686-pc-linux-gnu/lib/ldscripts/elf_i386.xs
+
+To make the main executable work correctly the i386.dynamic.ld script
+in this directory must be copied over target.ld before building any
+programs. I have not yet worked out what the problems are, but the
+original target.ld causes programs built for dynamic loading to
+SIGSEGV in ld.so.
+
+If we try to use the POSIX package, we get spurious calls to
+pthread_mutex_unlock() from somewhere in the Linux runtime. This may
+be a result of using a different linker script, however.
+
+
+Retesting toolchains
+====================
+
+Having got the synthetic target sort-of working, now go back and see
+what happens when configuring each of our standard toolchains for the
+loader.
+
+arm-elf		- build of shared library with external references
+		  result in "undefined reference to `fee'".
+
+mips-tx39-elf	- mangles DYNAMIC section as before.
+
+powerpc-eabi	- Compiler selects a libgcc.a that contains references
+		  to "abort" and "strcmp". With these defined we get
+		  sensible looking libraries. 
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/include/arm_elf.h
@@ -0,0 +1,180 @@
+#ifndef CYGONCE_LOADER_ARM_ELF_H
+#define CYGONCE_LOADER_ARM_ELF_H
+
+//==========================================================================
+//
+//      arm_elf.h
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    nickg
+// Contributors: nickg
+// Date:         2000-11-20
+// Purpose:      Define ARM ELF support
+// Description:  This file contains definitions for configuring the dynamic
+//               loader to deal with the ARM specific parts of the ELF
+//               file format.
+//              
+// Usage:
+//              #include <cyg/loader/arm_elf.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+
+
+#if defined(CYGPKG_HAL_ARM)
+
+#ifndef CYG_LOADER_DYNAMIC_LD
+
+#include <cyg/infra/cyg_type.h>
+
+//--------------------------------------------------------------------------
+// Basic definitions
+
+#define CYG_ELF_MACHINE     EM_ARM
+
+//--------------------------------------------------------------------------
+// Relocation types
+// Taken from bfd/include/elf/arm.h - not currently sure which of these
+// are actually used in executables.
+
+#define R_ARM_NONE         0
+#define R_ARM_PC24         1
+#define R_ARM_ABS32        2
+#define R_ARM_REL32        3
+#define R_ARM_PC13         4
+#define R_ARM_ABS16        5
+#define R_ARM_ABS12        6
+#define R_ARM_THM_ABS5     7
+#define R_ARM_ABS8         8
+#define R_ARM_SBREL32      9
+#define R_ARM_THM_PC22    10
+#define R_ARM_THM_PC8     11
+#define R_ARM_AMP_VCALL9  12
+#define R_ARM_SWI24       13
+#define R_ARM_THM_SWI8    14
+#define R_ARM_XPC25       15
+#define R_ARM_THM_XPC22   16
+#define R_ARM_COPY        20       /* copy symbol at runtime */
+#define R_ARM_GLOB_DAT    21       /* create GOT entry */
+#define R_ARM_JUMP_SLOT   22       /* create PLT entry */
+#define R_ARM_RELATIVE    23       /* adjust by program base */
+#define R_ARM_GOTOFF      24       /* 32 bit offset to GOT */
+#define R_ARM_GOTPC       25       /* 32 bit PC relative offset to GOT */
+#define R_ARM_GOT32       26       /* 32 bit GOT entry */
+#define R_ARM_PLT32       27       /* 32 bit PLT address */
+#define R_ARM_GNU_VTENTRY 100
+#define R_ARM_GNU_VTINHERIT 101
+#define R_ARM_THM_PC11    102       /* Cygnus extension to abi: Thumb unconditional branch */
+#define R_ARM_THM_PC9     103       /* Cygnus extension to abi: Thumb conditional branch */
+#define R_ARM_RXPC25     249
+#define R_ARM_RSBREL32   250
+#define R_ARM_THM_RPC22  251
+#define R_ARM_RREL32     252
+#define R_ARM_RABS32     253
+#define R_ARM_RPC24      254
+#define R_ARM_RBASE      255
+
+
+//--------------------------------------------------------------------------
+// Processor specific customization class for Cyg_LoadObject class.
+
+#ifdef __cplusplus
+
+class Cyg_LoadObject_Proc :
+      public Cyg_LoadObject_Base
+{
+ public:
+
+    inline Cyg_LoadObject_Proc()
+        : Cyg_LoadObject_Base()
+        {
+        };
+
+    inline Cyg_LoadObject_Proc( Cyg_LoaderStream& stream,
+                    cyg_uint32 mode,
+                    Cyg_LoaderMemAlloc *mem )
+        : Cyg_LoadObject_Base( stream, mode, mem )
+        {
+        };
+
+    inline ~Cyg_LoadObject_Proc() {};
+
+    cyg_code apply_rel( unsigned char type, Elf32_Word sym, Elf32_Addr offset );
+
+    cyg_code apply_rela( unsigned char type, Elf32_Word sym,
+                         Elf32_Addr offset, Elf32_Sword addend );
+};
+
+//--------------------------------------------------------------------------
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rel( unsigned char type,
+                                                Elf32_Word sym,
+                                                Elf32_Addr offset )
+{
+    return 0;
+}
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rela( unsigned char type,
+                                                 Elf32_Word sym,
+                                                 Elf32_Addr offset,
+                                                 Elf32_Sword addend )
+{
+    return 0;
+}
+
+
+//--------------------------------------------------------------------------
+
+#endif // __cplusplus
+
+#else // CYG_LOADER_DYNAMIC_LD
+
+//--------------------------------------------------------------------------
+
+#define CYG_LOADER_DYNAMIC_PREFIX                                               \
+        OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")     \
+        OUTPUT_ARCH("arm")
+
+//--------------------------------------------------------------------------
+
+#endif // CYG_LOADER_DYNAMIC_LD
+
+#endif // defined(CYGPKG_HAL_ARM) 
+
+//--------------------------------------------------------------------------
+#endif // ifndef CYGONCE_LOADER_ARM_ELF_H
+// End of arm_elf.h
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/include/dlfcn.h
@@ -0,0 +1,76 @@
+#ifndef CYGONCE_LOADER_DLFCN_H
+#define CYGONCE_LOADER_DLFCN_H
+
+//==========================================================================
+//
+//      dlfcn.h
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-15
+// Purpose:             Define ELF dynamic loader API
+// Description:         The functions defined here collectively implement the
+//                      external API of the ELF dynamic loader.
+// Usage:               #include <cyg/loader/dlfcn.h>
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+
+#include <cyg/infra/cyg_type.h>         /* types etc.           */
+
+// =========================================================================
+// Mode values
+
+#define RTLD_NOW        0x00    /* Relocate now (default)               */
+#define RTLD_LAZY       0x01    /* Relocate opportunistically           */
+#define RTLD_GLOBAL     0x00    /* make symbols available globally (default) */
+#define RTLD_LOCAL      0x10    /* keep symbols secret                  */
+
+// =========================================================================
+// API calls
+
+__externC void *dlopen (const char *file, int mode);
+
+__externC void *dlopenmem(const void *addr, size_t size, int mode);
+
+__externC int dlclose (void *handle);
+
+__externC void *dlsym (void *handle, const char *name);
+
+__externC const char *dlerror (void);
+
+// -------------------------------------------------------------------------
+#endif // ifndef CYGONCE_LOADER_DLFCN_H
+// EOF dlfcn.h
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/include/elf.h
@@ -0,0 +1,695 @@
+#ifndef CYGONCE_LOADER_ELF_H
+#define CYGONCE_LOADER_ELF_H
+
+//==========================================================================
+//
+//      elf.h
+//
+//      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####
+//==========================================================================
+//#####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 <cyg/loader/elf.h>
+//
+//####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 <cyg/infra/cyg_type.h>
+
+// -------------------------------------------------------------------------
+// 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_LOADER_ELF_H
+// EOF elf.h
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/include/i386_elf.h
@@ -0,0 +1,207 @@
+#ifndef CYGONCE_LOADER_I386_ELF_H
+#define CYGONCE_LOADER_I386_ELF_H
+
+//==========================================================================
+//
+//      i386_elf.h
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    nickg
+// Contributors: nickg
+// Date:         2000-11-20
+// Purpose:      Define I386 ELF support
+// Description:  This file contains definitions for configuring the dynamic
+//               loader to deal with the I386 specific parts of the ELF
+//               file format.
+//              
+// Usage:
+//              #include <cyg/loader/i386_elf.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+
+#if defined(CYGPKG_HAL_I386)
+
+#ifndef CYG_LOADER_DYNAMIC_LD
+
+#include <cyg/infra/cyg_type.h>
+
+//--------------------------------------------------------------------------
+// Basic definitions
+
+#define CYG_ELF_MACHINE     EM_386
+
+//--------------------------------------------------------------------------
+// Relocation types
+// Taken from bfd/include/elf/i386.h - not currently sure which of these
+// are actually used in executables.
+
+#define R_386_NONE              0       /* No reloc */
+#define R_386_32                1       /* Direct 32 bit  */
+#define R_386_PC32              2       /* PC relative 32 bit */
+#define R_386_GOT32             3       /* 32 bit GOT entry */
+#define R_386_PLT32             4       /* 32 bit PLT address */
+#define R_386_COPY              5       /* Copy symbol at runtime */
+#define R_386_GLOB_DAT          6       /* Create GOT entry */
+#define R_386_JUMP_SLOT         7       /* Create PLT entry */
+#define R_386_RELATIVE          8       /* Adjust by program base */
+#define R_386_GOTOFF            9       /* 32 bit offset to GOT */
+#define R_386_GOTPC             10      /* 32 bit PC relative offset to GOT */
+#define R_386_16                20
+#define R_386_PC16              21
+#define R_386_8                 22
+#define R_386_PC8               23
+#define R_386_max               24
+     /* These are GNU extensions to enable C++ vtable garbage collection.  */
+#define R_386_GNU_VTINHERIT     250
+#define R_386_GNU_VTENTRY       251
+
+//--------------------------------------------------------------------------
+// Processor specific customization class for Cyg_LoadObject class.
+
+#ifdef __cplusplus
+
+class Cyg_LoadObject_Proc :
+      public Cyg_LoadObject_Base
+{
+ public:
+
+    inline Cyg_LoadObject_Proc()
+        : Cyg_LoadObject_Base()
+        {
+        };
+
+    inline Cyg_LoadObject_Proc( Cyg_LoaderStream& stream,
+                    cyg_uint32 mode,
+                    Cyg_LoaderMemAlloc *mem )
+        : Cyg_LoadObject_Base( stream, mode, mem )
+        {
+        };
+
+    inline ~Cyg_LoadObject_Proc() {};
+
+    cyg_code apply_rel( unsigned char type, Elf32_Word sym, Elf32_Addr offset );
+
+    cyg_code apply_rela( unsigned char type, Elf32_Word sym,
+                         Elf32_Addr offset, Elf32_Sword addend );
+};
+
+//--------------------------------------------------------------------------
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rel( unsigned char type,
+                                                Elf32_Word sym,
+                                                Elf32_Addr offset )
+{
+    CYG_ADDRESS addr = (CYG_ADDRESS)(offset + base);
+    CYG_ADDRESS saddr = CYG_LOADER_NULLSYMADDR;
+    
+    switch( type )
+    {
+
+    case R_386_32:                          /* Direct 32 bit  */
+        saddr = get_sym_addr_from_ix(sym);
+        if( saddr == CYG_LOADER_NULLSYMADDR )
+            return CYG_LOADERR_NO_SYMBOL;
+        *(CYG_WORD32 *)addr += saddr;
+        break;
+        
+    case R_386_PC32:                        /* PC relative 32 bit */
+        saddr = get_sym_addr_from_ix(sym);
+        if( saddr == CYG_LOADER_NULLSYMADDR )
+            return CYG_LOADERR_NO_SYMBOL;
+        *(CYG_WORD32 *)addr += saddr;
+        *(CYG_WORD32 *)addr -= (CYG_WORD32)addr;
+        break;
+
+    case R_386_GOT32:                       /* 32 bit GOT entry */
+    case R_386_PLT32:                       /* 32 bit PLT address */
+    case R_386_COPY:                        /* Copy symbol at runtime */
+    case R_386_GLOB_DAT:                    /* Create GOT entry */
+    case R_386_JUMP_SLOT:                   /* Create PLT entry */
+        return CYG_LOADERR_INVALID_RELOC;
+        
+    case R_386_RELATIVE:                    /* Adjust by program base */
+        *(CYG_WORD32 *)addr += base;
+        break;
+
+    case R_386_GOTOFF:                      /* 32 bit offset to GOT */
+    case R_386_GOTPC:                       /* 32 bit PC relative offset to GOT */
+    case R_386_16:
+    case R_386_PC16:
+    case R_386_8:
+    case R_386_PC8:
+    default:
+        return CYG_LOADERR_INVALID_RELOC;
+    }
+    return 0;
+}
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rela( unsigned char type,
+                                                 Elf32_Word sym,
+                                                 Elf32_Addr offset,
+                                                 Elf32_Sword addend )
+{
+    // No RELA relocs in i386
+    return CYG_LOADERR_INVALID_RELOC;
+}
+
+//--------------------------------------------------------------------------
+
+#endif // __cplusplus
+
+#else // CYG_LOADER_DYNAMIC_LD
+
+//--------------------------------------------------------------------------
+
+#define CYG_LOADER_DYNAMIC_PREFIX                                               \
+        OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")     \
+        OUTPUT_ARCH("i386")
+
+/* Adjust the address for the data segment.  We want to adjust up to
+   the same address within the page on the next page up.  */
+#define CYG_LOADER_DYNAMIC_DATA_ALIGN                   \
+        . = ALIGN(0x1000) + (. & (0x1000 - 1));
+
+//--------------------------------------------------------------------------
+
+#endif // CYG_LOADER_DYNAMIC_LD
+
+#endif // defined(CYGPKG_HAL_I386) && __cplusplus
+
+//--------------------------------------------------------------------------
+#endif // ifndef CYGONCE_LOADER_I386_ELF_H
+// End of i386_elf.h
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/include/loader.hxx
@@ -0,0 +1,478 @@
+#ifndef CYGONCE_LOADER_LOADER_HXX
+#define CYGONCE_LOADER_LOADER_HXX
+
+//==========================================================================
+//
+//      loader.hxx
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-15
+// Purpose:             Define ELF dynamic loader
+// Description: The classes defined here collectively implement the
+//              internal API of the ELF dynamic loader.
+// Usage:       #include <cyg/loader/loader.hxx>
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+
+#ifndef CYG_LOADER_DYNAMIC_LD
+
+#include <cyg/loader/elf.h>           // ELF data structures
+
+#ifdef __cplusplus
+
+#include <cyg/kernel/ktypes.h>
+#include <cyg/infra/cyg_ass.h>         // assertion macros
+
+#include <cyg/infra/clist.hxx>
+
+// -------------------------------------------------------------------------
+// Forward definitions
+
+class Cyg_LoaderStream;
+class Cyg_LoaderMemBlock;
+class Cyg_LoaderMemAlloc;
+class Cyg_LoadObject_Base;
+class Cyg_LoadObject_Proc;
+class Cyg_LoadObject;
+class Cyg_Loader;
+
+// -------------------------------------------------------------------------
+// Error codes
+
+#define CYG_LOADERR_NOERROR             0       // No error
+#define CYG_LOADERR_NOT_ELF             1       // Not ELF format file
+#define CYG_LOADERR_INVALID_CLASS       2       // Not expected file class
+#define CYG_LOADERR_INVALID_BYTEORDER   3       // Not expected byte order
+#define CYG_LOADERR_INVALID_VERSION     4       // Not expected ELF version
+#define CYG_LOADERR_INVALID_MACHINE     5       // Not expected machine type
+#define CYG_LOADERR_NO_MEMORY           6       // No memory
+#define CYG_LOADERR_EOF                 7       // End of input stream
+#define CYG_LOADERR_SEEK                8       // Cannot seek to stream position
+#define CYG_LOADERR_INVALID_RELOC       9       // Invalid or unexpected relocation
+#define CYG_LOADERR_NO_HASHTABLE        10      // No hash table in ELF file
+#define CYG_LOADERR_NO_SYMTAB           11      // No symbol table in ELF file
+#define CYG_LOADERR_NO_STRTAB           12      // No srting table in ELF file
+#define CYG_LOADERR_NO_SYMBOL           13      // Symbol not found
+
+// -------------------------------------------------------------------------
+// Value for undefined or otherwise invalid symbol addresses.
+
+#define CYG_LOADER_NULLSYMADDR          0
+
+// -------------------------------------------------------------------------
+// Loader Stream base class.
+// This defines the interface to data streams that are ELF dynamic executable
+// files.
+
+class Cyg_LoaderStream
+{
+public:
+
+    Cyg_LoaderStream();                         // Constructor
+
+    virtual ~Cyg_LoaderStream();                // Destructor
+
+
+    // The following functions are virtual and are supplied by a
+    // derived class to access to data stream.
+    
+    virtual cyg_code get_byte(CYG_BYTE *val); // Get a byte from the stream
+
+    virtual cyg_code get_data(CYG_BYTE *addr, CYG_ADDRWORD size);
+
+    virtual cyg_code seek(CYG_ADDRWORD pos);  // seek to given position
+
+    // The following functions all make use of the virtual functions
+    // to access the data stream.
+    
+    cyg_code get_word16(CYG_WORD16 *val);       // get a 16 bit value
+
+    cyg_code get_word32(CYG_WORD32 *val);       // get a 32 bit value
+
+    cyg_code get_word64(CYG_WORD64 *val);       // get a 64 bit value
+};
+
+// -------------------------------------------------------------------------
+// Memory allocation object. All memory allocated by the Loader is described
+// by one of these. 
+
+struct Cyg_LoaderMemBlock
+    : public Cyg_DNode_T<Cyg_LoaderMemBlock>
+{
+    void                *address;       // data address
+    cyg_int32           size;           // block size
+    cyg_int32           alignment;      // block alignment
+    Cyg_LoaderMemAlloc  *mem;           // allocator used
+    CYG_ADDRESS         actual_address; // allocator specific actual address for block
+    CYG_WORD32          actual_size;    // allocator specific actual size for block
+
+    // Convenience free() function
+    void free();
+};
+
+// -------------------------------------------------------------------------
+// Memory allocator base class
+// This defines the interface to a memory allocator used by the loader.
+
+class Cyg_LoaderMemAlloc
+{
+
+public:
+
+    Cyg_LoaderMemAlloc();
+
+    virtual ~Cyg_LoaderMemAlloc();
+
+    // The following functions are virtual so that alternative memory
+    // allocators may be implemented. The default behaviour of this
+    // class is to use malloc/realloc/free to support these functions.
+
+    // Allocate memory of the supplied size and alignment.
+    // size      - size in bytes
+    // alignment - alignment expressed as a power of 2
+    //             defaults to 8 byte alignment
+    virtual Cyg_LoaderMemBlock *alloc( cyg_int32 size,
+                                       cyg_int32 alignment = 8);
+
+    // Reallocate block
+    // block    - block to reallocate
+    // size     - new size in bytes
+    // alignment - new alignment, -1 if old alignment is to be used.
+    virtual Cyg_LoaderMemBlock *realloc( Cyg_LoaderMemBlock *block,
+                                         cyg_int32 size,
+                                         cyg_int32 alignment = -1);
+    
+    // Free a previously allocated memory segment.
+    virtual void free( Cyg_LoaderMemBlock *block );
+
+};
+
+// -------------------------------------------------------------------------
+// Cyg_LoaderMemBlock convenience free() function implementation.
+
+inline void Cyg_LoaderMemBlock::free() { mem->free(this); };
+
+// -------------------------------------------------------------------------
+// A loaded object
+
+class Cyg_LoadObject_Base
+    : public Cyg_DNode_T<Cyg_LoadObject>
+{
+    friend class Cyg_Loader;
+    
+protected:    
+    // The following fields come from the constructor arguments
+
+    cyg_uint32          mode;           // mode flags
+    
+    Cyg_LoaderMemAlloc  *memalloc;      // Memory allocator
+
+    
+    // The following fields are derived from the ELF header
+
+    Elf32_Word          e_type;         // File type
+
+    Elf32_Addr          e_entry;        // Executable entry point
+
+
+    
+    // The following fields are derived from the PT_DYNAMIC segment in
+    // the program header. These fields are named after the DT_ tags
+    // that their values are derived from.
+    
+    Elf32_Word          flags;          // flags from DT_FLAGS
+
+    Elf32_Word          soname;         // name of module, if defined
+    
+    Elf_Hash            *hash;          // address of hash table
+    Elf32_Word          *bucket;        // derived bucket array address
+    Elf32_Word          *chain;         // derived chain array address
+    
+    // String table
+    unsigned char       *strtab;        // address of table
+    Elf32_Word          strsize;        // size of table in bytes
+
+    // Symbol table
+    Elf32_Sym           *symtab;        // address of table
+    Elf32_Word          syment;         // size of entry
+    
+    // PTL and GOT
+    Elf32_Addr          pltgot;         // address of PLT and/or GOT
+
+    // PLT relocation entries
+    Elf32_Addr          jmprel;         // address of relocation table
+    Elf32_Word          pltrelsz;       // size of jmprel table in bytes
+    Elf32_Word          pltrel;         // type of table entries: DT_REL
+                                        //   or DT_RELA
+
+    // Relocation table with implicit addends
+    Elf32_Rel           *rel;           // table address
+    Elf32_Word          relsize;        // table size in bytes
+    Elf32_Word          relent;         // size of entry
+
+    // Relocation table with explicit addends
+    Elf32_Rela          *rela;          // table address
+    Elf32_Word          relasize;       // table size in bytes
+    Elf32_Word          relaent;        // size of entry
+
+    // Init and Fini support
+    Elf32_Addr          init;           // address of init function
+    Elf32_Addr          fini;           // address of fini function
+    Elf32_Addr          *init_array;    // address of init array
+    Elf32_Word          init_array_sz;  // size of init array
+    Elf32_Addr          *fini_array;    // address of fini array
+    Elf32_Word          fini_array_sz;  // size of fini array
+    Elf32_Addr          *pre_init_array;   // address of pre_init array
+    Elf32_Word          pre_init_array_sz; // size of pre_init array
+
+    Elf32_Dyn           *dynamic;       // address of _DYNAMIC section
+    
+    CYG_ADDRESS         base;           // base address used in address and
+                                        // relocation calcualtions
+    
+    Cyg_CList_T<Cyg_LoaderMemBlock> segs;      // chain of loaded segments
+    
+    cyg_code            error;          // most recent error code
+
+
+    // private functions
+
+    void parse_dynamic( Elf32_Dyn *dynamic );
+
+    // Translate a symbol from its symbol table index into its
+    // actual address
+    
+    CYG_ADDRESS get_sym_addr_from_ix( Elf32_Word sym );
+
+    // Get a symbol from this object's symbol table.
+    Elf32_Sym *get_sym( Elf32_Word ix );
+
+    // Get a name from this object's string table.
+    char *get_name( Elf32_Word offset );
+
+    // Look up the name in the hash table and return its symbol
+    // table entry, or NULL if not found.
+    Elf32_Sym *hash_lookup( const char *name );
+
+    
+    // Look up the name in the hash table and return its absolute
+    // address or CYG_LOADER_NULLSYMADDR if it is not found.
+    CYG_ADDRESS hash_lookup_addr( const char *name );
+
+    // Standard ELF-defined hash function for symbol table.
+    static unsigned long elf_hash( const unsigned char *name );
+    
+public:
+
+    // Constructor - reads and allocates the executable.
+    
+    Cyg_LoadObject_Base();                        
+
+    Cyg_LoadObject_Base( Cyg_LoaderStream& stream,
+                         cyg_uint32 mode,
+                         Cyg_LoaderMemAlloc *mem );
+    
+    ~Cyg_LoadObject_Base();                          // Destructor
+
+    inline cyg_code get_error() { return error; };
+    
+    // Translate a symbol into its address.
+    void *symbol( const char *name );
+
+    // Start this executable running
+    cyg_code exec(int argc, char **argv, char **envv);
+};
+
+#endif // __cplusplus
+
+#endif // CYG_LOADER_DYNAMIC_LD
+
+// -------------------------------------------------------------------------
+// All the following files should have suitable ifdefs so that only
+// one actually provides content.
+
+#include <cyg/loader/mips_elf.h>        // MIPS ELF support
+#include <cyg/loader/arm_elf.h>         // ARM ELF support
+#include <cyg/loader/i386_elf.h>        // i386 ELF support
+#include <cyg/loader/ppc_elf.h>         // PowerPC ELF support
+//#include <cyg/loader/sparc_elf.h>       // Sparc ELF support
+//#include <cyg/loader/sh_elf.h>          // SH ELF support
+
+// -------------------------------------------------------------------------
+
+#ifndef CYG_LOADER_DYNAMIC_LD
+
+#ifdef __cplusplus
+
+class Cyg_LoadObject :
+    public Cyg_LoadObject_Proc
+{
+    Cyg_LoaderMemBlock  *block;
+    
+public:
+
+    inline Cyg_LoadObject()
+        : Cyg_LoadObject_Proc()
+        {
+        };
+
+    inline Cyg_LoadObject( Cyg_LoaderStream& stream,
+                    cyg_uint32 mode,
+                    Cyg_LoaderMemAlloc *mem,
+                    Cyg_LoaderMemBlock *ablock = NULL)
+        : Cyg_LoadObject_Proc( stream, mode, mem )
+        {
+            block = ablock;
+        };
+    
+    inline ~Cyg_LoadObject() {};
+
+    Cyg_LoaderMemBlock *get_block() { return block; };
+    
+    // Apply dynamic relocations to the executable
+    void relocate();
+
+    // Apply PLT relocations
+    void relocate_plt();
+};
+
+// -------------------------------------------------------------------------
+// Main loader class
+
+class Cyg_Loader
+{
+    // current error code.
+    cyg_code            error;
+
+    // Default memory allocator.
+    Cyg_LoaderMemAlloc  *mem_default;
+
+    // Load object for main program
+    Cyg_LoadObject      *main;
+
+    // List of loaded executables, including the main
+    // program and all libraries.
+    Cyg_CList_T<Cyg_LoadObject> loadlist;
+
+public:
+
+    Cyg_Loader( Cyg_LoaderMemAlloc *mem);       // Constructor
+
+    ~Cyg_Loader();                              // Destructor
+
+
+    // Load an object and all its dependencies.
+    cyg_code load( Cyg_LoaderStream& stream,
+                   cyg_uint32 mode,
+                   Cyg_LoadObject **object);
+
+    // Close an object and remove it from memory
+    cyg_code close( Cyg_LoadObject *object );
+    
+    // Translate current error code into a string.
+    const char *error_string( );
+
+    // Look up a symbol
+    Elf32_Sym *hash_lookup( const char *name );
+    
+    // look up a named symbol in loadlist and return its
+    // address relocated to its load address.
+    CYG_ADDRESS hash_lookup_addr( const char *name );
+    
+    // Static pointer to loader object
+    static Cyg_Loader *loader;
+};
+
+//==========================================================================
+// Memory based loader stream
+
+class Cyg_LoaderStream_Mem
+    : public Cyg_LoaderStream
+{
+    CYG_ADDRESS         base;
+    CYG_ADDRESS         pos;
+    CYG_ADDRESS         end;
+    
+public:
+    
+    Cyg_LoaderStream_Mem( const void *addr, cyg_int32 size );
+
+    ~Cyg_LoaderStream_Mem();                // Destructor
+    
+    cyg_code get_byte(CYG_BYTE *val); // Get a byte from the stream
+
+    cyg_code get_data(CYG_BYTE *addr, CYG_ADDRWORD size);
+
+    cyg_code seek(CYG_ADDRWORD pos);  // seek to given position
+
+};
+
+//==========================================================================
+// Fileio based loader stream
+
+#ifdef CYGPKG_IO_FILEIO
+
+class Cyg_LoaderStream_File
+    : public Cyg_LoaderStream
+{
+    int         fd;
+    
+public:
+    
+    Cyg_LoaderStream_File( int afd );
+
+    ~Cyg_LoaderStream_File();                // Destructor
+    
+    cyg_code get_byte(CYG_BYTE *val); // Get a byte from the stream
+
+    cyg_code get_data(CYG_BYTE *addr, CYG_ADDRWORD size);
+
+    cyg_code seek(CYG_ADDRWORD pos);  // seek to given position
+
+};
+
+#endif
+
+// -------------------------------------------------------------------------
+
+#endif // __cplusplus
+
+#endif // CYG_LOADER_DYNAMIC_LD
+
+// -------------------------------------------------------------------------
+#endif // ifndef CYGONCE_LOADER_LOADER_HXX
+// EOF loader.hxx
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/include/mips_elf.h
@@ -0,0 +1,167 @@
+#ifndef CYGONCE_LOADER_MIPS_ELF_H
+#define CYGONCE_LOADER_MIPS_ELF_H
+
+//==========================================================================
+//
+//      mips_elf.h
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    nickg
+// Contributors: nickg
+// Date:         2000-11-20
+// Purpose:      Define MIPS ELF support
+// Description:  This file contains definitions for configuring the dynamic
+//               loader to deal with the MIPS specific parts of the ELF
+//               file format.
+//              
+// Usage:
+//              #include <cyg/loader/mips_elf.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+
+
+#if defined(CYGPKG_HAL_MIPS)
+
+#ifndef CYG_LOADER_DYNAMIC_LD
+
+#include <cyg/infra/cyg_type.h>
+
+//--------------------------------------------------------------------------
+// Basic definitions
+
+#define CYG_ELF_MACHINE     EM_MIPS
+
+//--------------------------------------------------------------------------
+// Relocation types
+// Taken from bfd/include/elf/mips.h - not currently sure which of these
+// are actually used in executables.
+
+#define R_MIPS_NONE                     0
+#define R_MIPS_16                       1
+#define R_MIPS_32                       2
+#define R_MIPS_REL32                    3
+#define R_MIPS_26                       4
+#define R_MIPS_HI16                     5
+#define R_MIPS_LO16                     6
+#define R_MIPS_GPREL16                  7
+#define R_MIPS_LITERAL                  8
+#define R_MIPS_GOT16                    9
+#define R_MIPS_PC16                     10
+#define R_MIPS_CALL16                   11
+#define R_MIPS_GPREL32                  12
+/* Irix and MIPS16 relocs currently omitted. */
+/* These are GNU extensions to handle embedded-pic.  */
+#define R_MIPS_PC32                     248
+#define R_MIPS_PC64                     249
+#define R_MIPS_GNU_REL16_S2             250
+#define R_MIPS_GNU_REL_LO16             251
+#define R_MIPS_GNU_REL_HI16             252
+/* These are GNU extensions to enable C++ vtable garbage collection.  */
+#define R_MIPS_GNU_VTINHERIT            253
+#define R_MIPS_GNU_VTENTRY              254
+
+//--------------------------------------------------------------------------
+// Processor specific customization class for Cyg_LoadObject class.
+
+#ifdef __cplusplus
+
+class Cyg_LoadObject_Proc :
+      public Cyg_LoadObject_Base
+{
+ public:
+
+    inline Cyg_LoadObject_Proc()
+        : Cyg_LoadObject_Base()
+        {
+        };
+    
+    inline Cyg_LoadObject_Proc( Cyg_LoaderStream& stream,
+                    cyg_uint32 mode,
+                    Cyg_LoaderMemAlloc *mem )
+        : Cyg_LoadObject_Base( stream, mode, mem )
+        {
+        };
+
+    inline ~Cyg_LoadObject_Proc() {};
+
+    cyg_code apply_rel( unsigned char type, Elf32_Word sym, Elf32_Addr offset );
+
+    cyg_code apply_rela( unsigned char type, Elf32_Word sym,
+                         Elf32_Addr offset, Elf32_Sword addend );
+};
+
+//--------------------------------------------------------------------------
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rel( unsigned char type,
+                                                Elf32_Word sym,
+                                                Elf32_Addr offset )
+{
+    return 0;
+}
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rela( unsigned char type,
+                                                 Elf32_Word sym,
+                                                 Elf32_Addr offset,
+                                                 Elf32_Sword addend )
+{
+    return 0;
+}
+
+
+//--------------------------------------------------------------------------
+
+#endif // __cplusplus
+
+#else // CYG_LOADER_DYNAMIC_LD
+
+//--------------------------------------------------------------------------
+
+#define CYG_LOADER_DYNAMIC_PREFIX                                               \
+        OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips")     \
+        OUTPUT_ARCH("mips")
+
+
+//--------------------------------------------------------------------------
+
+#endif // CYG_LOADER_DYNAMIC_LD
+
+#endif // defined(CYGPKG_HAL_MIPS) 
+
+//--------------------------------------------------------------------------
+#endif // ifndef CYGONCE_LOADER_MIPS_ELF_H
+// End of mips_elf.h
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/include/ppc_elf.h
@@ -0,0 +1,226 @@
+#ifndef CYGONCE_LOADER_PPC_ELF_H
+#define CYGONCE_LOADER_PPC_ELF_H
+
+//==========================================================================
+//
+//      ppc_elf.h
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):    nickg
+// Contributors: nickg
+// Date:         2000-11-20
+// Purpose:      Define PowerPC ELF support
+// Description:  This file contains definitions for configuring the dynamic
+//               loader to deal with the PowerPC specific parts of the ELF
+//               file format.
+//              
+// Usage:
+//              #include <cyg/loader/ppc_elf.h>
+//              ...
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/hal.h>
+
+#if defined(CYGPKG_HAL_POWERPC)
+
+#ifndef CYG_LOADER_DYNAMIC_LD
+
+#include <cyg/infra/cyg_type.h>
+
+//--------------------------------------------------------------------------
+// Basic definitions
+
+#define CYG_ELF_MACHINE     EM_PPC
+
+//--------------------------------------------------------------------------
+// Relocation types
+// Taken from binutils/include/elf/ppc.h - not currently sure which
+// of these are actually used in executables.
+
+
+#define R_PPC_NONE                      0
+#define R_PPC_ADDR32                    1
+#define R_PPC_ADDR24                    2
+#define R_PPC_ADDR16                    3
+#define R_PPC_ADDR16_LO                 4
+#define R_PPC_ADDR16_HI                 5
+#define R_PPC_ADDR16_HA                 6
+#define R_PPC_ADDR14                    7
+#define R_PPC_ADDR14_BRTAKEN            8
+#define R_PPC_ADDR14_BRNTAKEN           9
+#define R_PPC_REL24                     10
+#define R_PPC_REL14                     11
+#define R_PPC_REL14_BRTAKEN             12
+#define R_PPC_REL14_BRNTAKEN            13
+#define R_PPC_GOT16                     14
+#define R_PPC_GOT16_LO                  15
+#define R_PPC_GOT16_HI                  16
+#define R_PPC_GOT16_HA                  17
+#define R_PPC_PLTREL24                  18
+#define R_PPC_COPY                      19
+#define R_PPC_GLOB_DAT                  20
+#define R_PPC_JMP_SLOT                  21
+#define R_PPC_RELATIVE                  22
+#define R_PPC_LOCAL24PC                 23
+#define R_PPC_UADDR32                   24
+#define R_PPC_UADDR16                   25
+#define R_PPC_REL32                     26
+#define R_PPC_PLT32                     27
+#define R_PPC_PLTREL32                  28
+#define R_PPC_PLT16_LO                  29
+#define R_PPC_PLT16_HI                  30
+#define R_PPC_PLT16_HA                  31
+#define R_PPC_SDAREL16                  32
+#define R_PPC_SECTOFF                   33
+#define R_PPC_SECTOFF_LO                34
+#define R_PPC_SECTOFF_HI                35
+#define R_PPC_SECTOFF_HA                36
+
+/* The remaining relocs are from the Embedded ELF ABI, and are not
+   in the SVR4 ELF ABI.  */
+#define R_PPC_EMB_NADDR32               101
+#define R_PPC_EMB_NADDR16               102
+#define R_PPC_EMB_NADDR16_LO            103
+#define R_PPC_EMB_NADDR16_HI            104
+#define R_PPC_EMB_NADDR16_HA            105
+#define R_PPC_EMB_SDAI16                106
+#define R_PPC_EMB_SDA2I16               107
+#define R_PPC_EMB_SDA2REL               108
+#define R_PPC_EMB_SDA21                 109
+#define R_PPC_EMB_MRKREF                110
+#define R_PPC_EMB_RELSEC16              111
+#define R_PPC_EMB_RELST_LO              112
+#define R_PPC_EMB_RELST_HI              113
+#define R_PPC_EMB_RELST_HA              114
+#define R_PPC_EMB_BIT_FLD               115
+#define R_PPC_EMB_RELSDA                116
+
+  /* These are GNU extensions to enable C++ vtable garbage collection.  */
+#define R_PPC_GNU_VTINHERIT             253
+#define R_PPC_GNU_VTENTRY               254
+
+/* This is a phony reloc to handle any old fashioned TOC16 references
+   that may still be in object files.  */
+#define R_PPC_TOC16                     255
+
+
+//--------------------------------------------------------------------------
+// Processor specific customization class for Cyg_LoadObject class.
+
+#ifdef __cplusplus
+
+class Cyg_LoadObject_Proc :
+      public Cyg_LoadObject_Base
+{
+ public:
+
+    inline Cyg_LoadObject_Proc()
+        : Cyg_LoadObject_Base()
+        {
+        };
+
+    inline Cyg_LoadObject_Proc( Cyg_LoaderStream& stream,
+                    cyg_uint32 mode,
+                    Cyg_LoaderMemAlloc *mem )
+        : Cyg_LoadObject_Base( stream, mode, mem )
+        {
+        };
+
+    inline ~Cyg_LoadObject_Proc() {};
+
+    cyg_code apply_rel( unsigned char type, Elf32_Word sym, Elf32_Addr offset );
+
+    cyg_code apply_rela( unsigned char type, Elf32_Word sym,
+                         Elf32_Addr offset, Elf32_Sword addend );
+};
+
+//--------------------------------------------------------------------------
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rel( unsigned char type,
+                                                Elf32_Word sym,
+                                                Elf32_Addr offset )
+{
+    return 0;
+}
+
+inline cyg_code Cyg_LoadObject_Proc::apply_rela( unsigned char type,
+                                                 Elf32_Word sym,
+                                                 Elf32_Addr offset,
+                                                 Elf32_Sword addend )
+{
+    return 0; // CYG_LOADERR_INVALID_RELOC;
+}
+
+//--------------------------------------------------------------------------
+
+externC void abort() CYGBLD_ATTRIB_WEAK;
+
+externC void abort() { for(;;); }
+
+externC int strcmp(const char *a, const char *b) CYGBLD_ATTRIB_WEAK;
+
+externC int strcmp(const char *a, const char *b) { return a==b; }
+
+externC unsigned int strlen(const char *a) CYGBLD_ATTRIB_WEAK;
+
+externC unsigned int strlen(const char *a) { return 1; }
+
+//--------------------------------------------------------------------------
+
+#endif // __cplusplus
+
+#else // CYG_LOADER_DYNAMIC_LD
+
+//--------------------------------------------------------------------------
+
+#define CYG_LOADER_DYNAMIC_PREFIX                                               \
+        OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")     \
+        OUTPUT_ARCH("powerpc")
+
+/* Adjust the address for the data segment.  We want to adjust up to
+   the same address within the page on the next page up.  */
+#define CYG_LOADER_DYNAMIC_DATA_ALIGN                   \
+        . = ALIGN(0x1000) + (. & (0x1000 - 1));
+
+//--------------------------------------------------------------------------
+
+#endif // CYG_LOADER_DYNAMIC_LD
+
+#endif // defined(CYGPKG_HAL_POWERPC) && __cplusplus
+
+//--------------------------------------------------------------------------
+#endif // ifndef CYGONCE_LOADER_PPC_ELF_H
+// End of ppc_elf.h
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/src/crtbeginS.c
@@ -0,0 +1,118 @@
+//==========================================================================
+//
+//      crtbeginS.c
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-25
+// Purpose:             C runtime support
+// Description:         This file contains code that must appear at the very start of
+//                      a dynamically loaded library. It contains definitions for the
+//                      start of the .init and .fini sections.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+
+#include <cyg/loader/loader.hxx>
+
+/*------------------------------------------------------------------------*/
+
+#ifndef INIT_SECTION_ASM_OP
+#define INIT_SECTION_ASM_OP  ".section\t.init,\"ax\"\n"
+#endif
+
+#ifndef FINI_SECTION_ASM_OP
+#define FINI_SECTION_ASM_OP  ".section\t.fini,\"ax\"\n"
+#endif
+
+#ifndef TEXT_SECTION_ASM_OP
+#define TEXT_SECTION_ASM_OP  ".text\n"
+#endif
+
+#ifndef CTORS_SECTION_ASM_OP
+#define CTORS_SECTION_ASM_OP    "\t.section\t.ctors,\"aw\"\n"
+#endif
+
+#ifndef DTORS_SECTION_ASM_OP
+#define DTORS_SECTION_ASM_OP    "\t.section\t.dtors,\"aw\"\n"
+#endif
+
+/*------------------------------------------------------------------------*/
+
+typedef void (*pfunc) (void);
+
+#if 1
+
+asm(CTORS_SECTION_ASM_OP);
+static pfunc __CTOR_LIST__[1] __attribute__((unused)) = { (pfunc) -1 };
+asm(DTORS_SECTION_ASM_OP);
+static pfunc __DTOR_LIST__[1] __attribute__((unused)) = { (pfunc) -1 };
+asm(TEXT_SECTION_ASM_OP);
+
+#else
+
+extern pfunc __CTOR_LIST__[];
+extern pfunc __DTOR_LIST__[];
+
+#endif
+
+/*------------------------------------------------------------------------*/    
+
+asm (INIT_SECTION_ASM_OP);
+
+void __attribute__ ((__unused__))
+init_dummy (void)
+{
+    asm( TEXT_SECTION_ASM_OP );
+}
+
+/*------------------------------------------------------------------------*/
+
+asm (FINI_SECTION_ASM_OP);
+
+static void __attribute__ ((__unused__))
+fini_dummy (void)
+{
+//  __do_global_dtors_aux ();
+#ifdef FORCE_FINI_SECTION_ALIGN
+  FORCE_FINI_SECTION_ALIGN;
+#endif
+  asm (TEXT_SECTION_ASM_OP);
+}
+
+/*------------------------------------------------------------------------*/
+
+//==========================================================================
+// End of crtbeginS.c
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/src/crtendS.c
@@ -0,0 +1,137 @@
+//==========================================================================
+//
+//      crtendS.c
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-25
+// Purpose:             C runtime support
+// Description:         This file contains code that must appear at the very end of
+//                      a dynamically loaded library. It contains definitions for the
+//                      end of the .init and .fini sections.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+
+#include <cyg/loader/loader.hxx>
+
+/*------------------------------------------------------------------------*/
+
+#ifndef INIT_SECTION_ASM_OP
+#define INIT_SECTION_ASM_OP  ".section\t.init,\"ax\"\n"
+#endif
+
+#ifndef FINI_SECTION_ASM_OP
+#define FINI_SECTION_ASM_OP  ".section\t.fini,\"ax\"\n"
+#endif
+
+#ifndef TEXT_SECTION_ASM_OP
+#define TEXT_SECTION_ASM_OP  ".text\n"
+#endif
+
+#ifndef CTORS_SECTION_ASM_OP
+#define CTORS_SECTION_ASM_OP    "\t.section\t.ctors,\"aw\""
+#endif
+
+#ifndef DTORS_SECTION_ASM_OP
+#define DTORS_SECTION_ASM_OP    "\t.section\t.dtors,\"aw\""
+#endif
+
+/*------------------------------------------------------------------------*/
+
+typedef void (*pfunc) (void);
+
+#if 1
+asm(CTORS_SECTION_ASM_OP);
+static pfunc __CTOR_END__[1] __attribute__((unused)) = { (pfunc) 0 };
+asm(DTORS_SECTION_ASM_OP);
+static pfunc __DTOR_END__[] __attribute__((unused)) = { (pfunc) 0 };
+asm( TEXT_SECTION_ASM_OP );
+
+#else
+
+extern pfunc __CTOR_LIST__[];
+extern pfunc __CTOR_END__[];
+extern pfunc __DTOR_END__[];
+
+#endif
+
+/*------------------------------------------------------------------------*/
+
+static void
+cyg_hal_invoke_constructors(void)
+{
+#if 1
+    pfunc *p;
+
+    for (p = &__CTOR_END__[-1]; *p != (pfunc) -1 ; p--)
+        (*p) ();
+#elif 0
+    pfunc *p;
+
+    for (p = &__CTOR_LIST__[(int)__CTOR_LIST__[0]]; p != &__CTOR_LIST__[0] ; p--)
+        (*p) ();    
+#endif    
+} // cyg_hal_invoke_constructors()
+
+/*------------------------------------------------------------------------*/
+
+static void __attribute__ ((__unused__))
+init_dummy (void)
+{
+    asm (INIT_SECTION_ASM_OP);
+    cyg_hal_invoke_constructors();
+}
+
+asm( TEXT_SECTION_ASM_OP );
+
+/*------------------------------------------------------------------------*/
+
+static void __attribute__ ((__unused__))
+fini_dummy (void)
+{
+  asm (FINI_SECTION_ASM_OP);
+//  __do_global_dtors_aux ();
+#ifdef FORCE_FINI_SECTION_ALIGN
+  FORCE_FINI_SECTION_ALIGN;
+#endif
+}
+
+asm (TEXT_SECTION_ASM_OP);
+
+/*------------------------------------------------------------------------*/
+
+//==========================================================================
+// End of crtendS.c
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/src/dlforce.c
@@ -0,0 +1,54 @@
+//==========================================================================
+//
+//      dlforce.c
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-25
+// Purpose:             Dummy dynamic library
+// Description:         This file defines a dummy dynamic library. By linking
+//                      this with an executable, we can force the generation of
+//                      the necessary data structures needed to make it possible
+//                      to load further dynamic libraries with it.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+void cyg_dl_force(void)
+{
+    return;
+}
+
+//==========================================================================
+// End of dlforce.c
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/src/dload.cxx
@@ -0,0 +1,190 @@
+//==========================================================================
+//
+//      dload.cxx
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-03
+// Purpose:             Loader class implementation
+// Description:         This file contains the dynamic ELF loader API.
+//                      This presents the standard dlxxx() calls by invoking
+//                      the loader classes as appropriate.
+//              
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/isoinfra.h>
+
+#include <cyg/kernel/ktypes.h>          // base kernel types
+#include <cyg/infra/cyg_trac.h>         // tracing macros
+#include <cyg/infra/cyg_ass.h>          // assertion macros
+
+#include <string.h>
+
+#include <cyg/loader/loader.hxx>        // Loader header
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <dlfcn.h>                      // API definitions
+
+// =========================================================================
+// Cyg_LoaderStream_File class
+
+// =========================================================================
+// API calls
+
+cyg_uint32 global_symbol_object;
+
+// =========================================================================
+// Load and open object
+
+__externC void *dlopen (const char *file, int mode)
+{
+    CYG_REPORT_FUNCTION();
+
+    void *ret = NULL;
+
+    if( file == NULL )
+    {
+        // Special case to allow access to all symbols.
+
+        ret = (void *)&global_symbol_object;
+    }
+#ifdef CYGPKG_IO_FILEIO    
+    else
+    {
+        int fd = open( file, O_RDONLY );
+
+        if( fd < 0 )
+            return NULL;
+        
+        Cyg_LoaderStream_File filestream( fd );
+
+        Cyg_LoadObject *obj;
+
+        cyg_code error = Cyg_Loader::loader->load( filestream, mode, &obj );
+
+        if( error == 0)
+        {
+            ret = (void *)obj;
+        }
+
+        close( fd );
+    }
+#endif
+    
+    CYG_REPORT_RETVAL(ret);    
+    return ret;
+}
+
+// =========================================================================
+
+__externC void *dlopenmem(const void *addr, size_t size, int mode)
+{
+    CYG_REPORT_FUNCTION();    
+
+    void *ret = NULL;
+
+    Cyg_LoaderStream_Mem memstream( addr, size );
+
+    Cyg_LoadObject *obj;
+
+    cyg_code error = Cyg_Loader::loader->load( memstream, mode, &obj );
+
+    if( error == 0)
+        ret = (void *)obj;
+    
+    CYG_REPORT_RETVAL(ret);    
+    return ret;
+}
+
+// =========================================================================
+
+__externC int dlclose (void *handle)
+{
+    CYG_REPORT_FUNCTION();
+
+    int ret = 0;
+
+    if( handle == (void *)global_symbol_object )
+    {
+        // Nothing to do here...
+    }
+    else
+    {
+        Cyg_LoadObject *obj = (Cyg_LoadObject *)handle;
+
+        Cyg_Loader::loader->close( obj );
+    }
+    
+    CYG_REPORT_RETVAL(ret);    
+    return ret;
+}
+
+// =========================================================================
+
+__externC void *dlsym (void *handle, const char *name)
+{
+    CYG_REPORT_FUNCTION();
+
+    void *ret = NULL;
+
+    Cyg_LoadObject *obj = (Cyg_LoadObject *)handle;
+
+    ret = obj->symbol( name );
+    
+    CYG_REPORT_RETVAL(ret);    
+    return ret;
+}
+
+// =========================================================================
+
+__externC const char *dlerror (void)
+{
+    CYG_REPORT_FUNCTION();
+
+    const char *ret = Cyg_Loader::loader->error_string();
+
+    CYG_REPORT_RETVAL(ret);
+    return ret;
+}
+
+
+// =========================================================================
+// EOF dload.cxx
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/src/dynamic.ld
@@ -0,0 +1,216 @@
+#define CYG_LOADER_DYNAMIC_LD
+
+#include <cyg/loader/loader.hxx>
+
+CYG_LOADER_DYNAMIC_PREFIX
+
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = 0 + SIZEOF_HEADERS;
+  .hash          : { *(.hash)		}
+  .dynsym        : { *(.dynsym)		}
+  .dynstr        : { *(.dynstr)		}
+  .gnu.version   : { *(.gnu.version)	}
+  .gnu.version_d   : { *(.gnu.version_d)	}
+  .gnu.version_r   : { *(.gnu.version_r)	}
+  .rel.init      : { *(.rel.init)	}
+  .rela.init     : { *(.rela.init)	}
+  .rel.text      :
+    {
+      *(.rel.text)
+      *(.rel.text.*)
+      *(.rel.gnu.linkonce.t*)
+    }
+  .rela.text     :
+    {
+      *(.rela.text)
+      *(.rela.text.*)
+      *(.rela.gnu.linkonce.t*)
+    }
+  .rel.fini      : { *(.rel.fini)	}
+  .rela.fini     : { *(.rela.fini)	}
+  .rel.rodata    :
+    {
+      *(.rel.rodata)
+      *(.rel.rodata.*)
+      *(.rel.gnu.linkonce.r*)
+    }
+  .rela.rodata   :
+    {
+      *(.rela.rodata)
+      *(.rela.rodata.*)
+      *(.rela.gnu.linkonce.r*)
+    }
+  .rel.data      :
+    {
+      *(.rel.data)
+      *(.rel.data.*)
+      *(.rel.gnu.linkonce.d*)
+    }
+  .rela.data     :
+    {
+      *(.rela.data)
+      *(.rela.data.*)
+      *(.rela.gnu.linkonce.d*)
+    }
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.got       : { *(.rel.got)		}
+  .rela.got      : { *(.rela.got)		}
+  .rel.sdata     :
+    {
+      *(.rel.sdata)
+      *(.rel.sdata.*)
+      *(.rel.gnu.linkonce.s*)
+    }
+  .rela.sdata     :
+    {
+      *(.rela.sdata)
+      *(.rela.sdata.*)
+      *(.rela.gnu.linkonce.s*)
+    }
+  .rel.sbss      : { *(.rel.sbss)		}
+  .rela.sbss     : { *(.rela.sbss)	}
+  .rel.bss       : { *(.rel.bss)		}
+  .rela.bss      : { *(.rela.bss)		}
+  .rel.plt       : { *(.rel.plt)		}
+  .rela.plt      : { *(.rela.plt)		}
+  .init          : 
+  { 
+    KEEP (*(.init))
+  } =0x9090
+  .plt      : { *(.plt)	}
+  .text      :
+  {
+    *(.text)
+    *(.text.*)
+    *(.stub)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+    *(.gnu.linkonce.t*)
+  } =0x9090
+  _etext = .;
+  PROVIDE (etext = .);
+  .fini      :
+  {
+    KEEP (*(.fini))
+  } =0x9090
+  .rodata   : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }
+  .rodata1   : { *(.rodata1) }
+#ifdef CYG_LOADER_DYNAMIC_DATA_ALIGN
+  CYG_LOADER_DYNAMIC_DATA_ALIGN
+#else
+  . = ALIGN(0x1000);
+#endif
+  .data    :
+  {
+    *(.data)
+    *(.data.*)
+    *(.gnu.linkonce.d*)
+    SORT(CONSTRUCTORS)
+  }
+  .data1   : { *(.data1) }
+  .eh_frame : { KEEP (*(.eh_frame)) }
+  .gcc_except_table : { *(.gcc_except_table) }
+  .ctors   : 
+  {
+    /* gcc uses crtbegin.o to find the start of
+       the constructors, so we make sure it is
+       first.  Because this is a wildcard, it
+       doesn't matter if the user does not
+       actually link against crtbegin.o; the
+       linker won't look for a file to match a
+       wildcard.  The wildcard also means that it
+       doesn't matter which directory crtbegin.o
+       is in.  */
+    KEEP (*crtbegin.o(.ctors))
+    /* We don't want to include the .ctor section from
+       from the crtend.o file until after the sorted ctors.
+       The .ctor section from the crtend file contains the
+       end of ctors marker and it must be last */
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+  }
+   .dtors         :
+  {
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+  }
+  .got		  : { *(.got.plt) *(.got) }
+  .dynamic       : { *(.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     : 
+  {
+    *(.sdata) 
+    *(.sdata.*)
+    *(.gnu.linkonce.s.*)
+  }
+  _edata = .;
+  PROVIDE (edata = .);
+  __bss_start = .;
+  .sbss      :
+  {
+    *(.dynsbss)
+    *(.sbss)
+    *(.sbss.*)
+    *(.scommon)
+  }
+  .bss       :
+  {
+   *(.dynbss)
+   *(.bss)
+   *(.bss.*)
+   *(COMMON)
+   /* Align here to ensure that the .bss section occupies space up to
+      _end.  Align after .bss to ensure correct alignment even if the
+      .bss section disappears because there are no input sections.  */
+   . = ALIGN(32 / 8);
+  }
+  . = ALIGN(32 / 8);
+  _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  .  */
+}
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/src/loader.cxx
@@ -0,0 +1,1046 @@
+//==========================================================================
+//
+//      loader.cxx
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-03
+// Purpose:             Loader class implementation
+// Description:         This file contains the implementation of the ELF loader
+//                      classes.
+//              
+//              
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/hal.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/isoinfra.h>
+
+#include <cyg/kernel/ktypes.h>          // base kernel types
+#include <cyg/infra/cyg_trac.h>         // tracing macros
+#include <cyg/infra/cyg_ass.h>          // assertion macros
+
+#include <string.h>
+
+#include <cyg/loader/loader.hxx>        // our header
+
+#if CYGINT_ISO_MALLOC
+#include <stdlib.h>                     // for malloc() etc
+#endif
+
+// ----------------------------------------------------------------------------
+
+#ifdef CYGPKG_LIBC_STRING
+
+#define streq( a, b ) (strcmp(a,b) == 0)
+
+#else
+
+static int streq( const char *s1, const char *s2 )
+{
+    while( *s1 == *s2 && *s1 && *s2 ) s1++,s2++;
+
+    return !(*s2-*s1);
+}
+
+#endif
+
+// ----------------------------------------------------------------------------
+// new operator to allow us to invoke constructors on previously allocated
+// memory.
+
+inline void *operator new(size_t size,  void *ptr) { return ptr; };
+
+
+// =========================================================================
+// Static objects
+
+// Default memory allocator
+static Cyg_LoaderMemAlloc memalloc;
+
+// Loader object
+static Cyg_Loader loader(&memalloc);
+
+Cyg_Loader *Cyg_Loader::loader = &::loader;
+
+
+// =========================================================================
+// Main loader class members
+
+// -------------------------------------------------------------------------
+// Constructor
+
+Cyg_Loader::Cyg_Loader( Cyg_LoaderMemAlloc *memalloc )
+{
+    CYG_REPORT_FUNCTION();
+
+    error = 0;
+    mem_default = memalloc;
+
+    // build an object for the main program
+    Cyg_LoaderMemBlock *obj = mem_default->alloc( sizeof(Cyg_LoadObject));
+    
+    main = new(obj->address) Cyg_LoadObject( );
+
+    // Add to load list
+    loadlist.add_head(main);
+    
+    error = main->get_error();
+
+    CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Destructor
+
+Cyg_Loader::~Cyg_Loader()
+{
+    CYG_REPORT_FUNCTION();
+
+    CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Load an object and all its dependencies.
+
+cyg_code Cyg_Loader::load( Cyg_LoaderStream& stream,
+                           cyg_uint32 mode,
+                           Cyg_LoadObject **object)
+{
+    CYG_REPORT_FUNCTION();
+    CYG_REPORT_FUNCARG3XV( &stream, mode, object );
+
+    cyg_code error = 0;
+
+    Cyg_LoaderMemBlock *obj = mem_default->alloc( sizeof(Cyg_LoadObject));
+    Cyg_LoadObject *pobj = NULL;
+    
+    pobj = new(obj->address) Cyg_LoadObject( stream, mode, mem_default, obj );
+
+    error = pobj->get_error();
+
+    if( error != 0 )
+        goto finish;
+
+    // Add this object to list before we do any relocations to make
+    // the symbol lookups work.
+    
+    loadlist.add_tail(pobj);
+
+    
+    // The object is now loaded. We must now do any relocations.
+
+    pobj->relocate();
+
+    error = pobj->get_error();
+
+    if( error != 0 )
+        goto finish;
+
+    // Handle PLT relocations if we are told to do so
+
+// We always do this for now..    
+//    if( mode & RTLD_NOW )
+        pobj->relocate_plt();
+
+    error = pobj->get_error();
+    
+ finish:
+    
+    if( error != 0 )
+    {
+        // remove object from list.
+        loadlist.remove( pobj );
+        
+        pobj->~Cyg_LoadObject();
+        mem_default->free( obj );
+    }
+    else
+    {
+        // return it from this function.
+        *object = pobj;
+    }
+    
+    CYG_REPORT_RETVAL(error);
+
+    return error;
+}
+
+// -------------------------------------------------------------------------
+// Close object and remove it from memory
+
+cyg_code Cyg_Loader::close( Cyg_LoadObject *object )
+{
+    CYG_REPORT_FUNCTION();    
+
+    cyg_code error = 0;
+
+    Cyg_LoaderMemBlock *block = object->get_block();
+    
+    object->~Cyg_LoadObject();
+
+    if( block )
+        block->free();
+    
+    CYG_REPORT_RETVAL(error);
+
+    return error;
+}
+
+// -------------------------------------------------------------------------
+// Translate current error code into a string.
+
+const char *Cyg_Loader::error_string( )
+{
+    CYG_REPORT_FUNCTION();
+
+    char *ret = "";
+
+    CYG_REPORT_RETVAL(ret);    
+    return ret;
+}
+
+// -------------------------------------------------------------------------
+// Look up a named symbol in loadlist
+
+CYG_ADDRESS Cyg_Loader::hash_lookup_addr( const char *name )
+{
+    CYG_ADDRESS addr = 0;
+    Cyg_LoadObject *object = loadlist.get_head();
+   
+    do
+    {
+        addr = object->hash_lookup_addr( name );
+
+        if( addr != CYG_LOADER_NULLSYMADDR )
+            break;
+        
+        object = object->get_next();
+        
+    } while( object != loadlist.get_head() );
+
+    if( addr == CYG_LOADER_NULLSYMADDR )
+        error = CYG_LOADERR_NO_SYMBOL;
+    
+    return addr;
+}
+
+// =========================================================================
+// Loader Object class members
+
+Cyg_LoadObject_Base::Cyg_LoadObject_Base()
+{
+    e_type = ET_EXEC;
+    e_entry = 0;
+    base = 0;
+    
+    dynamic = _DYNAMIC;
+
+    parse_dynamic( dynamic );
+}
+
+// -------------------------------------------------------------------------
+// Constructor - reads and allocates the executable.
+
+Cyg_LoadObject_Base::Cyg_LoadObject_Base( Cyg_LoaderStream& stream,
+                                cyg_uint32 amode,
+                                Cyg_LoaderMemAlloc *mem )
+{
+    CYG_REPORT_FUNCTION();
+    CYG_REPORT_FUNCARG3XV( &stream, mode, mem );
+
+    Cyg_LoaderMemBlock *phblock = NULL;
+    Cyg_LoaderMemBlock *block = NULL;
+    Elf32_Phdr *phdr;
+    Elf32_Phdr *dynhdr = NULL;
+    cyg_uint32 memsize = 0;
+    cyg_uint32 maxalign = 0;
+    CYG_BYTE *memaddr;
+    Elf32_Addr vaddr_low = 0x7FFFFFFF;
+    Elf32_Addr vaddr_hi = 0;
+    
+    mode = amode;
+    memalloc = mem;
+    error = CYG_LOADERR_NOERROR;
+    
+    // OK, let's start by getting the ELF header...
+
+    Elf32_Ehdr elf_hdr;
+    
+    error = stream.get_data( (CYG_BYTE *)&elf_hdr, sizeof( elf_hdr ) );
+
+    if( error != 0 )
+        goto finish;
+
+    // Check that this is a valid ELF file and that the various header
+    // fields match what we expect for our current architecture and
+    // platform.
+
+    if( !IS_ELF( elf_hdr ) )
+        error = CYG_LOADERR_NOT_ELF;
+    else if( elf_hdr.e_ident[EI_CLASS] != ELFCLASS32 )
+        error = CYG_LOADERR_INVALID_CLASS;
+#if CYG_BYTEORDER == CYG_LSBFIRST 
+    else if( elf_hdr.e_ident[EI_DATA] != ELFDATA2LSB )
+#else
+    else if( elf_hdr.e_ident[EI_DATA] != ELFDATA2MSB )
+#endif        
+        error = CYG_LOADERR_INVALID_BYTEORDER;
+    else if( elf_hdr.e_ident[EI_VERSION] != EV_CURRENT )
+        error = CYG_LOADERR_INVALID_VERSION;
+    else if( elf_hdr.e_machine != CYG_ELF_MACHINE )
+        error = CYG_LOADERR_INVALID_MACHINE;
+    else if( elf_hdr.e_version != EV_CURRENT )
+        error = CYG_LOADERR_INVALID_VERSION;
+    else if( elf_hdr.e_phentsize != sizeof(Elf32_Phdr) )
+        error = CYG_LOADERR_INVALID_VERSION;
+
+    if( error != 0 )
+        goto finish;
+    
+    // OK that all seems in order, save some fields away for later.
+
+    e_type = elf_hdr.e_type;
+    e_entry = elf_hdr.e_entry;
+
+    // Now we must read the program header and prepare to read the
+    // object file into memory.
+
+    error = stream.seek( elf_hdr.e_phoff );
+
+    if( error != 0 )
+        goto finish;
+
+
+    // Allocate space for the header
+    
+    phblock = memalloc->alloc( elf_hdr.e_phentsize * elf_hdr.e_phnum );
+
+    if( phblock == NULL )
+    {
+        error = CYG_LOADERR_NO_MEMORY;
+        goto finish;
+    }
+
+    error = stream.get_data( (CYG_BYTE *)phblock->address, sizeof(Elf32_Phdr)*elf_hdr.e_phnum );
+
+    if( error != 0 )
+        goto finish;
+    
+    phdr = (Elf32_Phdr *)phblock->address;
+
+    // Loop over the program headers, totalling the sizes of the the
+    // PT_LOAD entries and saving a pointer to the PT_DYNAMIC entry
+    // when we find it.
+    // Since the segments must retain the same relationship to
+    // eachother in memory that their virtual addresses do in the
+    // headers, we determine the amount of memory needed by finding
+    // the extent of the virtual addresses covered by the executable.
+    
+    for( int i = 0; i < elf_hdr.e_phnum; i++,phdr++ )
+    {
+        if( phdr->p_type == PT_DYNAMIC )
+        {
+            dynhdr = phdr;
+            continue;
+        }
+        if( phdr->p_type != PT_LOAD )
+            continue;
+
+        if( phdr->p_vaddr < vaddr_low )
+            vaddr_low = phdr->p_vaddr;
+
+        if( (phdr->p_vaddr+phdr->p_memsz) > vaddr_hi )
+            vaddr_hi = phdr->p_vaddr+phdr->p_memsz;
+
+        if( phdr->p_align > maxalign )
+            maxalign = phdr->p_align;        
+    }
+
+    // Calculate how much memory we need and allocate it
+    memsize = vaddr_hi - vaddr_low;
+    
+    block = memalloc->alloc( memsize, maxalign );
+
+    if( block == NULL )
+    {
+        error = CYG_LOADERR_NO_MEMORY;
+        goto finish;
+    }
+    
+    // Attach to segments list
+    segs.add_tail( block );
+    
+    // Calculate the base address for this executable. This is the
+    // difference between the actual address the executable is loaded
+    // at and its lowest virtual address. This value must be added to
+    // all addresses derived from the executable to relocate them into
+    // the real memory space.
+
+    base = (CYG_ADDRESS)block->address - vaddr_low;
+        
+    // Loop over the program headers again, this time loading them
+    // into the memory segment we have allocated and clearing any
+    // unused areas to zero.
+
+    phdr = (Elf32_Phdr *)phblock->address;
+
+    memaddr = (CYG_BYTE *)block->address;
+    
+    for( int i = 0; i < elf_hdr.e_phnum; i++,phdr++ )
+    {
+        if( phdr->p_type != PT_LOAD )
+            continue;
+
+        error = stream.seek( phdr->p_offset );
+
+        if( error != 0 ) break;
+
+        // Calculate the actual load address for this segment.
+        CYG_BYTE *loadaddr = (CYG_BYTE *)(phdr->p_vaddr + base);
+        
+        error = stream.get_data( loadaddr, phdr->p_filesz );
+
+        if( error != 0 ) break;
+
+        // If the memory size is more than we got from the file, zero the remainder.
+        
+        if( phdr->p_filesz < phdr->p_memsz )
+            memset( loadaddr+phdr->p_filesz,
+                    0,
+                    phdr->p_memsz-phdr->p_filesz );
+    }
+
+
+    dynamic = (Elf32_Dyn *)(dynhdr->p_vaddr + base);
+
+    parse_dynamic( dynamic );
+    
+ finish:
+    
+    if( phblock != NULL )
+        memalloc->free( phblock );
+
+    CYG_REPORT_RETURN();    
+}
+
+// -------------------------------------------------------------------------
+// Parse the dynamic segment 
+
+void Cyg_LoadObject_Base::parse_dynamic( Elf32_Dyn *dynamic )
+{
+    CYG_REPORT_FUNCTION();
+
+    flags = 0;
+    
+    for(;; dynamic++)
+    {
+        switch( dynamic->d_tag )
+        {
+        case DT_NULL:                   /* marks end of _DYNAMIC array */
+            return;
+        case DT_NEEDED:                 /* string table offset of needed lib */
+            break;                      // ignore for now
+        case DT_PLTRELSZ:               /* size of relocation entries in PLT */
+            pltrelsz = dynamic->d_un.d_val;
+            break;
+        case DT_PLTGOT:                 /* address PLT/GOT */
+            pltgot = dynamic->d_un.d_ptr + base;
+            break;
+        case DT_HASH:                   /* address of symbol hash table */
+            hash = (Elf_Hash *)(dynamic->d_un.d_ptr + base);
+            bucket = (Elf32_Word *)(hash+1);
+            chain = bucket+hash->nbucket;
+            break;
+        case DT_STRTAB:                 /* address of string table */
+            strtab = (unsigned char *)(dynamic->d_un.d_ptr + base);
+            break;
+        case DT_SYMTAB:                 /* address of symbol table */
+            symtab = (Elf32_Sym *)(dynamic->d_un.d_ptr + base);
+            break;
+        case DT_RELA:                   /* address of relocation table */
+            rela = (Elf32_Rela *)(dynamic->d_un.d_ptr + base);
+            break;
+        case DT_RELASZ:                 /* size of relocation table */
+            relasize = dynamic->d_un.d_val;
+            break;
+        case DT_RELAENT:                /* size of relocation entry */
+            relaent = dynamic->d_un.d_val;
+            break;
+        case DT_STRSZ:                  /* size of string table */
+            strsize = dynamic->d_un.d_val;
+            break;
+        case DT_SYMENT:                 /* size of symbol table entry */
+            syment = dynamic->d_un.d_val;
+            break;
+        case DT_INIT:                   /* address of initialization func. */
+            init = dynamic->d_un.d_ptr + base;
+            break;
+        case DT_FINI:                   /* address of termination function */
+            fini = dynamic->d_un.d_ptr + base;
+            break;
+        case DT_SONAME:                 /* string table offset of shared obj */
+            soname = dynamic->d_un.d_val;
+            break;
+        case DT_SYMBOLIC:               /* start sym search in shared obj. */
+            flags |= DF_SYMBOLIC;
+            break;
+        case DT_REL:                    /* address of rel. tbl. w addends */
+            rel = (Elf32_Rel *)(dynamic->d_un.d_ptr + base);
+            break;
+        case DT_RELSZ:                  /* size of DT_REL relocation table */
+            relsize = dynamic->d_un.d_val;
+            break;
+        case DT_RELENT:                 /* size of DT_REL relocation entry */
+            relent = dynamic->d_un.d_val;
+            break;
+        case DT_PLTREL:                 /* PLT referenced relocation entry */
+            pltrel = dynamic->d_un.d_val;
+            break;
+        case DT_DEBUG:                  /* Debug data */
+            break;                      /* ignore for now */
+        case DT_TEXTREL:                /* Allow rel. mod. to unwritable seg */
+            flags |= DF_TEXTREL;
+            break;
+        case DT_JMPREL:                 /* add. of PLT's relocation entries */
+            jmprel = dynamic->d_un.d_ptr + base;
+            break;
+        case DT_BIND_NOW:               /* Bind now regardless of env setting */
+            flags |= DF_BIND_NOW;
+            break;
+        case DT_INIT_ARRAY:             /* init array address */
+            init_array = (Elf32_Addr *)(dynamic->d_un.d_ptr + base);
+            break;
+        case DT_FINI_ARRAY:             /* fini array address */
+            fini_array = (Elf32_Addr *)(dynamic->d_un.d_ptr + base);
+            break;
+        case DT_INIT_ARRAYSZ:           /* init array size */
+            init_array_sz = dynamic->d_un.d_val;
+            break;
+        case DT_FINI_ARRAYSZ:           /* fini array size */
+            fini_array_sz = dynamic->d_un.d_val;
+            break;
+        case DT_FLAGS:                  /* flags */
+            flags |= dynamic->d_un.d_val;
+            break;
+        case DT_PREINIT_ARRAY:          /* preinit array address */
+            pre_init_array = (Elf32_Addr *)(dynamic->d_un.d_ptr + base);
+            break;
+        case DT_PREINIT_ARRAYSZ:        /* preinit array size */
+            pre_init_array_sz = dynamic->d_un.d_val;
+            break;
+            
+        default:
+            // handle format-specific entries
+            break;
+        }
+    }
+    
+    CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Get the symbol name from the current object's symbol table, look it
+// up in the hash tables of the loaded objects, and return its address.
+
+CYG_ADDRESS Cyg_LoadObject_Base::get_sym_addr_from_ix( Elf32_Word ix )
+{
+    Elf32_Sym *sym = get_sym( ix );
+
+    if( sym == NULL ) return 0;
+
+    const char *name = get_name( sym->st_name );
+
+    // If the symbol has local binding, we must look for
+    // it in this object only.
+    if( ELF32_ST_BIND(sym->st_info) == STB_LOCAL )
+         return hash_lookup_addr( name );
+
+    // Otherwise search the loaded objects in load order
+    return Cyg_Loader::loader->hash_lookup_addr( name );
+
+}
+
+// -------------------------------------------------------------------------
+// Lookup the name in our hash table and return the symbol table entry
+
+Elf32_Sym *Cyg_LoadObject_Base::hash_lookup( const char *name )
+{
+    Elf32_Sym *ret = NULL;
+
+    if( hash == NULL )
+    {
+        error = CYG_LOADERR_NO_HASHTABLE;
+        return NULL;
+    }
+
+    error = CYG_LOADERR_NO_SYMBOL;
+    
+    Elf32_Word ix = elf_hash( (const unsigned char *)name );
+
+    ix %= hash->nbucket;
+
+    // get head of chain
+    Elf32_Word iy = bucket[ ix ]; 
+    
+    while( iy != STN_UNDEF )
+    {
+        Elf32_Sym *sym = get_sym( iy );
+        const char *sname = get_name( sym->st_name );
+
+        if( streq( name, sname ) )
+        {
+            ret = sym;
+            error = CYG_LOADERR_NOERROR;
+            break;
+        }
+
+        iy = chain[ iy ];
+    }
+
+    return ret;
+}
+
+// -------------------------------------------------------------------------
+// Lookup the given name in our symbol table and return it's value
+// relocated to our load address.
+
+CYG_ADDRESS Cyg_LoadObject_Base::hash_lookup_addr( const char *name )
+{
+    Elf32_Sym *sym = hash_lookup( name );
+
+    if( sym == NULL )
+        return CYG_LOADER_NULLSYMADDR;
+
+    // Check that this symbol is for a defined object, if its type is
+    // NOTYPE then it is undefined, here, and we cannot take its address.
+    // Hopefully it is defined in some other object.
+    
+    if( ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE )
+    {
+        error = CYG_LOADERR_NO_SYMBOL;
+        return CYG_LOADER_NULLSYMADDR;
+    }
+    
+    return sym->st_value + base;
+}
+
+// -------------------------------------------------------------------------
+// ELF hash function
+// This is the standard hash function used for indexing the bucket
+// array in the hash table.
+
+unsigned long Cyg_LoadObject_Base::elf_hash( const unsigned char *name )
+{
+    unsigned long h = 0, g;
+
+    while( *name )
+    {
+        h = ( h << 4 ) + *name++;
+        if( (g = h & 0xf0000000) != 0 )
+            h ^= g >> 24;
+        h &= ~g;
+    }
+    return h;
+}
+
+// -------------------------------------------------------------------------
+//
+
+Elf32_Sym *Cyg_LoadObject_Base::get_sym( Elf32_Word ix )
+{
+    if( symtab == NULL )
+        return NULL;
+    
+    return &symtab[ix];
+}
+
+char *Cyg_LoadObject_Base::get_name( Elf32_Word offset )
+{
+    if( strtab == NULL || offset > strsize )
+        return NULL;
+    
+    return (char *)(&strtab[offset]);
+}
+
+// -------------------------------------------------------------------------
+// Destructor
+
+// -------------------------------------------------------------------------
+// Cyg_LoadObject_Base destructor
+
+Cyg_LoadObject_Base::~Cyg_LoadObject_Base()
+{
+    CYG_REPORT_FUNCTION();
+    // empty out segments list
+    while( !segs.empty() )
+    {
+        Cyg_LoaderMemBlock *block = segs.rem_head();
+
+        block->free();
+    }
+    CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Translate a symbol into its address.
+
+void *Cyg_LoadObject_Base::symbol( const char *name )
+{
+    CYG_REPORT_FUNCTION();
+
+    Elf32_Addr addr = hash_lookup_addr( name );
+
+    if( addr == CYG_LOADER_NULLSYMADDR )
+        addr = 0;
+    
+    CYG_REPORT_RETVAL( addr );
+
+    return (void *)addr;
+}
+
+// -------------------------------------------------------------------------
+// Start the given executable object running
+
+cyg_code Cyg_LoadObject_Base::exec(int argc, char **argv, char **envv)
+{
+    CYG_REPORT_FUNCTION();
+    CYG_REPORT_FUNCARG3XV( argc, argv, envv );
+
+    cyg_code error = 0;
+    
+    CYG_REPORT_RETVAL(error);
+
+    return error;
+}
+
+// =========================================================================
+// Cyg_LoadObject members
+
+// -------------------------------------------------------------------------
+// Apply relocations
+
+void Cyg_LoadObject::relocate()
+{
+    CYG_REPORT_FUNCTION();
+
+    if( rel != NULL )
+    {
+        Elf32_Rel *r = rel;
+        for( int i = relsize; i > 0 && error == 0; i -= relent, r++ )
+            error = apply_rel( ELF32_R_TYPE(r->r_info),
+                               ELF32_R_SYM(r->r_info),
+                               r->r_offset);
+    }
+        
+
+    if( error == 0 && rela != NULL )
+    {
+        Elf32_Rela *r = rela;
+        for( int i = relasize; i > 0 && error == 0; i -= relaent, r++ )
+            error = apply_rela( ELF32_R_TYPE(r->r_info),
+                                ELF32_R_SYM(r->r_info),
+                                r->r_offset,
+                                r->r_addend);
+    }
+    
+    CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Apply JMPREL relocations for the PLT
+
+void Cyg_LoadObject::relocate_plt()
+{
+    CYG_REPORT_FUNCTION();
+
+    if( pltrel == DT_REL )
+    {
+        Elf32_Rel *r = (Elf32_Rel *)jmprel;
+        for( int i = pltrelsz; i > 0 && error == 0; i -= sizeof(Elf32_Rel), r++ )
+            error = apply_rel( ELF32_R_TYPE(r->r_info),
+                               ELF32_R_SYM(r->r_info),
+                               r->r_offset);
+    }
+        
+
+    if( error == 0 && pltrel == DT_RELA )
+    {
+        Elf32_Rela *r = (Elf32_Rela *)jmprel;
+        for( int i = pltrelsz; i > 0 && error == 0; i -= sizeof(Elf32_Rela), r++ )
+            error = apply_rela( ELF32_R_TYPE(r->r_info),
+                                ELF32_R_SYM(r->r_info),
+                                r->r_offset,
+                                r->r_addend);
+    }
+    
+    CYG_REPORT_RETURN();
+}
+
+// =========================================================================
+// Loader memory allocator default class methods.
+// The default behaviour of this class is to use malloc/realloc/free
+// to handle memory.
+
+// -------------------------------------------------------------------------
+
+Cyg_LoaderMemAlloc::Cyg_LoaderMemAlloc()
+{
+    // no initialization needed
+}
+
+// -------------------------------------------------------------------------
+
+Cyg_LoaderMemAlloc::~Cyg_LoaderMemAlloc()
+{
+    // No destruction needed
+}
+
+// -------------------------------------------------------------------------
+// Allocate memory of the supplied size and alignment.
+// size      - size in bytes
+// alignment - alignment expressed as a power of 2
+
+Cyg_LoaderMemBlock *Cyg_LoaderMemAlloc::alloc( cyg_int32 size,
+                                               cyg_int32 alignment)
+{
+#if CYGINT_ISO_MALLOC    
+    Cyg_LoaderMemBlock *block;
+    cyg_uint8 *mem;
+    cyg_uint32 acsize = sizeof(Cyg_LoaderMemBlock) + size + alignment;
+
+    mem = (cyg_uint8 *)::malloc( acsize );
+
+    if( mem == NULL )
+        return NULL;
+
+    block = (Cyg_LoaderMemBlock *)mem;
+
+    // set up aligned block address
+    block->address      = (void *)((((CYG_ADDRWORD)mem+sizeof(Cyg_LoaderMemBlock))+alignment) & ~(alignment-1));
+    block->size         = size;
+    block->alignment    = alignment;
+    block->mem          = this;
+    block->actual_address = (CYG_ADDRESS) mem;
+    block->actual_size    = acsize;
+
+    return block;
+
+#else
+
+    return 0;
+
+#endif
+    
+}
+
+// -------------------------------------------------------------------------
+// Reallocate block
+
+Cyg_LoaderMemBlock *Cyg_LoaderMemAlloc::realloc( Cyg_LoaderMemBlock *oblock,
+                                                 cyg_int32 size,
+                                                 cyg_int32 alignment)
+{
+#if CYGINT_ISO_MALLOC
+    
+    Cyg_LoaderMemBlock *block;
+    cyg_uint8 *mem;
+
+    if( alignment == -1 )
+        alignment = oblock->alignment;
+    
+    cyg_uint32 acsize = sizeof(Cyg_LoaderMemBlock) + size + alignment;
+
+    mem = (cyg_uint8 *)::realloc( (void *)(oblock->actual_address), acsize );
+
+    if( mem == NULL )
+        return NULL;
+
+    block = (Cyg_LoaderMemBlock *)mem;
+
+    // set up aligned block address
+    block->address      = (void *)((((CYG_ADDRWORD)mem+sizeof(Cyg_LoaderMemBlock))+alignment) & (alignment-1));
+    block->size         = size;
+    block->alignment    = alignment;
+    block->mem          = this;
+    block->actual_address = (CYG_ADDRESS) mem;
+    block->actual_size    = acsize;
+
+    return block;
+
+#else
+
+    return NULL;
+
+#endif
+}
+    
+// -------------------------------------------------------------------------
+// Free a previously allocated memory segment.
+
+void Cyg_LoaderMemAlloc::free( Cyg_LoaderMemBlock *block )
+{
+#if CYGINT_ISO_MALLOC        
+    ::free( (void *)block->actual_address );
+#endif    
+}
+
+// =========================================================================
+// Loader stream functions
+
+Cyg_LoaderStream::Cyg_LoaderStream()
+{
+}
+
+Cyg_LoaderStream::~Cyg_LoaderStream()
+{
+}
+
+cyg_code Cyg_LoaderStream::get_byte(CYG_BYTE *val)
+{
+    return CYG_LOADERR_EOF;
+}
+
+cyg_code Cyg_LoaderStream::get_data(CYG_BYTE *addr, CYG_ADDRWORD size)
+{
+    return CYG_LOADERR_EOF;
+}
+
+cyg_code Cyg_LoaderStream::seek(CYG_ADDRWORD pos)
+{
+    return CYG_LOADERR_SEEK;    
+}
+
+// =========================================================================
+// Memory based loader stream
+
+Cyg_LoaderStream_Mem::Cyg_LoaderStream_Mem( const void *addr, cyg_int32 size )
+{
+    base = pos = (CYG_ADDRESS)addr;
+    end = base + size;
+}
+
+Cyg_LoaderStream_Mem::~Cyg_LoaderStream_Mem()
+{
+    // nothing to do
+}
+    
+cyg_code Cyg_LoaderStream_Mem::get_byte(CYG_BYTE *val)
+{
+    if( pos == end )
+        return CYG_LOADERR_EOF;
+
+    *val = *(CYG_BYTE *)pos;
+    pos++;
+    
+    return CYG_LOADERR_NOERROR;
+}
+
+cyg_code Cyg_LoaderStream_Mem::get_data(CYG_BYTE *addr, CYG_ADDRWORD size)
+{
+    if( pos == end || (pos+size) > end )
+        return CYG_LOADERR_EOF;
+
+    memcpy( (void *)addr, (void *)pos, size );
+
+    pos += size;
+    
+    return CYG_LOADERR_NOERROR;
+}
+
+cyg_code Cyg_LoaderStream_Mem::seek(CYG_ADDRWORD apos)
+{
+    CYG_ADDRWORD npos = base+apos;
+    
+    if( npos > end || npos < base )
+        return CYG_LOADERR_SEEK;
+
+    pos = npos;
+
+    return CYG_LOADERR_NOERROR;
+}
+
+// =========================================================================
+// file based loader stream
+
+#ifdef CYGPKG_IO_FILEIO
+
+#include <unistd.h>
+
+Cyg_LoaderStream_File::Cyg_LoaderStream_File( int afd )
+{
+    fd = afd;
+}
+
+Cyg_LoaderStream_File::~Cyg_LoaderStream_File()
+{
+    // nothing to do
+    fd = 0;
+}
+    
+cyg_code Cyg_LoaderStream_File::get_byte(CYG_BYTE *val)
+{
+    ssize_t got = read( fd, (void *)val, 1 );
+    
+    if( got == 0 )
+        return CYG_LOADERR_EOF;
+
+    return CYG_LOADERR_NOERROR;
+}
+
+cyg_code Cyg_LoaderStream_File::get_data(CYG_BYTE *addr, CYG_ADDRWORD size)
+{
+    ssize_t got = read( fd, (void *)addr, size );
+    
+    if( got != (ssize_t)size )
+        return CYG_LOADERR_EOF;
+
+    return CYG_LOADERR_NOERROR;
+}
+
+cyg_code Cyg_LoaderStream_File::seek(CYG_ADDRWORD apos)
+{
+    off_t npos = lseek( fd, apos, SEEK_SET );
+    
+    if( npos != apos )
+        return CYG_LOADERR_SEEK;
+
+    return CYG_LOADERR_NOERROR;
+}
+
+#endif
+
+// =========================================================================
+// EOF loader.cxx
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/tests/entable.c
@@ -0,0 +1,79 @@
+//==========================================================================
+//
+//      entable.c
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-25
+// Purpose:             Convert binary file to C table
+// Description:         This is a simple host-side program that converts a binary
+//                      file on it's input to a C format table of unsigned chars
+//                      on its output. The single argument gives the name that the
+//                      table should be given.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <stdio.h>
+
+int main( int argc, char **argv )
+{
+    int i;
+
+    if( argc != 2 )
+    {
+        fprintf( stderr, "usage: %s <table name>\n",argv[0]);
+        exit(1);
+    }
+    
+    printf( "unsigned char %s[] = {\n", argv[1]);
+
+    for(i = 0; ; i++)
+    {
+        int c = getchar();
+
+        if( c == EOF ) break;
+
+        if( (i % 16) == 0 )
+            printf("\n\t");
+
+        printf( "0x%02x, ",c);
+    }
+
+    printf("\n};\n");
+
+    exit(0);
+}
+
+//==========================================================================
+// End of entable.c
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/tests/foo.c
@@ -0,0 +1,60 @@
+//==========================================================================
+//
+//      foo.c
+//
+//      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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):           nickg
+// Contributors:        nickg
+// Date:                2000-11-25
+// Purpose:             Test dynamic library
+// Description:         This file defines a test dynamic library. This contains
+//                      some simple definitions that exercise the dynamic library
+//                      mechanism.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+extern void fee(int);
+
+// ------------------------------------------------------------------------
+
+int foo_data = 1234;
+
+// ------------------------------------------------------------------------
+
+void foo(void)
+{
+    fee(foo_data+1);
+}
+
+//==========================================================================
+// End of foo.c
new file mode 100644
--- /dev/null
+++ b/packages/services/loader/current/tests/loadfoo.cxx
@@ -0,0 +1,115 @@
+//==========================================================================
+//
+//        loadfoo.cxx
+//
+//        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####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s):     nickg
+// Contributors:  nickg
+// Date:          2000-11-20
+// Description:   Dynamic library test
+//
+//####DESCRIPTIONEND####
+//==========================================================================
+
+#include <pkgconf/kernel.h>
+#include <pkgconf/hal.h>
+
+#include <cyg/infra/testcase.h>
+
+//#include <cyg/loader/loader.hxx>
+
+#include <dlfcn.h>
+
+//==========================================================================
+// Include a version of the library ELF file converted to a C table
+
+#include "tests/libfoo.so.c"
+
+//==========================================================================
+
+externC void cyg_dl_force(void);
+
+typedef void vfn();
+
+int fee_data = 0;
+
+//int main( int argc, char **argv )
+externC void cyg_start()
+{
+    CYG_TEST_INIT();
+
+    CYG_TEST_INFO( "LoadFoo: started" );
+#if 0    
+    Cyg_LoaderStream_Mem memstream(libfoo, sizeof( libfoo ) );
+
+    Cyg_LoadObject *obj;
+
+//    cyg_dl_force();
+    
+    Cyg_Loader::loader->load( memstream, 0, &obj );
+
+    vfn *foo = (vfn *)obj->symbol( "foo" );
+
+#else
+
+    void *fooh = dlopenmem( libfoo, sizeof(libfoo), RTLD_NOW );
+
+    vfn *foo = (vfn *)dlsym( fooh, "foo" );
+    
+#endif
+
+    
+    if( foo )
+    {
+        CYG_TEST_INFO( "LoadFoo: foo() call" );    
+        foo();
+        CYG_TEST_INFO( "LoadFoo: foo() returned" );            
+    }
+    else
+    {
+        CYG_TEST_FAIL_FINISH( "LoadFoo: foo() NULL!!!" );    
+    }
+
+    CYG_TEST_PASS_FINISH("LoadFoo: OK");
+    
+}
+
+//==========================================================================
+
+externC void fee(int x)
+{
+    CYG_TEST_INFO( "LoadFoo: fee() called" );    
+    fee_data = x;
+    CYG_TEST_INFO( "LoadFoo: fee() returning" );    
+}
+
+//==========================================================================
+// EOF loadfoo.cxx
--- a/packages/services/memalloc/common/current/ChangeLog
+++ b/packages/services/memalloc/common/current/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-20  Jesper Skov  <jskov@redhat.com>
+
+	* tests/heaptest.c: Fix failure reporting.
+
 2001-09-07  Jesper Skov  <jskov@redhat.com>
 
 	* tests/heaptest.c: Added some extra output on failures.
--- a/packages/services/memalloc/common/current/tests/heaptest.c
+++ b/packages/services/memalloc/common/current/tests/heaptest.c
@@ -117,7 +117,7 @@ test_pat(unsigned char *buf, int size,
         if (addrpat)
             bpat = ((int)bufptr)&0xFF;
         if ( *bufptr != bpat ) {
-            diag_printf( "Failed to compare at 0x%08x (saw 0x%08x expected 0x%08x)\n", 
+            diag_printf( "Failed to compare byte at 0x%08x (saw 0x%08x expected 0x%08x)\n", 
                          bufptr, *bufptr, bpat );
             if ( errors++ == ERRORTHRESHOLD )
                 CYG_TEST_FAIL_FINISH( testname );
@@ -131,8 +131,8 @@ test_pat(unsigned char *buf, int size,
         if (addrpat)
             pat = (unsigned int)ibufptr;
         if ( *ibufptr != pat ) {
-            diag_printf( "Failed to compare at 0x%08x (saw 0x%08x expected 0x%08x)\n", 
-                         bufptr, *ibufptr, pat );
+            diag_printf( "Failed to compare int at 0x%08x (saw 0x%08x expected 0x%08x)\n", 
+                         ibufptr, *ibufptr, pat );
             if ( errors++ == ERRORTHRESHOLD )
                 CYG_TEST_FAIL_FINISH( testname );
         }
@@ -144,7 +144,7 @@ test_pat(unsigned char *buf, int size,
         if (addrpat)
             bpat = ((int)bufptr)&0xFF;
         if ( *bufptr != bpat ) {
-            diag_printf( "Failed to compare at 0x%08x (saw 0x%08x expected 0x%08x)\n", 
+            diag_printf( "Failed to compare byte at 0x%08x (saw 0x%08x expected 0x%08x)\n", 
                          bufptr, *bufptr, bpat );
             if ( errors++ == ERRORTHRESHOLD )
                 CYG_TEST_FAIL_FINISH( testname );
--- a/packages/templates/all/ChangeLog
+++ b/packages/templates/all/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-01  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* current.ect: Add net related packages.
+
 2001-08-21  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* current.ect: Pre-infer CYGBLD_ISO_PMUTEXTYPES_HEADER.
--- a/packages/templates/all/current.ect
+++ b/packages/templates/all/current.ect
@@ -31,6 +31,9 @@ cdl_configuration template_all {
     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_IO_ETH_DRIVERS current ;
 };
 
 cdl_option CYGBLD_ISO_CTYPE_HEADER {
--- a/packages/templates/net/ChangeLog
+++ b/packages/templates/net/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-27  Jonathan Larmour  <jlarmour@redhat.com>
+
+	* current.ect: Don't include uitron. Not appropriate for base net
+	template.
+
 2001-08-21  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* current.ect: Pre-infer CYGBLD_ISO_PMUTEXTYPES_HEADER.
--- a/packages/templates/net/current.ect
+++ b/packages/templates/net/current.ect
@@ -26,7 +26,6 @@ cdl_configuration template_net {
     package     CYGPKG_LIBC_STDIO current ;
     package     CYGPKG_LIBM current ;
     package     CYGPKG_POSIX current ;
-    package     CYGPKG_UITRON current ;
     package     CYGPKG_IO_WATCHDOG current ;
     package     CYGPKG_IO_WALLCLOCK current ;
     package     CYGPKG_ERROR current ;
--- a/packages/templates/redboot/ChangeLog
+++ b/packages/templates/redboot/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-12  Gary Thomas  <gthomas@redhat.com>
+
+	* current.ect: Large stack no longer necessary as 'fconfig' data
+	is now associated with the FLASH workspace.	
+
 2001-09-04  Jonathan Larmour  <jlarmour@redhat.com>
 
 	* current.ect: Silence warnings when selecting redboot template.
--- a/packages/templates/redboot/current.ect
+++ b/packages/templates/redboot/current.ect
@@ -14,7 +14,7 @@ This is the RedBoot configuration, used 
     package     CYGPKG_INFRA current ;
     package     CYGPKG_REDBOOT current ;
     package     CYGPKG_ISOINFRA current ;
-    package     CYGPKG_LIBC_STRING current ;
+    package     CYGPKG_LIBC_STRING current ; 
 };
 
 cdl_option CYGBLD_BUILD_REDBOOT {
@@ -25,10 +25,6 @@ cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_
     user_value 0
 };
 
-cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE {
-    user_value 6144
-};
-
 cdl_option CYGBLD_ISO_STRTOK_R_HEADER {
     inferred_value 1 <cyg/libc/string/string.h>
 };
@@ -45,3 +41,7 @@ cdl_option CYGBLD_ISO_STRING_STRFUNCS_HE
     inferred_value 1 <cyg/libc/string/string.h>
 };
 
+cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE {
+    user_value 4096
+};
+