# HG changeset patch # User jlarmour # Date 995456319 0 # Node ID 42f843b391aa73fae6b10b1e4c2be8e4090b6948 # Parent f664e0b5f88ba95ccf472e56af07157f161764ee Merge from eCos master repository on 2001-07-18-03:13:25-BST diff --git a/host/ChangeLog b/host/ChangeLog --- a/host/ChangeLog +++ b/host/ChangeLog @@ -1,3 +1,9 @@ +2001-07-09 Julian Smart + + * Fixed (I hope) a long-term bug in both versions of the Configtool, + whereby conflicts involving bool-data values weren't + resolved. + 2001-06-18 Julian Smart * Added possible fix for Tcl crash bug under Windows 9x, by diff --git a/host/libcdl/ChangeLog b/host/libcdl/ChangeLog --- a/host/libcdl/ChangeLog +++ b/host/libcdl/ChangeLog @@ -1,3 +1,22 @@ +2001-07-11 Bart Veer + + * transact.cxx (is_preferable_to): + Consider active changes as well as value changes. + +2001-07-10 Bart Veer + + * transact.cxx (is_preferable_to): + Fine-tune the determination of which of two transactions has less + impact on the system. + + * infer.cxx (infer_handle_interface_value): + Add inference engine support for constraints of the form + (xxx == 0) and (xxx = 1), where xxx is an interface. + +2001-07-08 Jonathan Larmour + + * interp.cxx: include as isspace() is used. + 2001-06-21 Bart Veer diff --git a/host/libcdl/infer.cxx b/host/libcdl/infer.cxx --- a/host/libcdl/infer.cxx +++ b/host/libcdl/infer.cxx @@ -89,13 +89,18 @@ // switch statement and calls into various auxiliary functions when // necessary. // -// Forward declarations are needed to allow for active_if properties and -// the like. -// // For convenience the various entry points check whether or not the // desired condition is already satisfied. //}}} +//{{{ Forward declarations + +// ---------------------------------------------------------------------------- + +static bool infer_handle_interface_value(CdlTransaction, CdlInterface, CdlSimpleValue&, int); +static bool infer_handle_reference_bool(CdlTransaction, CdlValuable, bool, int); + +//}}} //{{{ CdlInfer::make_active() // ---------------------------------------------------------------------------- @@ -297,6 +302,9 @@ CdlInfer::set_valuable_value(CdlTransact } valuable->set_source(transaction, CdlValueSource_Inferred); result = transaction->resolve_recursion(level); + } else if (0 != dynamic_cast(valuable)) { + // Interfaces are not directly modifiable, but their implementors are. + result = infer_handle_interface_value(transaction, dynamic_cast(valuable), goal, level); } } break; @@ -314,6 +322,9 @@ CdlInfer::set_valuable_value(CdlTransact valuable->set_value(transaction, goal, CdlValueSource_Inferred); valuable->set_source(transaction, CdlValueSource_Inferred); result = transaction->resolve_recursion(level); + } else if (0 != dynamic_cast(valuable)) { + // Interfaces are not directly modifiable, but their implementors are. + result = infer_handle_interface_value(transaction, dynamic_cast(valuable), goal, level); } } break; @@ -413,47 +424,62 @@ CdlInfer::set_valuable_bool(CdlTransacti // preferred one. This happens for many binary operators. static bool -infer_choose2(CdlTransaction lhs_transaction, bool lhs_result, CdlTransaction rhs_transaction, bool rhs_result) +infer_lhs_preferable(CdlTransaction lhs_transaction, bool lhs_result, CdlTransaction rhs_transaction, bool rhs_result) { CYG_REPORT_FUNCNAMETYPE("infer_choose2", "result %d"); CYG_REPORT_FUNCARG4XV(lhs_transaction, lhs_result, rhs_transaction, rhs_result); - bool result = false; + CYG_PRECONDITIONC(lhs_result || rhs_result); + + bool result = true; if (lhs_result && !rhs_result) { // Only the lhs succeeded. - rhs_transaction->cancel(); - lhs_transaction->commit(); result = true; } else if (!lhs_result && rhs_result) { // Only the rhs succeeded. - lhs_transaction->cancel(); - rhs_transaction->commit(); - result = true; + result = false; } else if (lhs_result && rhs_result) { // Both sides succeeded. Next check for user_confirmation. bool lhs_confirm_needed = lhs_transaction->user_confirmation_required(); bool rhs_confirm_needed = rhs_transaction->user_confirmation_required(); if (lhs_confirm_needed && !rhs_confirm_needed) { - lhs_transaction->cancel(); - rhs_transaction->commit(); - result = true; + result = false; } else if (!lhs_confirm_needed && rhs_confirm_needed) { - rhs_transaction->cancel(); - lhs_transaction->commit(); result = true; } else { // Neither or both of the two sides need user confirmation, so they // are equal in that respect if (lhs_transaction->is_preferable_to(rhs_transaction)) { - rhs_transaction->cancel(); - lhs_transaction->commit(); result = true; } else { - lhs_transaction->cancel(); - rhs_transaction->commit(); - result = true; + result = false; } } + } + + CYG_REPORT_RETVAL(result); + return result; +} + +// A variant which will actually do the commits and cancels. This is +// commonly required when doing inferences of binary operators. +static bool +infer_choose2(CdlTransaction lhs_transaction, bool lhs_result, CdlTransaction rhs_transaction, bool rhs_result) +{ + CYG_REPORT_FUNCNAMETYPE("infer_choose2", "result %d"); + CYG_REPORT_FUNCARG4XV(lhs_transaction, lhs_result, rhs_transaction, rhs_result); + bool result = false; + + if (lhs_result || rhs_result) { + bool lhs_preferable = infer_lhs_preferable(lhs_transaction, lhs_result, rhs_transaction, rhs_result); + if (lhs_preferable) { + rhs_transaction->cancel(); + lhs_transaction->commit(); + } else { + lhs_transaction->cancel(); + rhs_transaction->commit(); + } + result = true; } else { // Neither side succeeded. lhs_transaction->cancel(); @@ -470,6 +496,139 @@ infer_choose2(CdlTransaction lhs_transac } //}}} +//{{{ infer_handle_interface() + +// ---------------------------------------------------------------------------- +// Set an interface to a specific value, which should be some number n. +// If (n == 0) then all implementers must be disabled or made inactive. +// If (n == 1) then exactly one of the implementers must be active and enabled. +// Other combinations are not considered here, they could lead to an +// exponential explosion. + +static bool +infer_handle_interface_value(CdlTransaction transaction, CdlInterface interface, CdlSimpleValue& goal, int level) +{ + CYG_REPORT_FUNCNAMETYPE("infer_handle_reference_bool", "result %d"); + CYG_REPORT_FUNCARG4XV(transaction, interface, &goal, level); + bool result = false; + + if (goal.has_integer_value()) { + cdl_int real_goal = goal.get_integer_value(); + if (real_goal == interface->get_integer_value(transaction)) { + result = true; + } else if (0 == real_goal) { + // All implementers must be disabled or made inactive. This + // can be achieved by creating a sub-transaction and calling + // infer_handle_reference_bool() on all of the implementers. + // + // However there are no guarantees that the result is what + // is intended. Updating a later implementer may as a side + // effect cause an earlier one to become active again. Also + // there may be confusion with valuables with the data + // flavor being given a value of 0. Hence a final check is + // needed that the new interface value really is the desired goal. + CdlTransaction sub_transaction; + std::vector implementers; + std::vector::const_iterator impl_i; + + sub_transaction = transaction->make(transaction->get_conflict()); + try { + interface->get_implementers(implementers); + for (impl_i = implementers.begin(); impl_i != implementers.end(); impl_i++) { + (void) infer_handle_reference_bool(sub_transaction, *impl_i, false, level); + } + if (0 == interface->get_integer_value(sub_transaction)) { + sub_transaction->commit(); + result = true; + } else { + sub_transaction->cancel(); + } + } catch (...) { + delete sub_transaction; + throw; + } + delete sub_transaction; + sub_transaction = 0; + + } else if (1 == real_goal) { + // This is a bit trickier than the above. We need n + // sub-transactions, one per implementer. In each + // sub-transaction we try to set exactly one of the + // implementers to enabled and the rest to disabled. + std::vector implementers; + unsigned int impl_count; + unsigned int i, j; + + interface->get_implementers(implementers); + impl_count = implementers.size(); + std::vector sub_transactions; + std::vector results; + + try { + for (i = 0; i < impl_count; i++) { + CdlTransaction sub_transaction = transaction->make(transaction->get_conflict()); + sub_transactions.push_back(sub_transaction); + results.push_back(false); + results[i] = false; + } + for (i = 0; i < impl_count; i++) { + for (j = 0; j < impl_count; j++) { + (void) infer_handle_reference_bool(sub_transactions[i], implementers[j], (i == j), level); + } + if (1 == interface->get_integer_value(sub_transactions[i])) { + results[i] = true; + } + } + + // At this point we may have some combination of successful and unsucessful + // sub-transactions, and it is time to choose the best one. + CdlTransaction preferred = 0; + for (i = 0; i < impl_count; i++) { + if (results[i]) { + preferred = sub_transactions[i]; + break; + } + } + + for (j = i + 1; j < impl_count; j++) { + if (results[j]) { + if (!infer_lhs_preferable(preferred, true, sub_transactions[j], true)) { + preferred = sub_transactions[j]; + } + } + } + + // Now either preferred == 0, i.e. all + // sub-transactions failed and we want to cancel them + // all. Or we have a viable sub-transaction. + for (i = 0; i < impl_count; i++) { + if (preferred == sub_transactions[i]) { + sub_transactions[i]->commit(); + result = true; + } else { + sub_transactions[i]->cancel(); + } + delete sub_transactions[i]; + sub_transactions[i] = 0; + } + + } catch(...) { + for (i = 0; i < sub_transactions.size(); i++) { + if (0 != sub_transactions[i]) { + sub_transactions[i]->cancel(); + delete sub_transactions[i]; + sub_transactions[i] = 0; + } + } + } + } + } + + CYG_REPORT_RETVAL(result); + return result; +} + +//}}} //{{{ infer_handle_reference() // ---------------------------------------------------------------------------- diff --git a/host/libcdl/interp.cxx b/host/libcdl/interp.cxx --- a/host/libcdl/interp.cxx +++ b/host/libcdl/interp.cxx @@ -59,6 +59,9 @@ // in #include +// quote() needs access to isspace() +#include + //}}} //{{{ Statics diff --git a/host/libcdl/transact.cxx b/host/libcdl/transact.cxx --- a/host/libcdl/transact.cxx +++ b/host/libcdl/transact.cxx @@ -10,7 +10,7 @@ //####COPYRIGHTBEGIN#### // // ---------------------------------------------------------------------------- -// Copyright (C) 1999, 2000 Red Hat, Inc. +// Copyright (C) 1999, 2000, 2001 Red Hat, Inc. // // This file is part of the eCos host tools. // @@ -2373,7 +2373,10 @@ CdlTransactionBody::is_preferable_to(Cdl CYG_PRECONDITIONC(this != other); bool result = false; - if (this->changes.size() < other->changes.size()) { + unsigned int this_changes = this->changes.size() + this->activated.size() + this->deactivated.size(); + unsigned int other_changes = other->changes.size() + other->activated.size() + other->deactivated.size(); + + if (this_changes <= other_changes) { result = true; } diff --git a/host/tools/configtool/ChangeLog b/host/tools/configtool/ChangeLog --- a/host/tools/configtool/ChangeLog +++ b/host/tools/configtool/ChangeLog @@ -1,3 +1,7 @@ +2001-07-08 Jonathan Larmour + + * common/common/flags.cxx: Include for isspace() + 2001-02-14 Julian Smart * standalone/win32/configtool.cpp diff --git a/host/tools/configtool/common/common/build.cxx b/host/tools/configtool/common/common/build.cxx --- a/host/tools/configtool/common/common/build.cxx +++ b/host/tools/configtool/common/common/build.cxx @@ -56,6 +56,12 @@ #include "flags.hxx" #include "build.hxx" +// Two methods of generating Cygwin filenames +// CYGWIN_USE_CYGDRIVE = 0: use e.g. //c/, but this is deprecated in new versions of Cygwin +// CYGWIN_USE_CYGDRIVE = 1: use e.g. /cygdrive/c/ +// CYGWIN_USE_CYGDRIVE = 2: use e.g. c:/ notation +#define CYGWIN_USE_CYGDRIVE 1 + std::string makefile_header = "# eCos makefile\n\n# This is a generated file - do not edit\n\n"; bool eval_tcl_command (const std::string command) { @@ -129,11 +135,6 @@ std::string nospace_path (const std::str } #endif -// Two methods of generating Cygwin filenames -// CYGWIN_USE_CYGDRIVE = 1: use e.g. /cygdrive/c/, but this can have problems with mkdir -p -// CYGWIN_USE_CYGDRIVE = 0: use e.g. //c/, but this is deprecated in new versions of Cygwin -#define CYGWIN_USE_CYGDRIVE 0 - // convert a DOS filepath to a Cygwin filepath std::string cygpath (const std::string input) { #ifdef _WIN32 @@ -148,7 +149,7 @@ std::string cygpath (const std::string i output = buffer; #else -#if CYGWIN_USE_CYGDRIVE +#if CYGWIN_USE_CYGDRIVE == 1 std::string strCygdrive("/cygdrive"); HKEY hKey = 0; @@ -174,6 +175,11 @@ std::string cygpath (const std::string i output += ('\\' == path [n]) ? '/' : path [n]; // convert backslash to slash } } +#elif CYGWIN_USE_CYGDRIVE == 2 + // Convert to c:/foo/bar notation + for (unsigned int n = 0; n < path.size (); n++) { // for each char + output += ('\\' == path [n]) ? '/' : path [n]; // convert backslash to slash + } #else for (unsigned int n = 0; n < path.size (); n++) { // for each char if ((1 == n) && (':' == path [n])) { // if a DOS logical drive letter is present @@ -301,6 +307,11 @@ bool generate_makefile (const CdlConfigu fprintf (stream, "export COMMAND_PREFIX := %s\n", command_prefix.c_str ()); fprintf (stream, "export CC := $(COMMAND_PREFIX)gcc\n"); fprintf (stream, "export OBJCOPY := $(COMMAND_PREFIX)objcopy\n"); +#ifdef _WIN32 + fprintf (stream, "export HOST := CYGWIN\n"); +#else + fprintf (stream, "export HOST := UNIX\n"); +#endif fprintf (stream, "export AR := $(COMMAND_PREFIX)ar\n\n"); // generate the package variables @@ -388,7 +399,17 @@ bool generate_makefile (const CdlConfigu fprintf (stream, "\n\n"); for (count = 0; count < info.headers.size (); count++) { // for each header fprintf (stream, "$(PREFIX)/include/%s: $(REPOSITORY)/$(PACKAGE)/%s\n", info.headers [count].destination.c_str (), info.headers [count].source.c_str ()); - fprintf (stream, "\t@mkdir -p $(dir $@)\n"); +#if defined(_WIN32) && (CYGWIN_USE_CYGDRIVE == 1) + fprintf (stream, "ifeq ($(HOST),CYGWIN)\n"); + fprintf (stream, "\t@mkdir -p `cygpath -w \"$(dir $@)\" | sed \"s/\\\\\\\\\\/\\\\//g\"`\n"); + fprintf (stream, "else\n"); + fprintf (stream, "\t@mkdir -p $(dir $@)\n"); + fprintf (stream, "endif\n"); +#else + // This prevents older versions of mkdir failing + fprintf (stream, "\t@mkdir -p $(dir $@)\n"); +#endif + fprintf (stream, "\t@cp $< $@\n"); fprintf (stream, "\t@chmod u+w $@\n\n"); } @@ -445,6 +466,11 @@ bool generate_toplevel_makefile (const C // generate the variables fprintf (stream, "export REPOSITORY := %s\n", cygpath (config->get_database ()->get_component_repository ()).c_str ()); +#ifdef _WIN32 + fprintf (stream, "export HOST := CYGWIN\n"); +#else + fprintf (stream, "export HOST := UNIX\n"); +#endif fprintf (stream, "export PREFIX := %s\n", cygpath (install_tree).c_str ()); fprintf (stream, "export COMMAND_PREFIX := %s\n", command_prefix.c_str ()); fprintf (stream, "export CC := $(COMMAND_PREFIX)gcc\n"); diff --git a/host/tools/configtool/common/common/flags.cxx b/host/tools/configtool/common/common/flags.cxx --- a/host/tools/configtool/common/common/flags.cxx +++ b/host/tools/configtool/common/common/flags.cxx @@ -39,6 +39,7 @@ //========================================================================== #include "flags.hxx" +#include static const std::string GLOBAL_FLAGS_PREFIX = "CYGBLD_GLOBAL_"; static const std::string ADD_FLAGS_SUFFIX = "_ADD"; diff --git a/host/tools/configtool/common/win32/FailingRulesDialog.cpp b/host/tools/configtool/common/win32/FailingRulesDialog.cpp --- a/host/tools/configtool/common/win32/FailingRulesDialog.cpp +++ b/host/tools/configtool/common/win32/FailingRulesDialog.cpp @@ -182,8 +182,11 @@ void CFailingRulesDialog::OnOK() { bool bEnabled=value.is_enabled(); str.Format(_T("%s %s and set value to %s\n"),bEnabled?_T("disable"):_T("enable"),strName,strValue); - CdlSimpleValue simple_value = valuable->get_simple_value (); - valuable->set_enabled_and_value (m_Transaction, bEnabled, simple_value, CdlValueSource_User); + // This is wrong: it should set the NEW value. This is the cause of a long-standing bug... + // CdlSimpleValue simple_value = valuable->get_simple_value (); + //valuable->set_enabled_and_value (m_Transaction, bEnabled, simple_value, CdlValueSource_User); + valuable->set_enabled_and_value (m_Transaction, bEnabled, CUtils::UnicodeToStdStr (strValue), CdlValueSource_User); + } break; case CdlValueFlavor_Data : diff --git a/host/tools/configtool/standalone/wxwin/CHANGES.txt b/host/tools/configtool/standalone/wxwin/CHANGES.txt --- a/host/tools/configtool/standalone/wxwin/CHANGES.txt +++ b/host/tools/configtool/standalone/wxwin/CHANGES.txt @@ -1,7 +1,17 @@ Release History for eCos Configuration Tool 2 ============================================= -*** Version 2.03, July 2nd 2001 + +*** Version 2.04, July 16th 2001 + +- Now uses /cygdrive/ notation which is future-proof for newer Cygwins, + and works around a mkdir bug in older Cygwins. A side-effect of this + is that we no longer mount drives from the tool, so we don't get the + flashing DOS box under Windows. Makefiles now define HOST=CYGWIN + so that makefiles can use mkdir the right way under Windows. + + +*** Version 2.03, July 9nd 2001 - Corrected a bug introduced in the previous release, where the initial template selection was wrong. @@ -20,6 +30,12 @@ Release History for eCos Configuration T - Fixed bug where message box with an empty repository name was shown if no repository was found at all. +- Fixed long-term Configuration Tool bug where some conflicts weren't resolved properly + (bool-data options). + +- Added vertical scrollbar to Short Description window. + + *** Version 2.02, June 27th 2001 - Packages are now sorted in the Packages Dialog. @@ -50,6 +66,7 @@ Release History for eCos Configuration T - Added CHANGES.txt and TODO.txt to the distribution. + *** Version 2.01, June 2001 - Clicking Save when tool was first loaded didn't do anything. diff --git a/host/tools/configtool/standalone/wxwin/configtool.cpp b/host/tools/configtool/standalone/wxwin/configtool.cpp --- 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.38 2001/07/05 10:42:16 julians Exp $ +// Version: $Id: configtool.cpp,v 1.40 2001/07/16 14:02:56 julians Exp $ // Purpose: // Description: Implementation file for the ConfigTool application class // Requires: @@ -880,12 +880,15 @@ bool ecApp::PrepareEnvironment(bool bWit // Useful for ecosconfig wxSetEnv(wxT("ECOS_REPOSITORY"), pDoc->GetPackagesDir()); + // No longer necessary because we're using /cygdrive notation +#if 0 if (! pDoc->GetBuildTree().IsEmpty()) CygMount(pDoc->GetBuildTree()[0]); if (! pDoc->GetInstallTree().IsEmpty()) CygMount(pDoc->GetInstallTree()[0]); if (! pDoc->GetRepository().IsEmpty()) CygMount(pDoc->GetRepository()[0]); +#endif } } } @@ -924,27 +927,27 @@ bool ecApp::PrepareEnvironment(bool bWit { if (!strBinDir.IsEmpty()) { - (* cmdLine) += wxString(wxT("export PATH=")) + strBinDir + wxT(":$PATH; "); - + (* cmdLine) += wxString(wxT("export PATH=")) + wxString(strBinDir) + wxT(":$PATH; "); + // Also set the path wxString oldPath(wxGetenv(wxT("PATH"))); wxString path(strBinDir); if (!oldPath.IsEmpty()) - { - path += wxT(":"); + { + path += wxT(":"); path += oldPath; - } + } wxSetEnv(wxT("PATH"), path); } (* cmdLine) += wxString(wxT("unset GDBTK_LIBRARY; ")) ; wxUnsetEnv(wxT("GDBTK_LIBRARY")); - + (* cmdLine) += wxString(wxT("unset GCC_EXEC_PREFIX; ")) ; wxUnsetEnv(wxT("GCC_EXEC_PREFIX")); - - (* cmdLine) += wxString(wxT("export ECOS_REPOSITORY=")) + pDoc->GetPackagesDir()+ wxT("; "); + + (* cmdLine) += wxString(wxT("export ECOS_REPOSITORY=")) + wxString(pDoc->GetPackagesDir()) + wxT("; "); wxSetEnv(wxT("ECOS_REPOSITORY"), pDoc->GetPackagesDir()); - + #if 0 ecFileName strUserBinDir(GetSettings().m_userToolsDir); if(strUserBinDir.IsEmpty()) @@ -966,16 +969,16 @@ bool ecApp::PrepareEnvironment(bool bWit strHostToolsBinDir = strHostToolsBinDir.Head (); // tools directories are in the order host-tools, user-tools, comp-tools, install/bin (if present), contrib-tools (if present) on the path - + // TODO: is this right? Assuming that the user tools are already in the user's path. // const ecFileName strContribBinDir(strUserBinDir, wxT("..\\contrib\\bin")); // const ecFileName strUsrBinDir(strUserBinDir, wxT("..\\usr\\bin")); const ecFileName strInstallBinDir(pDoc->GetInstallTree (), wxT("bin")); - - (* cmdLine) += wxString(wxT("export PATH=")) + strInstallBinDir + wxT(":$PATH; "); + + (* cmdLine) += wxString(wxT("export PATH=")) + wxString(strInstallBinDir) + wxT(":$PATH; "); (* cmdLine) += wxString(wxT("unset GDBTK_LIBRARY; ")) ; (* cmdLine) += wxString(wxT("unset GCC_EXEC_PREFIX; ")) ; - (* cmdLine) += wxString(wxT("export ECOS_REPOSITORY=")) + pDoc->GetPackagesDir()+ wxT("; "); + (* cmdLine) += wxString(wxT("export ECOS_REPOSITORY=")) + wxString(pDoc->GetPackagesDir()) + wxT("; "); } #endif } @@ -1038,7 +1041,14 @@ void ecApp::Build(const wxString &strWha strCmd += GetSettings().m_strMakeOptions; } strCmd += wxT(" --directory "); - strCmd += pDoc->GetBuildTree(); + + // Quoting the name may not mix with the 'sh' command on Unix, so only do it + // under Windows where it's more likely there will be spaces needing quoting. +#ifdef __WXMSW__ + strCmd += wxString(wxT("\"")) + wxString(pDoc->GetBuildTree()) + wxString(wxT("\"")); +#else + strCmd += wxString(pDoc->GetBuildTree()) ; +#endif wxString variableSettings; diff --git a/host/tools/configtool/standalone/wxwin/configtool.h b/host/tools/configtool/standalone/wxwin/configtool.h --- a/host/tools/configtool/standalone/wxwin/configtool.h +++ b/host/tools/configtool/standalone/wxwin/configtool.h @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/08/24 -// Version: $Id: configtool.h,v 1.23 2001/06/18 14:41:13 julians Exp $ +// Version: $Id: configtool.h,v 1.24 2001/07/13 15:17:43 julians Exp $ // Purpose: // Description: main header file for the ConfigTool application // Requires: @@ -102,7 +102,7 @@ class ecPipedProcess; // Define a new application type, each program should derive a class from wxApp class ecApp : public wxApp { - friend ecMainFrame; + friend class ecMainFrame; public: //// Ctor & dtor ecApp(); diff --git a/host/tools/configtool/standalone/wxwin/configtoolview.cpp b/host/tools/configtool/standalone/wxwin/configtoolview.cpp --- a/host/tools/configtool/standalone/wxwin/configtoolview.cpp +++ b/host/tools/configtool/standalone/wxwin/configtoolview.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/10/05 -// Version: $Id: configtoolview.cpp,v 1.10 2001/06/04 17:00:43 julians Exp $ +// Version: $Id: configtoolview.cpp,v 1.11 2001/07/13 15:17:43 julians Exp $ // Purpose: // Description: Implementation file for the ecConfigToolView class // Requires: @@ -431,17 +431,17 @@ ecConfigItem *ecConfigToolView::DoFind(c strName.MakeLower(); } - int nIndex=strName.Find(strFind); + int nIndex = strName.Find(strFind); if(-1!=nIndex) { if (wxGetApp().GetSettings().m_findMatchWholeWord) { // Enforce whole-word semantics: to left and right - if(nIndex>0 && IsWordChar(strName[nIndex-1])){ + if(nIndex>0 && IsWordChar(strName[(unsigned) (nIndex-1)])){ continue; } nIndex += strFind.Length(); - if (nIndex < strName.Length() && IsWordChar(strName[nIndex])){ + if (nIndex < strName.Length() && IsWordChar(strName[(unsigned) nIndex])){ continue; } } diff --git a/host/tools/configtool/standalone/wxwin/conflictsdlg.cpp b/host/tools/configtool/standalone/wxwin/conflictsdlg.cpp --- a/host/tools/configtool/standalone/wxwin/conflictsdlg.cpp +++ b/host/tools/configtool/standalone/wxwin/conflictsdlg.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/09/06 -// Version: $Id: conflictsdlg.cpp,v 1.3 2001/04/03 14:28:56 julians Exp $ +// Version: $Id: conflictsdlg.cpp,v 1.4 2001/07/09 14:21:32 julians Exp $ // Purpose: // Description: Implementation file for the ecResolveConflictsDialog // Requires: @@ -291,8 +291,11 @@ void ecResolveConflictsDialog::OnContinu { bool bEnabled=value.is_enabled(); str.Printf(_("%s %s and set value to %s\n"), (const wxChar*) (bEnabled? _("disable"):_("enable")), (const wxChar*) strName, (const wxChar*) strValue); - CdlSimpleValue simple_value = valuable->get_simple_value (); - valuable->set_enabled_and_value (m_Transaction, bEnabled, simple_value, CdlValueSource_User); + // Surely this is wrong - we don't want to set the same value, we want to + // set a NEW value. + // CdlSimpleValue simple_value = valuable->get_simple_value (); + //valuable->set_enabled_and_value (m_Transaction, bEnabled, simple_value, CdlValueSource_User); + valuable->set_enabled_and_value (m_Transaction, bEnabled, ecUtils::UnicodeToStdStr (strValue), CdlValueSource_User); } break; case CdlValueFlavor_Data : diff --git a/host/tools/configtool/standalone/wxwin/filename.cpp b/host/tools/configtool/standalone/wxwin/filename.cpp --- a/host/tools/configtool/standalone/wxwin/filename.cpp +++ b/host/tools/configtool/standalone/wxwin/filename.cpp @@ -239,7 +239,7 @@ const ecFileName ecFileName::FullName() return *this; } #else - return wxGetCwd() + wxString(cSep) + *this; + return wxGetCwd() + wxString(cSep) + wxString(*this); #endif } @@ -706,7 +706,7 @@ int ecFileName::FindFiles (const wxStrin void ecFileName::ReplaceExtension(const wxString& newExt) { wxString ext = newExt; - if (ext[0] == wxT('.')) + if (ext[(unsigned) 0] == wxT('.')) ext = ext.Mid(1); wxStripExtension(* this); diff --git a/host/tools/configtool/standalone/wxwin/mainwin.cpp b/host/tools/configtool/standalone/wxwin/mainwin.cpp --- a/host/tools/configtool/standalone/wxwin/mainwin.cpp +++ b/host/tools/configtool/standalone/wxwin/mainwin.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/08/24 -// Version: $Id: mainwin.cpp,v 1.46 2001/06/29 13:48:22 julians Exp $ +// Version: $Id: mainwin.cpp,v 1.47 2001/07/09 14:21:32 julians Exp $ // Purpose: // Description: Implementation file for the ConfigTool main window // Requires: @@ -458,7 +458,7 @@ void ecMainFrame::CreateWindows() m_shortDescrSashWindow->SetOrientation(wxLAYOUT_HORIZONTAL); m_shortDescrSashWindow->SetAlignment(wxLAYOUT_TOP); //m_shortDescrSashWindow->SetSashVisible(wxSASH_TOP, TRUE); - m_shortDescrWindow = new ecShortDescriptionWindow(m_shortDescrSashWindow, ecID_SHORT_DESCR_WINDOW, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxCLIP_CHILDREN|wxTE_NO_VSCROLL|wxTE_READONLY); + m_shortDescrWindow = new ecShortDescriptionWindow(m_shortDescrSashWindow, ecID_SHORT_DESCR_WINDOW, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxCLIP_CHILDREN/*|wxTE_NO_VSCROLL*/|wxTE_READONLY); m_shortDescrWindow->SetBackgroundColour(wxColour(255, 255, 225)); m_shortDescrWindow->SetHelpText(_("The short description window displays brief help on a selected configuration item.")); diff --git a/host/tools/configtool/standalone/wxwin/mainwin.h b/host/tools/configtool/standalone/wxwin/mainwin.h --- a/host/tools/configtool/standalone/wxwin/mainwin.h +++ b/host/tools/configtool/standalone/wxwin/mainwin.h @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/08/24 -// Version: $Id: mainwin.h,v 1.17 2001/04/24 17:01:45 julians Exp $ +// Version: $Id: mainwin.h,v 1.18 2001/07/13 15:17:43 julians Exp $ // Purpose: // Description: Header file for the ConfigTool main window // Requires: @@ -74,7 +74,7 @@ class WXDLLEXPORT wxSashLayoutWindow; // Define a new frame type: this is going to be our main frame class ecMainFrame : public wxDocParentFrame { - friend ecFindDialog; + friend class ecFindDialog; public: // Ctor(s) diff --git a/host/tools/configtool/standalone/wxwin/symbols.h b/host/tools/configtool/standalone/wxwin/symbols.h --- a/host/tools/configtool/standalone/wxwin/symbols.h +++ b/host/tools/configtool/standalone/wxwin/symbols.h @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2001/05/14 -// Version: $Id: symbols.h,v 1.6 2001/06/28 15:54:25 julians Exp $ +// Version: $Id: symbols.h,v 1.7 2001/07/16 14:02:56 julians Exp $ // Purpose: // Description: Some important symbols, such as the version // Requires: @@ -43,5 +43,5 @@ // //=========================================================================== -#define ecCONFIGURATION_TOOL_VERSION 2.03 +#define ecCONFIGURATION_TOOL_VERSION 2.04 diff --git a/host/tools/configtool/standalone/wxwin/templatesdlg.cpp b/host/tools/configtool/standalone/wxwin/templatesdlg.cpp --- a/host/tools/configtool/standalone/wxwin/templatesdlg.cpp +++ b/host/tools/configtool/standalone/wxwin/templatesdlg.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/09/27 -// Version: $Id: templatesdlg.cpp,v 1.7 2001/06/28 15:54:25 julians Exp $ +// Version: $Id: templatesdlg.cpp,v 1.8 2001/07/13 15:17:43 julians Exp $ // Purpose: // Description: Implementation file for ecTemplatesDialog // Requires: @@ -219,14 +219,14 @@ void ecTemplatesDialog::PopulateControls // use the first alias (if any) as the description wxString strTargetDescription = aliases.size () ? aliases [0].c_str () : target_i->c_str (); - cdlHardwareCtrl->Append(strTargetDescription, (void*) target_i); // store the target iterator + cdlHardwareCtrl->Append(strTargetDescription, (void*) &(*target_i)); // store the target iterator std::string str(* (target_i)); if (m_hardware == str.c_str()) // if current target... { int sel = 0; int i; for (i = 0; i <= nIndex; i++) - if (cdlHardwareCtrl->GetClientData(i) == (void*) target_i) + if (cdlHardwareCtrl->GetClientData(i) == (void*) &(*target_i)) sel = i; cdlHardwareCtrl->SetSelection (sel); // ...select the string } @@ -244,7 +244,7 @@ void ecTemplatesDialog::PopulateControls for (template_i = templates.begin (); template_i != templates.end (); template_i++) { wxString strTemplateDescription = template_i->c_str (); - cdlPackageCtrl->Append(strTemplateDescription, (void*) template_i); // store the template iterator + cdlPackageCtrl->Append(strTemplateDescription, (void*) &(*template_i)); // store the template iterator /// m_cboCdlTemplate.SetItemData (nIndex, (DWORD) template_i); // store the template iterator std::string str(* (template_i)); if (m_template == str.c_str()) // if current template... @@ -319,7 +319,8 @@ void ecTemplatesDialog::OnSelHardwareTem // the target has changed so retrieve the new target description const int nIndex = cdlHardwareCtrl->GetSelection (); - std::vector::const_iterator template_i = (std::vector::const_iterator) cdlHardwareCtrl->GetClientData (nIndex); + //std::vector::const_iterator template_i = (std::vector::const_iterator) cdlHardwareCtrl->GetClientData (nIndex); + std::string* template_i = (std::string*) cdlHardwareCtrl->GetClientData (nIndex); m_hardware = template_i->c_str(); m_strCdlHardwareDescription = doc->GetCdlPkgData ()->get_target_description ((const wxChar*) m_hardware).c_str (); @@ -338,7 +339,8 @@ void ecTemplatesDialog::OnSelPackageTemp // the template has changed so update the version combo box int nIndex = cdlPackageCtrl->GetSelection (); - std::vector::const_iterator template_i = (std::vector::const_iterator) cdlPackageCtrl->GetClientData (nIndex); + //std::vector::const_iterator template_i = (std::vector::const_iterator) cdlPackageCtrl->GetClientData (nIndex); + std::string *template_i = (std::string*) cdlPackageCtrl->GetClientData (nIndex); m_template = template_i->c_str(); UpdateVersionList (wxT("")); // repopulate template versions combo box and select most recent version diff --git a/packages/ChangeLog b/packages/ChangeLog --- a/packages/ChangeLog +++ b/packages/ChangeLog @@ -1,3 +1,18 @@ +2001-07-16 Bart Veer + + * pkgconf/fixhtml.tcl: + Add smarttags protection to the HTML files generated from DocBook. + Remove spurious comment. + +2001-07-16 Julian Smart + + * pkconf/rules.mak: worked around Cygwin mkdir problem + by introducing a HOST variable and testing for HOST=CYGWIN. + +2001-07-06 Jesper Skov + + * ecos.db: Added wallclock driver for DS12887. Moved SH3 wallclock + driver into SH directory. 2001-06-28 Jonathan Larmour * ecos.db: Clarify edb7xxx description. diff --git a/packages/NEWS b/packages/NEWS --- a/packages/NEWS +++ b/packages/NEWS @@ -1,3 +1,4 @@ +* Added wallclock driver for DS12887 * AM33 STB flash driver added. * C library now supports multiple locales with multibyte character set support, and the possibility of plugging in more. Current locales supported diff --git a/packages/devs/eth/smsc/lan91cxx/current/ChangeLog b/packages/devs/eth/smsc/lan91cxx/current/ChangeLog --- a/packages/devs/eth/smsc/lan91cxx/current/ChangeLog +++ b/packages/devs/eth/smsc/lan91cxx/current/ChangeLog @@ -1,3 +1,12 @@ +2001-07-11 Hugo Tyson + + * src/if_lan91cxx.c (lan91cxx_stop): Clean up any pending tx both + to prevent mbuf leak due to noncompletion, and to clear tx_busy so + that the newly upbrung device can be used. + (lan91cxx_can_send): Similarly detect a stopped tx engine and + restart it, and clean up any pending tx, in here. Otherwise the + system cannot progress. + 2001-03-27 Hugo Tyson 2001-03-27 Robin Farine diff --git a/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c b/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c --- a/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c +++ b/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c @@ -255,10 +255,24 @@ smsc_lan91cxx_init(struct cyg_netdevtab_ static void lan91cxx_stop(struct eth_drv_sc *sc) { + struct lan91cxx_priv_data *cpd = + (struct lan91cxx_priv_data *)sc->driver_private; DEBUG_FUNCTION(); + + CYG_ASSERT( cpd->within_send < 10, "stop: Excess send recursions" ); + cpd->within_send++; + // Complete any outstanding activity: + if ( cpd->txbusy ) { + cpd->txbusy = 0; +#if DEBUG & 9 + diag_printf("LAN91CXX - Stopping, cleaning up pending TX\n" ); +#endif + (sc->funs->eth_drv->tx_done)(sc, cpd->txkey, 0); + } // Reset chip put_reg(sc, LAN91CXX_RCR, LAN91CXX_RCR_SOFT_RST); put_reg(sc, LAN91CXX_RCR, 0); + cpd->txbusy = cpd->within_send = 0; } // @@ -514,6 +528,7 @@ lan91cxx_can_send(struct eth_drv_sc *sc) struct lan91cxx_priv_data *cpd = (struct lan91cxx_priv_data *)sc->driver_private; unsigned short stat; + int tcr; DEBUG_FUNCTION(); stat = get_reg(sc, LAN91CXX_EPH_STATUS); @@ -523,6 +538,24 @@ lan91cxx_can_send(struct eth_drv_sc *sc) CYG_ASSERT( cpd->within_send < 10, "can_send: Excess send recursions" ); cpd->within_send++; + + tcr = get_reg(sc, LAN91CXX_TCR); + if ( 0 == (LAN91CXX_TCR_TXENA & tcr) ) { +#if DEBUG & 1 + diag_printf("%s: ENGINE RESTART: tcr %x\n", __FUNCTION__, tcr ); +#endif + // Complete any outstanding activity: + if ( cpd->txbusy ) { + cpd->txbusy = 0; +#if DEBUG & 9 + diag_printf("LAN91CXX - can_send, cleaning up pending TX\n" ); +#endif + (sc->funs->eth_drv->tx_done)(sc, cpd->txkey, 0); + } + tcr |= LAN91CXX_TCR_TXENA; + put_reg(sc, LAN91CXX_TCR, tcr); + } + // This helps unstick deadly embraces. lan91cxx_poll( sc ); // Deal with any outstanding rx state cpd->within_send--; diff --git a/packages/devs/flash/arm/ebsa285/current/ChangeLog b/packages/devs/flash/arm/ebsa285/current/ChangeLog --- a/packages/devs/flash/arm/ebsa285/current/ChangeLog +++ b/packages/devs/flash/arm/ebsa285/current/ChangeLog @@ -1,3 +1,8 @@ +2001-07-11 Andrew Lunn + + * src/flash.h: + * src/ebsa285_flash.c (flash_hwr_init): Support new device 28F008SC. + 2001-06-11 Gary Thomas * src/ebsa285_flash.c: Remove dependency on printf() via user functions. diff --git a/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c b/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c --- a/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c +++ b/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c @@ -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. // ------------------------------------------- // @@ -70,7 +70,8 @@ flash_hwr_init(void) HAL_ICACHE_ENABLE(); - if ((data[0] == FLASH_Intel_code) && (data[4] == FLASH_28F008SA)) { + if ((data[0] == FLASH_Intel_code) && ((data[4] == FLASH_28F008SA) || + (data[4] == FLASH_28F008SC))) { num_regions = 16; region_size = 0x40000; flash_info.block_size = region_size; diff --git a/packages/devs/flash/arm/ebsa285/current/src/flash.h b/packages/devs/flash/arm/ebsa285/current/src/flash.h --- a/packages/devs/flash/arm/ebsa285/current/src/flash.h +++ b/packages/devs/flash/arm/ebsa285/current/src/flash.h @@ -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. // ------------------------------------------- // @@ -61,5 +61,5 @@ #define FLASH_Intel_code 0x89 #define FLASH_28F008SA 0xA2 - +#define FLASH_28F008SC 0xA6 #endif // _FLASH_HWR_H_ diff --git a/packages/devs/flash/intel/strata/current/ChangeLog b/packages/devs/flash/intel/strata/current/ChangeLog --- a/packages/devs/flash/intel/strata/current/ChangeLog +++ b/packages/devs/flash/intel/strata/current/ChangeLog @@ -1,3 +1,12 @@ +2001-07-17 Jeroen Dobbelaere + + * src/flash_query.c (flash_query): Query needs to be done on even + addresses for byte-enabled strata flash + + * src/flash_program_buf.c (flash_program_buf): Fix of conversion of + write buffer length (in bytes) to the length in 'flash_t' words. + + 2001-06-22 Hugo Tyson * src/strata.c (flash_hwr_init): Need to refer to the query code diff --git a/packages/devs/flash/intel/strata/current/src/flash_program_buf.c b/packages/devs/flash/intel/strata/current/src/flash_program_buf.c --- a/packages/devs/flash/intel/strata/current/src/flash_program_buf.c +++ b/packages/devs/flash/intel/strata/current/src/flash_program_buf.c @@ -85,7 +85,8 @@ flash_program_buf(volatile flash_t *addr wc = buffer_size; if (wc > len) wc = len; len -= wc; - wc = wc / (CYGNUM_FLASH_DEVICES*2); // Word count + // convert 'wc' in bytes to 'wc' in 'flash_t' + wc = wc / sizeof(flash_t); // Word count *BA = FLASH_Write_Buffer; timeout = 5000000; while(((stat = ROM[0]) & FLASH_Status_Ready) != FLASH_Status_Ready) { diff --git a/packages/devs/flash/intel/strata/current/src/flash_query.c b/packages/devs/flash/intel/strata/current/src/flash_query.c --- a/packages/devs/flash/intel/strata/current/src/flash_query.c +++ b/packages/devs/flash/intel/strata/current/src/flash_query.c @@ -86,6 +86,13 @@ flash_query(unsigned char *data) // It is very deliberate that data is chars NOT flash_t: // The info comes out in bytes regardless of device. *data++ = (unsigned char) (*ROM++); +#ifndef CYGOPT_FLASH_IS_BOOTBLOCK +# if 8 == CYGNUM_FLASH_WIDTH + // strata flash with 'byte-enable' contains the configuration data + // at even addresses + ++ROM; +# endif +#endif } ROM[0] = FLASH_Reset; diff --git a/packages/devs/pcmcia/arm/assabet/current/ChangeLog b/packages/devs/pcmcia/arm/assabet/current/ChangeLog --- a/packages/devs/pcmcia/arm/assabet/current/ChangeLog +++ b/packages/devs/pcmcia/arm/assabet/current/ChangeLog @@ -1,3 +1,9 @@ +2001-07-13 Gary Thomas + + * src/assabet_pcmcia.c (cf_hwr_change_state): Check for VERS_1 + field instead of MANID since some cards don't seem to have that one. + Suggested by I-Jui Sung . + 2000-09-17 Gary Thomas * src/assabet_pcmcia.c: Change interrupt functions to have same diff --git a/packages/devs/pcmcia/arm/assabet/current/src/assabet_pcmcia.c b/packages/devs/pcmcia/arm/assabet/current/src/assabet_pcmcia.c --- a/packages/devs/pcmcia/arm/assabet/current/src/assabet_pcmcia.c +++ b/packages/devs/pcmcia/arm/assabet/current/src/assabet_pcmcia.c @@ -212,7 +212,7 @@ bool cf_hwr_change_state(struct cf_slot *slot, int new_state) { int i, ptr, len; - unsigned char buf[64]; + unsigned char buf[256]; if (new_state == CF_SLOT_STATE_Ready) { if (slot->state == CF_SLOT_STATE_Inserted) { @@ -242,7 +242,7 @@ cf_hwr_change_state(struct cf_slot *slot // Wait until the card is ready to talk for (i = 0; i < 10; i++) { ptr = 0; - if (cf_get_CIS(slot, CF_CISTPL_MANFID, buf, &len, &ptr)) { + if (cf_get_CIS(slot, CF_CISTPL_VERS_1, buf, &len, &ptr)) { slot->state = CF_SLOT_STATE_Ready; break; } diff --git a/packages/devs/pcmcia/arm/ipaq/current/ChangeLog b/packages/devs/pcmcia/arm/ipaq/current/ChangeLog --- a/packages/devs/pcmcia/arm/ipaq/current/ChangeLog +++ b/packages/devs/pcmcia/arm/ipaq/current/ChangeLog @@ -1,3 +1,8 @@ +2001-07-13 Gary Thomas + + * src/ipaq_pcmcia.c (cf_hwr_change_state): Use VERS_1 instead of + MANID since some cards don't seem to support that. + 2001-03-14 Gary Thomas * src/ipaq_pcmcia.c (cf_hwr_init): Leave GPIO/timing setup to HAL code. diff --git a/packages/devs/pcmcia/arm/ipaq/current/src/ipaq_pcmcia.c b/packages/devs/pcmcia/arm/ipaq/current/src/ipaq_pcmcia.c --- a/packages/devs/pcmcia/arm/ipaq/current/src/ipaq_pcmcia.c +++ b/packages/devs/pcmcia/arm/ipaq/current/src/ipaq_pcmcia.c @@ -211,7 +211,7 @@ bool cf_hwr_change_state(struct cf_slot *slot, int new_state) { int i, ptr, len; - unsigned char buf[64]; + unsigned char buf[256]; if (new_state == CF_SLOT_STATE_Ready) { if (slot->state == CF_SLOT_STATE_Inserted) { @@ -227,8 +227,7 @@ cf_hwr_change_state(struct cf_slot *slot // Wait until the card is ready to talk for (i = 0; i < 10; i++) { ptr = 0; - if (cf_get_CIS(slot, CF_CISTPL_MANFID, buf, &len, &ptr)) { - diag_printf("Ready!\n"); + if (cf_get_CIS(slot, CF_CISTPL_VERS_1, buf, &len, &ptr)) { slot->state = CF_SLOT_STATE_Ready; break; } diff --git a/packages/devs/wallclock/dallas/ds12887/current/ChangeLog b/packages/devs/wallclock/dallas/ds12887/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/dallas/ds12887/current/ChangeLog @@ -0,0 +1,32 @@ +2001-07-06 Jesper Skov + + * src/ds12887.cxx (get_ds_hwclock): Instead of locking while + reading (which prevents updates if polled), disable interrupts. + + * New package, based on 1742 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#### + + diff --git a/packages/devs/wallclock/dallas/ds12887/current/cdl/wallclock_ds12887.cdl b/packages/devs/wallclock/dallas/ds12887/current/cdl/wallclock_ds12887.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/dallas/ds12887/current/cdl/wallclock_ds12887.cdl @@ -0,0 +1,96 @@ +# ==================================================================== +# +# wallclock_ds12887.cdl +# +# eCos configuration data for Dallas 12887 +# +# ==================================================================== +#####COPYRIGHTBEGIN#### +# +# ------------------------------------------- +# The contents of this file are subject to the Red Hat eCos Public License +# Version 1.1 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://www.redhat.com/ +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations under +# the License. +# +# The Original Code is eCos - Embedded Configurable Operating System, +# released September 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-07-06 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887 { + parent CYGPKG_IO_WALLCLOCK + active_if CYGPKG_IO_WALLCLOCK + display "Wallclock device driver for Dallas 12887" + description " + This package provides a file with init, get and set functions + for the Dallas 12887 clock part." + + compile ds12887.cxx + + implements CYGINT_WALLCLOCK_HW_IMPLEMENTATIONS + active_if CYGIMP_WALLCLOCK_HARDWARE + implements CYGINT_WALLCLOCK_SET_GET_MODE_SUPPORTED + + cdl_option CYGIMP_WALLCLOCK_HARDWARE { + parent CYGPKG_IO_WALLCLOCK_IMPLEMENTATION + display "Hardware wallclock" + default_value 1 + implements CYGINT_WALLCLOCK_IMPLEMENTATIONS + } + + + cdl_component CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887_OPTIONS { + display "DS12887 wallclock build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the wallclock device. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the wallclock device. These flags are removed from + the set of global flags if present." + } + + } +} diff --git a/packages/devs/wallclock/dallas/ds12887/current/src/ds12887.cxx b/packages/devs/wallclock/dallas/ds12887/current/src/ds12887.cxx new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/dallas/ds12887/current/src/ds12887.cxx @@ -0,0 +1,258 @@ +//========================================================================== +// +// devs/wallclock/ds12887.inl +// +// Wallclock implementation for Dallas 12887 +// +//========================================================================== +//####COPYRIGHTBEGIN#### +// +// ------------------------------------------- +// The contents of this file are subject to the Red Hat eCos Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.redhat.com/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations under +// the License. +// +// The Original Code is eCos - Embedded Configurable Operating System, +// released September 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-07-06 +// Purpose: Wallclock driver for Dallas 12887 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include // Wallclock device config + +#include // IO macros +#include // interrupt enable/disable +#include // Common type definitions and support + +#include // The WallClock API +#include // Helpers + +#include + +#define nDEBUG + +// Platform details +#include CYGDAT_DEVS_WALLCLOCK_DALLAS_12887_INL + +#ifndef DS_READ_UINT8 +# define DS_READ_UINT8(x,y) HAL_READ_UINT8(x,y) +# define DS_WRITE_UINT8(x,y) HAL_WRITE_UINT8(x,y) +#endif + +#ifdef DS_LINEAR +# ifndef DS_STEP +# define DS_STEP 0 +# endif +# ifndef DS_BASE +# error "Need to know base of DS12887 part" +# endif +# define DS_READ(offset, data) DS_READ_UINT8(DS_BASE + ((offset) << DS_STEP), (data)) +# define DS_WRITE(offset, data) DS_WRITE_UINT8(DS_BASE + ((offset) << DS_STEP), (data)) +#else +# if !defined(DS_ADDR) || !defined(DS_DATA) +# error "Need to know addr/data locations of DS12887 part" +# endif +# define DS_READ(offset, data) \ + CYG_MACRO_START \ + DS_WRITE_UINT8(DS_ADDR, (offset)); \ + DS_READ_UINT8(DS_DATA, (data)); \ + CYG_MACRO_END +# define DS_WRITE(offset, data) \ + CYG_MACRO_START \ + DS_WRITE_UINT8(DS_ADDR, (offset)); \ + DS_WRITE_UINT8(DS_DATA, (data)); \ + CYG_MACRO_END +#endif + +// Registers +#define DS_SECONDS 0x00 +#define DS_SECONDS_ALARM 0x01 +#define DS_MINUTES 0x02 +#define DS_MINUTES_ALARM 0x03 +#define DS_HOURS 0x04 +#define DS_HOURS_ALARM 0x05 +#define DS_DOW 0x06 +#define DS_DOM 0x07 +#define DS_MONTH 0x08 +#define DS_YEAR 0x09 +#define DS_CENTURY 0x32 + +#define DS_REG_A 0x0a +#define DS_REG_B 0x0b +#define DS_REG_C 0x0c +#define DS_REG_D 0x0d + +// Control bits +#define DS_REG_A_UIP 0x80 +#define DS_REG_A_ENABLE 0x20 + +#define DS_REG_B_SET 0x80 +#define DS_REG_B_DM 0x04 +#define DS_REG_B_24H 0x02 + + +//---------------------------------------------------------------------------- +// Accessor functions +static inline void +init_ds_hwclock(void) +{ + // Set binary and 24H mode + DS_WRITE(DS_REG_B, DS_REG_B_DM | DS_REG_B_24H); + // Enable clock + DS_WRITE(DS_REG_A, DS_REG_A_ENABLE); +} + + +static inline void +set_ds_hwclock(cyg_uint32 year, cyg_uint32 month, cyg_uint32 mday, + cyg_uint32 hour, cyg_uint32 minute, cyg_uint32 second) +{ + cyg_uint8 _regb; + // Stop counting + DS_READ(DS_REG_B, _regb); + _regb |= DS_REG_B_SET; + DS_WRITE(DS_REG_B, _regb); + + DS_WRITE(DS_CENTURY, (cyg_uint8)(year / 100)); + DS_WRITE(DS_YEAR, (cyg_uint8)(year % 100)); + DS_WRITE(DS_MONTH, (cyg_uint8)month); + DS_WRITE(DS_DOM, (cyg_uint8)mday); + DS_WRITE(DS_HOURS, (cyg_uint8)hour); + DS_WRITE(DS_MINUTES, (cyg_uint8)minute); + DS_WRITE(DS_SECONDS, (cyg_uint8)second); + + // Restart counting + _regb &= ~DS_REG_B_SET; + DS_WRITE(DS_REG_B, _regb); + +#ifdef DEBUG + // This will cause the test to eventually fail due to these printouts + // causing timer interrupts to be lost... + diag_printf("Set -------------\n"); + diag_printf("year %02d\n", year); + diag_printf("month %02d\n", month); + diag_printf("mday %02d\n", mday); + diag_printf("hour %02d\n", hour); + diag_printf("minute %02d\n", minute); + diag_printf("second %02d\n", second); +#endif +} + +static inline void +get_ds_hwclock(cyg_uint32* year, cyg_uint32* month, cyg_uint32* mday, + cyg_uint32* hour, cyg_uint32* minute, cyg_uint32* second) +{ + cyg_uint8 _reg, _t1, _t2; + cyg_uint32 _old; + + // Wait for update flag clears + do { + DS_READ(DS_REG_A, _reg); + } while (_reg & DS_REG_A_UIP); + + // Disable interrupts while reading to ensure it doesn't take more + // than 244us. + HAL_DISABLE_INTERRUPTS(_old); + + DS_READ(DS_CENTURY, _t1); + DS_READ(DS_YEAR, _t2); + *year = (cyg_uint32)_t1*100 + (cyg_uint32)_t2; + + DS_READ(DS_MONTH, _t1); + *month = (cyg_uint32)_t1; + + DS_READ(DS_DOM, _t1); + *mday = (cyg_uint32)_t1; + + DS_READ(DS_HOURS, _t1); + *hour = (cyg_uint32)_t1; + + DS_READ(DS_MINUTES, _t1); + *minute = (cyg_uint32)_t1; + + DS_READ(DS_SECONDS, _t1); + *second = (cyg_uint32)_t1; + + // Reenable interrupts + HAL_RESTORE_INTERRUPTS(_old); + +#ifdef DEBUG + // This will cause the test to eventually fail due to these printouts + // causing timer interrupts to be lost... + diag_printf("year %02d\n", *year); + diag_printf("month %02d\n", *month); + diag_printf("mday %02d\n", *mday); + diag_printf("hour %02d\n", *hour); + diag_printf("minute %02d\n", *minute); + diag_printf("second %02d\n", *second); +#endif +} + +//----------------------------------------------------------------------------- +// Functions required for the hardware-driver API. + +// Returns the number of seconds elapsed since 1970-01-01 00:00:00. +cyg_uint32 +Cyg_WallClock::get_hw_seconds(void) +{ + cyg_uint32 year, month, mday, hour, minute, second; + + get_ds_hwclock(&year, &month, &mday, &hour, &minute, &second); + + cyg_uint32 now = _simple_mktime(year, month, mday, hour, minute, second); + return now; +} + +#ifdef CYGSEM_WALLCLOCK_SET_GET_MODE + +// Sets the clock. Argument is seconds elapsed since 1970-01-01 00:00:00. +void +Cyg_WallClock::set_hw_seconds( cyg_uint32 secs ) +{ + cyg_uint32 year, month, mday, hour, minute, second; + + _simple_mkdate(secs, &year, &month, &mday, &hour, &minute, &second); + + set_ds_hwclock(year, month, mday, hour, minute, second); +} + +#endif + +void +Cyg_WallClock::init_hw_seconds(void) +{ +#ifdef CYGSEM_WALLCLOCK_SET_GET_MODE + init_ds_hwclock(); +#else + // This is our base: 1970-01-01 00:00:00 + // Set the HW clock - if for nothing else, just to be sure it's in a + // legal range. Any arbitrary base could be used. + // After this the hardware clock is only read. + set_ds_hwclock(1970,1,1,0,0,0); +#endif +} + +//----------------------------------------------------------------------------- +// End of devs/wallclock/ds12887.inl diff --git a/packages/devs/wallclock/sh/sh3/current/ChangeLog b/packages/devs/wallclock/sh/sh3/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/sh/sh3/current/ChangeLog @@ -0,0 +1,74 @@ +2001-07-09 Jesper Skov + + * src/wallclock_sh3.cxx: fix description. + +2001-03-20 Jesper Skov + + * src/wallclock_sh3.cxx: Don't include kernel config. + +2000-05-26 Jesper Skov + + * cdl/wallclock_sh3.cdl: CYGSEM_WALLCLOCK_SET_GET_MODE moved to IO + package. + + * src/wallclock_sh3.cxx: Get helpers from new file. + +2000-04-06 Jesper Skov + + * cdl/wallclock_sh3.cdl: Only active when wallclock is. + +2000-04-05 John Dallaway + + * cdl/wallclock_sh3.cdl: + + Provide hardware wallclock implementation as a radio button. + +2000-04-05 Jesper Skov + + * src/wallclock_sh3.cxx: + Moved from devs/wallclock/current to here. + Get API from io/wallclock. + Deleted all non-SH3 changelog entries + +2000-03-29 Jesper Skov + + * tests/wallclock2.cxx: + * include/wallclock.hxx: + * src/sh3.cxx: + * src/wallclock.cxx: + * cdl/wallclock.cdl: + Reworked WallClock API. It should now be simpler to add new + wallclock drivers. Added a simple test to print out the current + wallclock value so a human can verify battery backup works. + +2000-03-17 Jesper Skov + + * cdl/wallclock.cdl: + * src/sh3.cxx: + Added wallclock driver for SH3 RTC module. + +//####COPYRIGHTBEGIN#### +// +// ------------------------------------------- +// The contents of this file are subject to the Red Hat eCos Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.redhat.com/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations under +// the License. +// +// The Original Code is eCos - Embedded Configurable Operating System, +// released September 30, 1998. +// +// The Initial Developer of the Original Code is Red Hat. +// Portions created by Red Hat are +// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +// All Rights Reserved. +// ------------------------------------------- +// +//####COPYRIGHTEND#### + + diff --git a/packages/devs/wallclock/sh/sh3/current/cdl/wallclock_sh3.cdl b/packages/devs/wallclock/sh/sh3/current/cdl/wallclock_sh3.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/sh/sh3/current/cdl/wallclock_sh3.cdl @@ -0,0 +1,92 @@ +# ==================================================================== +# +# wallclock_sh3.cdl +# +# eCos wallclock SH3 RTC-module driver 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): jskov +# Original data: nickg +# Contributors: +# Date: 2000-04-05 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVICES_WALLCLOCK_SH3 { + parent CYGPKG_IO_WALLCLOCK + active_if CYGPKG_IO_WALLCLOCK + display "SH3 RTC-module wallclock driver" + requires CYGPKG_HAL_SH + hardware + compile wallclock_sh3.cxx + implements CYGINT_WALLCLOCK_HW_IMPLEMENTATIONS + active_if CYGIMP_WALLCLOCK_HARDWARE + + cdl_option CYGIMP_WALLCLOCK_HARDWARE { + parent CYGPKG_IO_WALLCLOCK_IMPLEMENTATION + display "Hardware wallclock" + default_value 1 + implements CYGINT_WALLCLOCK_IMPLEMENTATIONS + } + + cdl_component CYGPKG_DEVICES_WALLCLOCK_SH3_OPTIONS { + display "SH3 RTC-module wallclock build options" + flavor none + description " + Package specific build options including control over + compiler flags used only in building this package, + and details of which tests are built." + + + cdl_option CYGPKG_DEVICES_WALLCLOCK_SH3_CFLAGS_ADD { + display "Additional compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the wallclock device. These flags are used in addition + to the set of global flags." + } + + cdl_option CYGPKG_DEVICES_WALLCLOCK_SH3_CFLAGS_REMOVE { + display "Suppressed compiler flags" + flavor data + no_define + default_value { "" } + description " + This option modifies the set of compiler flags for + building the wallclock device. These flags are removed from + the set of global flags if present." + } + + } +} diff --git a/packages/devs/wallclock/sh/sh3/current/src/wallclock_sh3.cxx b/packages/devs/wallclock/sh/sh3/current/src/wallclock_sh3.cxx new file mode 100644 --- /dev/null +++ b/packages/devs/wallclock/sh/sh3/current/src/wallclock_sh3.cxx @@ -0,0 +1,166 @@ +//========================================================================== +// +// devs/wallclock/sh3.cxx +// +// SH3 RTC module driver. +// +//========================================================================== +//####COPYRIGHTBEGIN#### +// +// ------------------------------------------- +// The contents of this file are subject to the Red Hat eCos Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.redhat.com/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations under +// the License. +// +// The Original Code is eCos - Embedded Configurable Operating System, +// released September 30, 1998. +// +// The Initial Developer of the Original Code is Red Hat. +// Portions created by Red Hat are +// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +// All Rights Reserved. +// ------------------------------------------- +// +//####COPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors: jskov +// Date: 2000-03-17 +// Purpose: Wallclock driver for SH3 CPU RTC module +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include // Wallclock device config + +#include // IO macros +#include // Common type definitions and support + +#include // The WallClock API +#include // Helpers + +#include // RTC register definitions + +#include // For debugging + + + +//----------------------------------------------------------------------------- +// Functions for setting and getting the hardware clock counters + +// Year must be last two digits of "western calendar year". Leap year when +// divisible by four. +static void +set_sh3_hwclock(cyg_uint32 year, cyg_uint32 month, cyg_uint32 mday, + cyg_uint32 hour, cyg_uint32 minute, cyg_uint32 second) +{ + // Stop RTC + HAL_WRITE_UINT8(CYGARC_REG_RCR2, CYGARC_REG_RCR2_RESET); + + // Program it + HAL_WRITE_UINT8(CYGARC_REG_RYRCNT, TO_BCD(year)); + HAL_WRITE_UINT8(CYGARC_REG_RMONCNT, TO_BCD(month)); + HAL_WRITE_UINT8(CYGARC_REG_RDAYCNT, TO_BCD(mday)); + HAL_WRITE_UINT8(CYGARC_REG_RHRCNT, TO_BCD(hour)); + HAL_WRITE_UINT8(CYGARC_REG_RMINCNT, TO_BCD(minute)); + HAL_WRITE_UINT8(CYGARC_REG_RSECCNT, TO_BCD(second)); + + // Start RTC + HAL_WRITE_UINT8(CYGARC_REG_RCR1, CYGARC_REG_RCR1_CIE); + HAL_WRITE_UINT8(CYGARC_REG_RCR2, + CYGARC_REG_RCR2_RTCEN | CYGARC_REG_RCR2_START); + +} + +static void +get_sh3_hwclock(cyg_uint32* year, cyg_uint32* month, cyg_uint32* mday, + cyg_uint32* hour, cyg_uint32* minute, cyg_uint32* second) +{ + cyg_uint8 tmp; + + do { + // Clear carry flag + HAL_WRITE_UINT8(CYGARC_REG_RCR1, 0); + + // Read time + HAL_READ_UINT8(CYGARC_REG_RYRCNT, tmp); + *year = TO_DEC(tmp); + HAL_READ_UINT8(CYGARC_REG_RMONCNT, tmp); + *month = TO_DEC(tmp); + HAL_READ_UINT8(CYGARC_REG_RDAYCNT, tmp); + *mday = TO_DEC(tmp); + HAL_READ_UINT8(CYGARC_REG_RHRCNT, tmp); + *hour = TO_DEC(tmp); + HAL_READ_UINT8(CYGARC_REG_RMINCNT, tmp); + *minute = TO_DEC(tmp); + HAL_READ_UINT8(CYGARC_REG_RSECCNT, tmp); + *second = TO_DEC(tmp); + + // Read carry flag + HAL_READ_UINT8(CYGARC_REG_RCR1, tmp); + } while (CYGARC_REG_RCR1_CF & tmp); // loop if carry set +} + +//----------------------------------------------------------------------------- +// Functions required for the hardware-driver API. + +// Returns the number of seconds elapsed since 1970-01-01 00:00:00. +cyg_uint32 +Cyg_WallClock::get_hw_seconds(void) +{ + cyg_uint32 year, month, mday, hour, minute, second; + + get_sh3_hwclock(&year, &month, &mday, &hour, &minute, &second); + +#if 0 + // This will cause the test to eventually fail due to these printouts + // causing timer interrupts to be lost... + diag_printf("year %02d\n", year); + diag_printf("month %02d\n", month); + diag_printf("mday %02d\n", mday); + diag_printf("hour %02d\n", hour); + diag_printf("minute %02d\n", minute); + diag_printf("second %02d\n", second); +#endif + +#ifndef CYGSEM_WALLCLOCK_SET_GET_MODE + // We know what we initialized the hardware for : 1970, so by doing this + // the returned time should be OK for 30 years uptime. + year += 1900; +#else + // Need to use sliding window or similar to figure out what the + // century should be... Patent issue is unclear, and since there's + // no battery backup of the clock, there's little point in + // investigating. +# error "Need some magic here to figure out century counter" +#endif + + cyg_uint32 now = _simple_mktime(year, month, mday, hour, minute, second); + return now; +} + +#ifndef CYGSEM_WALLCLOCK_SET_GET_MODE + +void +Cyg_WallClock::init_hw_seconds(void) +{ + // This is our base: 1970-01-01 00:00:00 + // Set the HW clock - if for nothing else, just to be sure it's in a + // legal range. Any arbitrary base could be used. + // After this the hardware clock is only read. + set_sh3_hwclock(70,1,1,0,0,0); +} + +#endif // CYGSEM_WALLCLOCK_SET_GET_MODE + +//----------------------------------------------------------------------------- +// End of devs/wallclock/sh3.cxx diff --git a/packages/devs/wallclock/sh3/current/ChangeLog b/packages/devs/wallclock/sh3/current/ChangeLog deleted file mode 100644 --- a/packages/devs/wallclock/sh3/current/ChangeLog +++ /dev/null @@ -1,70 +0,0 @@ -2001-03-20 Jesper Skov - - * src/wallclock_sh3.cxx: Don't include kernel config. - -2000-05-26 Jesper Skov - - * cdl/wallclock_sh3.cdl: CYGSEM_WALLCLOCK_SET_GET_MODE moved to IO - package. - - * src/wallclock_sh3.cxx: Get helpers from new file. - -2000-04-06 Jesper Skov - - * cdl/wallclock_sh3.cdl: Only active when wallclock is. - -2000-04-05 John Dallaway - - * cdl/wallclock_sh3.cdl: - - Provide hardware wallclock implementation as a radio button. - -2000-04-05 Jesper Skov - - * src/wallclock_sh3.cxx: - Moved from devs/wallclock/current to here. - Get API from io/wallclock. - Deleted all non-SH3 changelog entries - -2000-03-29 Jesper Skov - - * tests/wallclock2.cxx: - * include/wallclock.hxx: - * src/sh3.cxx: - * src/wallclock.cxx: - * cdl/wallclock.cdl: - Reworked WallClock API. It should now be simpler to add new - wallclock drivers. Added a simple test to print out the current - wallclock value so a human can verify battery backup works. - -2000-03-17 Jesper Skov - - * cdl/wallclock.cdl: - * src/sh3.cxx: - Added wallclock driver for SH3 RTC module. - -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### - - diff --git a/packages/devs/wallclock/sh3/current/cdl/wallclock_sh3.cdl b/packages/devs/wallclock/sh3/current/cdl/wallclock_sh3.cdl deleted file mode 100644 --- a/packages/devs/wallclock/sh3/current/cdl/wallclock_sh3.cdl +++ /dev/null @@ -1,92 +0,0 @@ -# ==================================================================== -# -# wallclock_sh3.cdl -# -# eCos wallclock SH3 RTC-module driver 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): jskov -# Original data: nickg -# Contributors: -# Date: 2000-04-05 -# -#####DESCRIPTIONEND#### -# -# ==================================================================== - -cdl_package CYGPKG_DEVICES_WALLCLOCK_SH3 { - parent CYGPKG_IO_WALLCLOCK - active_if CYGPKG_IO_WALLCLOCK - display "SH3 RTC-module wallclock driver" - requires CYGPKG_HAL_SH - hardware - compile wallclock_sh3.cxx - implements CYGINT_WALLCLOCK_HW_IMPLEMENTATIONS - active_if CYGIMP_WALLCLOCK_HARDWARE - - cdl_option CYGIMP_WALLCLOCK_HARDWARE { - parent CYGPKG_IO_WALLCLOCK_IMPLEMENTATION - display "Hardware wallclock" - default_value 1 - implements CYGINT_WALLCLOCK_IMPLEMENTATIONS - } - - cdl_component CYGPKG_DEVICES_WALLCLOCK_SH3_OPTIONS { - display "SH3 RTC-module wallclock build options" - flavor none - description " - Package specific build options including control over - compiler flags used only in building this package, - and details of which tests are built." - - - cdl_option CYGPKG_DEVICES_WALLCLOCK_SH3_CFLAGS_ADD { - display "Additional compiler flags" - flavor data - no_define - default_value { "" } - description " - This option modifies the set of compiler flags for - building the wallclock device. These flags are used in addition - to the set of global flags." - } - - cdl_option CYGPKG_DEVICES_WALLCLOCK_SH3_CFLAGS_REMOVE { - display "Suppressed compiler flags" - flavor data - no_define - default_value { "" } - description " - This option modifies the set of compiler flags for - building the wallclock device. These flags are removed from - the set of global flags if present." - } - - } -} diff --git a/packages/devs/wallclock/sh3/current/src/wallclock_sh3.cxx b/packages/devs/wallclock/sh3/current/src/wallclock_sh3.cxx deleted file mode 100644 --- a/packages/devs/wallclock/sh3/current/src/wallclock_sh3.cxx +++ /dev/null @@ -1,166 +0,0 @@ -//========================================================================== -// -// devs/wallclock/sh3.cxx -// -// Wallclock emulation implementation -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): jskov -// Contributors: jskov -// Date: 2000-03-17 -// Purpose: Wallclock driver for SH3 CPU RTC module -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include // Wallclock device config - -#include // IO macros -#include // Common type definitions and support - -#include // The WallClock API -#include // Helpers - -#include // RTC register definitions - -#include // For debugging - - - -//----------------------------------------------------------------------------- -// Functions for setting and getting the hardware clock counters - -// Year must be last two digits of "western calendar year". Leap year when -// divisible by four. -static void -set_sh3_hwclock(cyg_uint32 year, cyg_uint32 month, cyg_uint32 mday, - cyg_uint32 hour, cyg_uint32 minute, cyg_uint32 second) -{ - // Stop RTC - HAL_WRITE_UINT8(CYGARC_REG_RCR2, CYGARC_REG_RCR2_RESET); - - // Program it - HAL_WRITE_UINT8(CYGARC_REG_RYRCNT, TO_BCD(year)); - HAL_WRITE_UINT8(CYGARC_REG_RMONCNT, TO_BCD(month)); - HAL_WRITE_UINT8(CYGARC_REG_RDAYCNT, TO_BCD(mday)); - HAL_WRITE_UINT8(CYGARC_REG_RHRCNT, TO_BCD(hour)); - HAL_WRITE_UINT8(CYGARC_REG_RMINCNT, TO_BCD(minute)); - HAL_WRITE_UINT8(CYGARC_REG_RSECCNT, TO_BCD(second)); - - // Start RTC - HAL_WRITE_UINT8(CYGARC_REG_RCR1, CYGARC_REG_RCR1_CIE); - HAL_WRITE_UINT8(CYGARC_REG_RCR2, - CYGARC_REG_RCR2_RTCEN | CYGARC_REG_RCR2_START); - -} - -static void -get_sh3_hwclock(cyg_uint32* year, cyg_uint32* month, cyg_uint32* mday, - cyg_uint32* hour, cyg_uint32* minute, cyg_uint32* second) -{ - cyg_uint8 tmp; - - do { - // Clear carry flag - HAL_WRITE_UINT8(CYGARC_REG_RCR1, 0); - - // Read time - HAL_READ_UINT8(CYGARC_REG_RYRCNT, tmp); - *year = TO_DEC(tmp); - HAL_READ_UINT8(CYGARC_REG_RMONCNT, tmp); - *month = TO_DEC(tmp); - HAL_READ_UINT8(CYGARC_REG_RDAYCNT, tmp); - *mday = TO_DEC(tmp); - HAL_READ_UINT8(CYGARC_REG_RHRCNT, tmp); - *hour = TO_DEC(tmp); - HAL_READ_UINT8(CYGARC_REG_RMINCNT, tmp); - *minute = TO_DEC(tmp); - HAL_READ_UINT8(CYGARC_REG_RSECCNT, tmp); - *second = TO_DEC(tmp); - - // Read carry flag - HAL_READ_UINT8(CYGARC_REG_RCR1, tmp); - } while (CYGARC_REG_RCR1_CF & tmp); // loop if carry set -} - -//----------------------------------------------------------------------------- -// Functions required for the hardware-driver API. - -// Returns the number of seconds elapsed since 1970-01-01 00:00:00. -cyg_uint32 -Cyg_WallClock::get_hw_seconds(void) -{ - cyg_uint32 year, month, mday, hour, minute, second; - - get_sh3_hwclock(&year, &month, &mday, &hour, &minute, &second); - -#if 0 - // This will cause the test to eventually fail due to these printouts - // causing timer interrupts to be lost... - diag_printf("year %02d\n", year); - diag_printf("month %02d\n", month); - diag_printf("mday %02d\n", mday); - diag_printf("hour %02d\n", hour); - diag_printf("minute %02d\n", minute); - diag_printf("second %02d\n", second); -#endif - -#ifndef CYGSEM_WALLCLOCK_SET_GET_MODE - // We know what we initialized the hardware for : 1970, so by doing this - // the returned time should be OK for 30 years uptime. - year += 1900; -#else - // Need to use sliding window or similar to figure out what the - // century should be... Patent issue is unclear, and since there's - // no battery backup of the clock, there's little point in - // investigating. -# error "Need some magic here to figure out century counter" -#endif - - cyg_uint32 now = _simple_mktime(year, month, mday, hour, minute, second); - return now; -} - -#ifndef CYGSEM_WALLCLOCK_SET_GET_MODE - -void -Cyg_WallClock::init_hw_seconds(void) -{ - // This is our base: 1970-01-01 00:00:00 - // Set the HW clock - if for nothing else, just to be sure it's in a - // legal range. Any arbitrary base could be used. - // After this the hardware clock is only read. - set_sh3_hwclock(70,1,1,0,0,0); -} - -#endif // CYGSEM_WALLCLOCK_SET_GET_MODE - -//----------------------------------------------------------------------------- -// End of devs/wallclock/sh3.cxx diff --git a/packages/ecos.db b/packages/ecos.db --- a/packages/ecos.db +++ b/packages/ecos.db @@ -597,6 +597,7 @@ package CYGPKG_DEVS_USB_SA11X0 { description "A device driver for the SA11X0 on-chip USB slave port" } + package CYGPKG_NET { alias { "Networking" net } directory net/tcpip @@ -734,7 +735,7 @@ package CYGPKG_IO_WALLCLOCK { package CYGPKG_DEVICES_WALLCLOCK_SH3 { alias { "Wallclock driver for SH3 RTC module" devices_wallclock_sh3 device_wallclock_sh3 } - directory devs/wallclock/sh3 + directory devs/wallclock/sh/sh3 script wallclock_sh3.cdl hardware description " @@ -752,6 +753,16 @@ package CYGPKG_DEVICES_WALLCLOCK_DALLAS_ the Dallas 1742 wallclock." } +package CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS12887 { + alias { "Wallclock driver for Dallas 12887" devices_wallclock_ds12887 device_wallclock_ds12887 } + directory devs/wallclock/dallas/ds12887 + script wallclock_ds12887.cdl + hardware + description " + This package provides a driver implementation for + the Dallas 12887 wallclock." +} + package CYGPKG_DEVICES_WALLCLOCK_MIPS_REF4955 { alias { "Wallclock driver for REF4955 board" devices_wallclock_ref4955 device_wallclock_ref4955 } directory devs/wallclock/mips/ref4955 @@ -761,7 +772,6 @@ package CYGPKG_DEVICES_WALLCLOCK_MIPS_RE This package provides a wallclock driver implementation for the Toshiba REF4955 board." } - package CYGPKG_DEVICES_WATCHDOG_ARM_AEB { alias { "Watchdog driver for ARM/AEB board" devices_watchdog_aeb device_watchdog_aeb } directory devs/watchdog/arm/aeb @@ -850,6 +860,7 @@ package CYGPKG_COMPRESS_ZLIB { This package provides zlib compression and decompression support." } + package CYGPKG_UITRON { alias { "uITRON compatibility" uitron } directory compat/uitron diff --git a/packages/fs/rom/current/ChangeLog b/packages/fs/rom/current/ChangeLog --- a/packages/fs/rom/current/ChangeLog +++ b/packages/fs/rom/current/ChangeLog @@ -1,3 +1,8 @@ +2001-07-13 Richard Panton (richard.panton@3glab.com) + + * support/mk_romfs.c: Convert between host FS file modes and eCos + ones. + 2000-10-25 Richard Panton (richard.panton@3glab.com) * cdl/romfs.cdl: diff --git a/packages/fs/rom/current/support/mk_romfs.c b/packages/fs/rom/current/support/mk_romfs.c --- a/packages/fs/rom/current/support/mk_romfs.c +++ b/packages/fs/rom/current/support/mk_romfs.c @@ -53,6 +53,7 @@ #include #include #include +#include //========================================================================== // @@ -148,7 +149,7 @@ typedef struct romfs_disk { typedef struct node { const char *path; // Filename (inc. path) of a link to this node size_t size; // Size of file/directory/link - mode_t mode; // Type and permissions + mode_t st_mode; // Type and permissions uid_t uid; // Owner id gid_t gid; // Group id time_t ctime; // File creation time @@ -249,6 +250,28 @@ static void outputshort( unsigned char * } } +static unsigned long ConvertMode( unsigned long posix_mode ) { + unsigned long result = 0; + if ( S_ISDIR( posix_mode ) ) result |= 1<<0; + if ( S_ISCHR( posix_mode ) ) result |= 1<<1; + if ( S_ISBLK( posix_mode ) ) result |= 1<<2; + if ( S_ISREG( posix_mode ) ) result |= 1<<3; + if ( S_ISFIFO(posix_mode ) ) result |= 1<<4; + // We cannot create MQ, SEM, or SHM entries here + if ( posix_mode & S_IRUSR ) result |= 1<<8; + if ( posix_mode & S_IWUSR ) result |= 1<<9; + if ( posix_mode & S_IXUSR ) result |= 1<<10; + if ( posix_mode & S_IRGRP ) result |= 1<<11; + if ( posix_mode & S_IWGRP ) result |= 1<<12; + if ( posix_mode & S_IXGRP ) result |= 1<<13; + if ( posix_mode & S_IROTH ) result |= 1<<14; + if ( posix_mode & S_IWOTH ) result |= 1<<15; + if ( posix_mode & S_IXOTH ) result |= 1<<16; + if ( posix_mode & S_ISUID ) result |= 1<<17; + if ( posix_mode & S_ISGID ) result |= 1<<18; + return result; +} + static const char *AddDirEntry( const char *name, node *parent_node, int node_num ) { int this_size = ((strlen(name) + 4 + 4 + 1) + 31) & ~31; int start = parent_node->size; @@ -313,7 +336,7 @@ static node * GetNodeInfo( const char *p node->path = strdup( newpath ); // We re-calculate the size for directories node->size = IS_DIRECTORY( stbuff.st_mode ) ? 0 : stbuff.st_size; - node->mode = stbuff.st_mode; + node->st_mode = stbuff.st_mode; node->uid = stbuff.st_uid; node->gid = stbuff.st_gid; node->ctime = stbuff.st_ctime; @@ -374,7 +397,7 @@ static void ScanDirectory(node *mynode, verb_printf(VERB_EXCESSIVE,"Completed '%s'. Checking for child directories...\n", mynode->path); for ( th = mynode->child ; th ; th = th->sibling ) { - if ( IS_DIRECTORY( th->mode ) ) { + if ( IS_DIRECTORY( th->st_mode ) ) { mynode->nlink++; ScanDirectory( th, mynode->nodenum ); } @@ -385,7 +408,7 @@ static void AllocateSpaceToDirectories( node *np; for ( np = first ; np ; np = np->sibling ) { - if ( IS_DIRECTORY( np->mode ) ) { + if ( IS_DIRECTORY( np->st_mode ) ) { // The first node is a directory. Add its data np->offset = coffset; np->entry_size = ALIGN_TO( np->size, DIRECTORY_ALIGN ); @@ -403,7 +426,7 @@ static void AllocateSpaceToDirectories( // Now add any child directories for ( np = first ; np ; np = np->sibling ) { - if ( IS_DIRECTORY( np->mode ) && np->child ) + if ( IS_DIRECTORY( np->st_mode ) && np->child ) AllocateSpaceToDirectories( np->child ); } } @@ -417,7 +440,7 @@ static void AllocateSpaceToDataFiles( no // Search for child data files for ( np = first->child ; np ; np = np->sibling ) { - if ( IS_DATAFILE( np->mode ) || IS_SYMLINK( np->mode ) ) { + if ( IS_DATAFILE( np->st_mode ) || IS_SYMLINK( np->st_mode ) ) { np->offset = coffset; np->entry_size = ALIGN_TO( np->size, DATA_ALIGN ); coffset += np->entry_size; @@ -433,7 +456,7 @@ static void AllocateSpaceToDataFiles( no // Recurse into sub-directories for ( np = first->child ; np ; np = np->sibling ) { - if ( IS_DIRECTORY( np->mode ) ) { + if ( IS_DIRECTORY( np->st_mode ) ) { AllocateSpaceToDataFiles( np ); } } @@ -446,7 +469,7 @@ static void AllocateSpaceToExecutables( // Search for child executables for ( np = first->child ; np ; np = np->sibling ) { - if ( IS_EXECUTABLE( np->mode ) ) { + if ( IS_EXECUTABLE( np->st_mode ) ) { np->offset = coffset; np->entry_size = ALIGN_TO( np->size, EXEC_ALIGN ); coffset += np->entry_size; @@ -462,7 +485,7 @@ static void AllocateSpaceToExecutables( // Recurse into sub-directories for ( np = first->child ; np ; np = np->sibling ) { - if ( IS_DIRECTORY( np->mode ) ) { + if ( IS_DIRECTORY( np->st_mode ) ) { AllocateSpaceToExecutables( np ); } } @@ -471,7 +494,7 @@ static void AllocateSpaceToExecutables( static void WriteNode( int fd, node *np ) { romfs_node anode; char padhere[9]; - outputlong( (char*) &anode.mode, np->mode ); + outputlong( (char*) &anode.mode, ConvertMode( np->st_mode ) ); outputlong( (char*) &anode.nlink, np->nlink ); outputshort((char*) &anode.uid, np->uid ); outputshort((char*) &anode.gid, np->gid ); @@ -495,7 +518,7 @@ static int WriteNodeAndSiblings( int fd, } for ( np = first ; np ; np = np->sibling ) { - if ( IS_DIRECTORY( np->mode ) && np->child ) { + if ( IS_DIRECTORY( np->st_mode ) && np->child ) { nodenum = WriteNodeAndSiblings( fd, nodenum, np->child ); } } @@ -524,7 +547,7 @@ static void WriteData( int fd, node *np int ffd; unsigned long todo; - if ( IS_SYMLINK( np->mode ) ) { + if ( IS_SYMLINK( np->st_mode ) ) { if ( (ffd = readlink( np->path, newpath, sizeof(newpath) )) < 0 ) fatal_error(EXIT_FILESYS, "Error reading symlink \"%s\": %s\n", np->path, strerror(errno) ); @@ -569,7 +592,7 @@ static void WriteDataBlocks( int fd, nod for ( ; first ; first = first->next_in_rom ) { if ( dowrite && lseek( fd, first->offset, SEEK_SET ) != first->offset ) fatal_error(EXIT_SEEK, "Error seeking to offset 0x%lX: %s\n", first->offset, strerror(errno) ); - if ( IS_DIRECTORY( first->mode ) ) { + if ( IS_DIRECTORY( first->st_mode ) ) { if ( dowrite && write( fd, first->entry, first->size ) != first->size ) fatal_error(EXIT_WRITE, "Write error: %s\n", strerror(errno) ); } else { diff --git a/packages/hal/arm/arch/current/ChangeLog b/packages/hal/arm/arch/current/ChangeLog --- a/packages/hal/arm/arch/current/ChangeLog +++ b/packages/hal/arm/arch/current/ChangeLog @@ -1,3 +1,12 @@ +2001-07-17 Jonathan Larmour + + * include/hal_intr.h: Define range of exceptions more accurately. + +2001-07-16 Gary Thomas + + * src/hal_misc.c (exception_handler): Allow memory faults to be + caught, even when GDB stubs are not included. + 2001-06-22 Gary Thomas * include/arm_stub.h (NUMREGBYTES): Define - this tells GDB how diff --git a/packages/hal/arm/arch/current/include/hal_intr.h b/packages/hal/arm/arch/current/include/hal_intr.h --- a/packages/hal/arm/arch/current/include/hal_intr.h +++ b/packages/hal/arm/arch/current/include/hal_intr.h @@ -98,10 +98,9 @@ CYGNUM_HAL_VECTOR_SOFTWARE_INTERRUPT #define CYGNUM_HAL_EXCEPTION_CODE_ACCESS CYGNUM_HAL_VECTOR_ABORT_PREFETCH #define CYGNUM_HAL_EXCEPTION_DATA_ACCESS CYGNUM_HAL_VECTOR_ABORT_DATA -#define CYGNUM_HAL_EXCEPTION_FIQ CYGNUM_HAL_VECTOR_FIQ #define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION -#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_FIQ +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_EXCEPTION_DATA_ACCESS #define CYGNUM_HAL_EXCEPTION_COUNT (CYGNUM_HAL_EXCEPTION_MAX - \ CYGNUM_HAL_EXCEPTION_MIN + 1) diff --git a/packages/hal/arm/arch/current/src/hal_misc.c b/packages/hal/arm/arch/current/src/hal_misc.c --- a/packages/hal/arm/arch/current/src/hal_misc.c +++ b/packages/hal/arm/arch/current/src/hal_misc.c @@ -66,7 +66,11 @@ externC void diag_printf(const char *fmt externC void __handle_exception (void); externC HAL_SavedRegisters *_hal_registers; -externC void* volatile __mem_fault_handler; +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +// Historical - this datum is defined by the GDB stubs if present +externC +#endif + void* volatile __mem_fault_handler; #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS /* Force exception handling into the GDB stubs. This is done by taking over @@ -108,13 +112,18 @@ static void void exception_handler(HAL_SavedRegisters *regs) { -#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && !defined(CYGPKG_CYGMON) + // Special case handler for code which has chosen to take care + // of data exceptions (i.e. code which expects them to happen) + // This is common in discovery code, e.g. checking for a particular + // device which may generate an exception when probing if the + // device is not present if (__mem_fault_handler && regs->vector == CYGNUM_HAL_EXCEPTION_DATA_ACCESS) { regs->pc = (unsigned long)__mem_fault_handler; return; // Caught an exception inside stubs } +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && !defined(CYGPKG_CYGMON) if (++exception_level == 1) __take_over_debug_traps(); _hal_registers = regs; @@ -165,7 +174,6 @@ extern pfunc __CTOR_END__[]; void cyg_hal_invoke_constructors (void) { - #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG static pfunc *p = &__CTOR_END__[-1]; diff --git a/packages/hal/i386/arch/current/ChangeLog b/packages/hal/i386/arch/current/ChangeLog --- a/packages/hal/i386/arch/current/ChangeLog +++ b/packages/hal/i386/arch/current/ChangeLog @@ -1,3 +1,13 @@ +2001-07-13 Nick Garnett + + * include/arch.inc: + Added code to clear CR0:TS bit in hal_fpu_init macro. If this bit + is not clear, then the following finit might trap, and we don't + want that. + Added a compare to hal_fpu_push_exc macro for a zero fpu state + owner. The code was assuming the move set the condition codes, + which it doesn't. + 2001-07-08 Jonathan Larmour * include/hal_arch.h (HAL_THREAD_INIT_FPU_CONTEXT): Fix indirection to @@ -296,12 +306,10 @@ 2000-02-10 Nick Garnett * src/i386.ld: Add support for network package. -end-sanitize-net 2000-01-21 Jesper Skov * include/hal_intr.h (HAL_INTERRUPT_MASK, HAL_INTERRUPT_UNMASK): diff --git a/packages/hal/i386/arch/current/cdl/hal_i386.cdl b/packages/hal/i386/arch/current/cdl/hal_i386.cdl --- a/packages/hal/i386/arch/current/cdl/hal_i386.cdl +++ b/packages/hal/i386/arch/current/cdl/hal_i386.cdl @@ -120,7 +120,7 @@ cdl_package CYGPKG_HAL_I386 { cdl_option CYGHWR_HAL_I386_FPU_SWITCH_LAZY { display "Use lazy FPU state switching" flavor bool - default_value 0 + default_value 1 description " This option enables lazy FPU state switching. diff --git a/packages/hal/i386/arch/current/include/arch.inc b/packages/hal/i386/arch/current/include/arch.inc --- a/packages/hal/i386/arch/current/include/arch.inc +++ b/packages/hal/i386/arch/current/include/arch.inc @@ -91,7 +91,8 @@ .macro hal_fpu_init # Tell the CPU to use the math hardware. movl %cr0, %eax - orl $0x32, %eax + orl $0x32, %eax # Set MP, ET, NE bits + andl $~0x8, %eax # And clear TS bit movl %eax, %cr0 finit # and initialize... @@ -278,7 +279,8 @@ 1: .macro hal_fpu_push_exc pushl cyg_hal_fpustate_current # push our FPU state ptr movl cyg_hal_fpustate_owner,%eax # EAX = FPU state owner - jz 1f # skip if zero + cmpl $0,%eax # test it + je 1f # skip if zero fsave i386reg_fpucontext_state(%eax) # save state movl $1,i386reg_fpucontext_valid(%eax) # set valid movl $0,cyg_hal_fpustate_owner # zero owner pointer diff --git a/packages/hal/i386/generic/current/cdl/hal_i386_generic.cdl b/packages/hal/i386/generic/current/cdl/hal_i386_generic.cdl --- a/packages/hal/i386/generic/current/cdl/hal_i386_generic.cdl +++ b/packages/hal/i386/generic/current/cdl/hal_i386_generic.cdl @@ -41,13 +41,13 @@ # ==================================================================== cdl_package CYGPKG_HAL_I386_GENERIC { - display "i386 PC target" + display "i386 generic target" parent CYGPKG_HAL_I386 define_header hal_i386_generic.h include_dir cyg/hal description " This package provides support for generic IA32 CPU variants. - Any CPU from a80386 to the latest Pentium/Athlon should work + Any CPU from an 80386 to the latest Pentium/Athlon should work with this variant HAL. Essentially this variant is empty, it just avoids providing any configuration to the generic architecture support in the architecture HAL." diff --git a/packages/hal/i386/pc/current/ChangeLog b/packages/hal/i386/pc/current/ChangeLog --- a/packages/hal/i386/pc/current/ChangeLog +++ b/packages/hal/i386/pc/current/ChangeLog @@ -1,3 +1,9 @@ +2001-07-13 Nick Garnett + + * cdl/hal_i386_pc.cdl: Added requires statement to + CYGSEM_HAL_ROM_MONITOR option to turn off lazy FPU switching. ROM + monitors should not be playing these kinds of games. + 2001-05-22 Jonathan Larmour * include/pkgconf/mlt_i386_pc_ram.mlt: Fix pci_window description. diff --git a/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl b/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl --- a/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl +++ b/packages/hal/i386/pc/current/cdl/hal_i386_pc.cdl @@ -256,6 +256,7 @@ cdl_package CYGPKG_HAL_I386_PC { parent CYGPKG_HAL_ROM_MONITOR requires { CYG_HAL_STARTUP == "FLOPPY" || CYG_HAL_STARTUP == "ROM" } + requires { !CYGHWR_HAL_I386_FPU_SWITCH_LAZY } description " Enable this option if this program is to be used as a ROM monitor, i.e. applications will be loaded into RAM on the board, and this diff --git a/packages/hal/mips/arch/current/ChangeLog b/packages/hal/mips/arch/current/ChangeLog --- a/packages/hal/mips/arch/current/ChangeLog +++ b/packages/hal/mips/arch/current/ChangeLog @@ -1,3 +1,18 @@ +2001-07-17 David Woodhouse + + * src/redboot_linux_exec.c: Add environment stuff to the 'exec' + command, also make it use the entry point from the last 'load' + command if there is one. + Also add '-w' delay option. + +2001-07-09 David Woodhouse + + * src/redboot_linux_exec.c: New 'exec' command for RedBoot, mostly + copied from the SH version, hacked to pass arguments in argc/argv + form as that seems to be what most Linux/MIPS kernels expect to + receive from PMON. + * cdl/hal_mips.cdl: Add necessary magic for the above. + 2001-07-03 Hugo Tyson * src/vectors.S (restore_state): When restoring the CPU status diff --git a/packages/hal/mips/arch/current/cdl/hal_mips.cdl b/packages/hal/mips/arch/current/cdl/hal_mips.cdl --- a/packages/hal/mips/arch/current/cdl/hal_mips.cdl +++ b/packages/hal/mips/arch/current/cdl/hal_mips.cdl @@ -115,4 +115,42 @@ cdl_package CYGPKG_HAL_MIPS { been compiled as 32-bit. Do not use this for real 64-bit code." } + cdl_component CYGPKG_REDBOOT_MIPS_OPTIONS { + display "Redboot for MIPS 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_component CYGSEM_REDBOOT_MIPS_LINUX_BOOT { + display "Support booting Linux via RedBoot" + flavor bool + default_value 1 + description " + This option enables RedBoot to support booting of a Linux kernel." + compile -library=libextras.a redboot_linux_exec.c + + cdl_option CYGDAT_REDBOOT_MIPS_LINUX_BOOT_ENTRY { + display "Default kernel entry address" + flavor data + default_value 0x80100750 + } + + cdl_option CYGDAT_REDBOOT_MIPS_LINUX_BOOT_ARGV_ADDR { + display "Default argv address" + flavor data + default_value 0x80080000 + } + + cdl_option CYGDAT_REDBOOT_MIPS_LINUX_BOOT_COMMAND_LINE { + display "Default COMMAND_LINE" + flavor data + default_value { "" } + } + } + } + } diff --git a/packages/hal/mips/arch/current/src/redboot_linux_exec.c b/packages/hal/mips/arch/current/src/redboot_linux_exec.c new file mode 100644 --- /dev/null +++ b/packages/hal/mips/arch/current/src/redboot_linux_exec.c @@ -0,0 +1,161 @@ +//========================================================================== +// +// redboot_linux_exec.c +// +// RedBoot exec command for Linux booting +// +//========================================================================== +//####COPYRIGHTBEGIN#### +// +// ------------------------------------------- +// The contents of this file are subject to the Red Hat eCos Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.redhat.com/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations under +// the License. +// +// The Original Code is eCos - Embedded Configurable Operating System, +// released September 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): t@keshi.org +// Contributors: t@keshi.org, jskov, dwmw2 +// Date: 2001-07-09 +// Purpose: RedBoot exec command for Linux booting +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +#include + +#include +#include +#include + +#define xstr(s) str(s) +#define str(s...) #s + +typedef struct +{ + char *name; + char *val; +} t_env_var; + +struct parmblock { + t_env_var memsize; + t_env_var modetty0; + t_env_var ethaddr; + t_env_var env_end; + char *argv[2]; + char text[0]; +}; + +static void do_exec(int argc, char *argv[]); +RedBoot_cmd("exec", + "Execute an image", + "[-b ] [-c \"kernel command line\"] [-w ]\n" + " []", + do_exec + ); + +static void +do_exec(int argc, char *argv[]) +{ + cyg_uint32 entry = (cyg_uint32)entry_address?:CYGDAT_REDBOOT_MIPS_LINUX_BOOT_ENTRY; + cyg_uint32 base_addr = CYGDAT_REDBOOT_MIPS_LINUX_BOOT_ARGV_ADDR; + char *cmd_line = xstr(CYGDAT_REDBOOT_MIPS_LINUX_BOOT_COMMAND_LINE); + bool base_addr_set, cmd_line_set, wait_time_set; + int wait_time, res; + char line[8]; + + struct option_info opts[3]; + char *pcmd; + struct parmblock *pb; + void (*linux)(int, char **, void *); + int oldints; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + (void **)&base_addr, &base_addr_set, "base address"); + init_opts(&opts[1], 'w', true, OPTION_ARG_TYPE_NUM, + (void **)&wait_time, (bool *)&wait_time_set, "wait timeout"); + init_opts(&opts[2], 'c', true, OPTION_ARG_TYPE_STR, + (void **)&cmd_line, &cmd_line_set, "kernel command line"); + + if (!scan_opts(argc, argv, 1, opts, 3, (void *)&entry, + OPTION_ARG_TYPE_NUM, "entry address")) + return; + + linux = (void *)entry; + + printf("Now booting linux kernel:\n"); + printf(" Base address 0x%08x Entry 0x%08x\n", base_addr, entry); + printf(" Cmdline : %s\n", cmd_line); + + if (wait_time_set) { + printf("About to start execution at %p - abort with ^C within %d seconds\n", + (void *)entry, wait_time); + res = gets(line, sizeof(line), wait_time*1000); + if (res == _GETS_CTRLC) { + return; + } + } + + HAL_DISABLE_INTERRUPTS(oldints); + + pb = (struct parmblock *)base_addr; + pcmd = pb->text; + + pb->memsize.name = pcmd; + pcmd += sprintf(pcmd, "memsize"); + pb->memsize.val = ++pcmd; + pcmd += sprintf(pcmd, "0x%08x", (ram_end - ram_start + 0xFFFFF) & ~0xFFFFF); + + pb->modetty0.name = ++pcmd; + pcmd += sprintf(pcmd, "modetty0"); + pb->modetty0.val = ++pcmd; + pcmd += sprintf(pcmd, "%d,n,8,1,hw", CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD); + +#ifdef CYGPKG_REDBOOT_NETWORKING + pb->ethaddr.name = ++pcmd; + pcmd += sprintf(pcmd, "ethaddr"); + pb->ethaddr.val = ++pcmd; + pcmd += sprintf(pcmd, "%02x.%02x.%02x.%02x.%02x.%02x", + __local_enet_addr[0], __local_enet_addr[1], + __local_enet_addr[2], __local_enet_addr[3], + __local_enet_addr[4], __local_enet_addr[5]); + pb->env_end.name = NULL; + pb->env_end.val = NULL; +#else + pb->ethaddr.name = NULL; + pb->ethaddr.val = NULL; +#endif + + /* Point argv[0] at a handy `\0` */ + pb->argv[0] = pcmd; + pb->argv[1] = ++pcmd; + + strcpy(pcmd, cmd_line); + + HAL_DCACHE_SYNC(); + HAL_ICACHE_DISABLE(); + HAL_DCACHE_DISABLE(); + HAL_DCACHE_SYNC(); + HAL_ICACHE_INVALIDATE_ALL(); + HAL_DCACHE_INVALIDATE_ALL(); + + linux(2, pb->argv, pb); +} diff --git a/packages/hal/sh/arch/current/ChangeLog b/packages/hal/sh/arch/current/ChangeLog --- a/packages/hal/sh/arch/current/ChangeLog +++ b/packages/hal/sh/arch/current/ChangeLog @@ -1,3 +1,7 @@ +2001-07-09 Jesper Skov + + * src/sh_stub.c: Fixed potential SH4 problem in UBC handling. + 2001-07-02 Jesper Skov * include/hal_arch.h: CYGARC_PHYSICAL_ADDRESS renamed to diff --git a/packages/hal/sh/arch/current/src/sh_stub.c b/packages/hal/sh/arch/current/src/sh_stub.c --- a/packages/hal/sh/arch/current/src/sh_stub.c +++ b/packages/hal/sh/arch/current/src/sh_stub.c @@ -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. // ------------------------------------------- // @@ -147,6 +147,12 @@ void __single_step (void) HAL_WRITE_UINT16(CYGARC_REG_BBRA, CYGARC_REG_BBRA_IFETCH|CYGARC_REG_BBRA_READ); #endif + +#ifdef CYGPKG_HAL_SH_SH4 + // Must execute at least 11 instructions before reaching + // any address that may be affected by the UBC settings. + asm volatile ("nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;"); +#endif } /* Clear the single-step state. */ @@ -157,6 +163,12 @@ void __clear_single_step (void) HAL_WRITE_UINT16(CYGARC_REG_BBRA, 0); // Clear status flags HAL_WRITE_UINT16(CYGARC_REG_BRCR, 0); + +#ifdef CYGPKG_HAL_SH_SH4 + // Must execute at least 11 instructions before reaching + // any address that may be affected by the UBC settings. + asm volatile ("nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;"); +#endif } #else // CYGARC_SH_MOD_UBC diff --git a/packages/hal/sh/cq7750/current/ChangeLog b/packages/hal/sh/cq7750/current/ChangeLog --- a/packages/hal/sh/cq7750/current/ChangeLog +++ b/packages/hal/sh/cq7750/current/ChangeLog @@ -1,3 +1,12 @@ +2001-07-13 Jesper Skov + + * include/platform.inc (BSC_settings_table): Replaced + CYGARC_REG_SDMR2 with the value specific to the board. + +2001-07-09 Jesper Skov + + * cdl/hal_sh_sh7750_cq7750.cdl: Option description tweaks. + 2001-05-29 Jesper Skov * include/plf_io.h: Added. diff --git a/packages/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl b/packages/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl --- a/packages/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl +++ b/packages/hal/sh/cq7750/current/cdl/hal_sh_sh7750_cq7750.cdl @@ -130,20 +130,14 @@ cdl_package CYGPKG_HAL_SH_SH7750_CQ7750 other clocks are derived from." } - cdl_option CYGHWR_HAL_SH_OOC_CKIO { - display "SH clock CKIO output enable" - default_value 1 - description " - This selects whether CKIO output is enabled." - } - cdl_option CYGHWR_HAL_SH_OOC_PLL_1 { display "SH clock PLL circuit 1" flavor data default_value 6 legal_values { 0 6 } description " - This selects whether PLL1 is enabled." + This selects the multiplication factor provided by + PLL1." } cdl_option CYGHWR_HAL_SH_OOC_PLL_2 { @@ -152,20 +146,22 @@ cdl_package CYGPKG_HAL_SH_SH7750_CQ7750 default_value 1 legal_values { 0 1 } description " - This selects whether PLL2 is enabled." + This selects the multiplication factor provided by + PLL2. If PLL2 is disabled this option should + be set to zero." } cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_IFC { - display "SH clock divider, core" + display "SH CPU clock divider" flavor data default_value 1 legal_values { 1 2 3 4 6 8 } description " - This divider option affects the CPU core clock." + This divider option affects the CPU clock." } cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_BFC { - display "SH clock divider, bus" + display "SH bus clock divider" flavor data default_value 3 legal_values { 1 2 3 4 6 8 } @@ -174,7 +170,7 @@ cdl_package CYGPKG_HAL_SH_SH7750_CQ7750 } cdl_option CYGHWR_HAL_SH_OOC_DIVIDER_PFC { - display "SH clock divider, peripheral" + display "SH peripheral clock divider" flavor data default_value 6 legal_values { 1 2 3 4 6 8 } diff --git a/packages/hal/sh/cq7750/current/include/platform.inc b/packages/hal/sh/cq7750/current/include/platform.inc --- a/packages/hal/sh/cq7750/current/include/platform.inc +++ b/packages/hal/sh/cq7750/current/include/platform.inc @@ -135,7 +135,7 @@ BSC_settings_table: .long 0x10192194 .long 2 # SDMR2: - .long CYGARC_REG_SDMR2 + .long 0xFF90008c .long 0xaa .long 0 # MCR: @@ -143,7 +143,7 @@ BSC_settings_table: .long 0x50192194 .long 2 # SDMR2: - .long CYGARC_REG_SDMR2 + .long 0xFF90008c .long 0xaa .long 0 # Table end diff --git a/packages/hal/sh/sh4/current/ChangeLog b/packages/hal/sh/sh4/current/ChangeLog --- a/packages/hal/sh/sh4/current/ChangeLog +++ b/packages/hal/sh/sh4/current/ChangeLog @@ -1,3 +1,53 @@ +2001-07-17 Jesper Skov + + * cdl/hal_sh_sh4.cdl: Allow caching. + + * include/mod_regs_intc.h (CYGARC_REG_ICR_INIT): Revert + CYGHWR_HAL_SH_IRQ_USE_IRQLVL sense. + + * include/variant.inc: Fix alignment bug. + + * include/mod_regs_ubc.h: Compile when UBC disabled. + +2001-07-16 Jesper Skov + + * src/var_misc.c (hal_interrupt_update_level): Fix typo. + + * include/variant.inc: Added ICR initialization. + + * include/mod_regs_intc.h: Added ICR definitions. + + * cdl/hal_sh_sh4.cdl: Interrupt option cleanup. + + * include/mod_regs_bsc.h: Added some BCR1 and MCR register bit + definitions. Deleted wrong register definitions. + + * src/pcic.c (cyg_hal_sh_pcic_pci_init): Set PCIC MCR + register. Set BCR1 master flag. Set PCI cache line size. + +2001-07-13 Jesper Skov + + * include/mod_regs_bsc.h: Removed SDMR2 definition - it is + platform specific. + +2001-07-10 Jesper Skov + + * include/mod_7750.h: define intc macro. + +2001-07-09 Jesper Skov + + * include/mod_regs_ubc.h: Ignore ASID when stepping. + + * include/mod_7750.h: Fix DCAC address top. + + * src/variant.S: Let all cache functions delay for 8 nops before + returning. + + * include/mod_regs_bsc.h: Added more registers. + + * cdl/hal_sh_sh4.cdl: Tweak options, add options for interrupts + and cache settings. + 2001-05-29 Jesper Skov * include/var_io.h: Added. Includes plf_io.h @@ -94,7 +144,7 @@ 2000-04-18 Ryozaburo Suzuki + + * src/diag.cxx (diag_vprintf): Fix long longs (patch from + Motoya Kurotsu + + * cdl/debug.cdl: Make tracing styles be mutually exclusive properly + using an interface. + 2001-06-14 Jonathan Larmour * include/clist.hxx (Cyg_DNode_T): Don't qualify constructor or diff --git a/packages/infra/current/cdl/debug.cdl b/packages/infra/current/cdl/debug.cdl --- a/packages/infra/current/cdl/debug.cdl +++ b/packages/infra/current/cdl/debug.cdl @@ -50,6 +50,7 @@ cdl_component CYGDBG_USE_ASSERTS { display "Use asserts" default_value 1 + requires { 1 == CYGINT_INFRA_DEBUG_TRACE_IMPL } description " If this option is defined, asserts in the code are tested. Assert functions (CYG_ASSERT()) are defined in @@ -63,6 +64,7 @@ cdl_component CYGDBG_USE_ASSERTS { cdl_component CYGDBG_USE_TRACING { display "Use tracing" default_value 0 + requires { 1 == CYGINT_INFRA_DEBUG_TRACE_IMPL } description " If this option is defined, tracing operations result in output or logging, depending on other options. @@ -109,11 +111,14 @@ cdl_component CYGDBG_USE_TRACING { } } -# FIXME: The below options should be mutually exclusive. +cdl_interface CYGINT_INFRA_DEBUG_TRACE_IMPL { + display "Trace output implementations" +} + cdl_option CYGDBG_INFRA_DEBUG_TRACE_ASSERT_NULL { display "Null output" -# type radio default_value 0 + implements CYGINT_INFRA_DEBUG_TRACE_IMPL description " A null output module which is useful when debugging interactively; the output routines @@ -122,24 +127,24 @@ cdl_option CYGDBG_INFRA_DEBUG_TRACE_ASSE } cdl_option CYGDBG_INFRA_DEBUG_TRACE_ASSERT_SIMPLE { display "Simple output" -# type radio default_value 0 + implements CYGINT_INFRA_DEBUG_TRACE_IMPL description " An output module which produces simple output from tracing and assertion events." } cdl_option CYGDBG_INFRA_DEBUG_TRACE_ASSERT_FANCY { display "Fancy output" -# type radio default_value 0 + implements CYGINT_INFRA_DEBUG_TRACE_IMPL description " An output module which produces fancy output from tracing and assertion events." } cdl_component CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER { display "Buffered tracing" -# type radio default_value 1 + implements CYGINT_INFRA_DEBUG_TRACE_IMPL description " An output module which buffers output from tracing and assertion events. The stored diff --git a/packages/infra/current/src/diag.cxx b/packages/infra/current/src/diag.cxx --- a/packages/infra/current/src/diag.cxx +++ b/packages/infra/current/src/diag.cxx @@ -262,6 +262,9 @@ static cyg_bool diag_check_string( const externC void diag_vprintf( const char *fmt, CYG_ADDRWORD *args) { + + cyg_bool pad = true; + if( !diag_check_string(fmt) ) { int i; @@ -309,6 +312,13 @@ externC void diag_vprintf( const char *f } } + if (long_op) { + if(pad) args++; + pad=false; + } else { + pad=!pad; + } + switch( c ) { case 'd': diff --git a/packages/io/usb/eth/slave/current/ChangeLog b/packages/io/usb/eth/slave/current/ChangeLog --- a/packages/io/usb/eth/slave/current/ChangeLog +++ b/packages/io/usb/eth/slave/current/ChangeLog @@ -1,3 +1,17 @@ +2001-07-10 Bart Veer + + * doc/usbseth.sgml, doc/*.html: + Document the below changes. + + * cdl/usbs_eth.cdl: + The USB-ethernet device now registers itself as either eth0 or + eth1 by default, depending on what else is present in the system. + Also bootp/dhcp support is prohibited for this network device on + the ground that it is rather unlikely that a host will provide + a dhcp service for a network device that does not exist until the + host-target connection has been fully established. + + 2001-07-02 Bart Veer * host/ecos_usbeth.c (ecos_usbeth_probe): diff --git a/packages/io/usb/eth/slave/current/cdl/usbs_eth.cdl b/packages/io/usb/eth/slave/current/cdl/usbs_eth.cdl --- a/packages/io/usb/eth/slave/current/cdl/usbs_eth.cdl +++ b/packages/io/usb/eth/slave/current/cdl/usbs_eth.cdl @@ -88,7 +88,7 @@ cdl_package CYGPKG_IO_USB_SLAVE_ETH { cdl_option CYGDAT_USBS_ETHDRV_NAME { display "Name to use for this network device" flavor data - default_value { "\"eth0\"" } + default_value { (1 == CYGHWR_NET_DRIVERS) ? "\"eth0\"" : "\"eth1\"" } description " The name of this network device for control purposes. " @@ -99,12 +99,15 @@ cdl_package CYGPKG_IO_USB_SLAVE_ETH { flavor bool calculated { "\"eth0\"" == CYGDAT_USBS_ETHDRV_NAME } implements CYGHWR_NET_DRIVER_ETH0 + requires !CYGHWR_NET_DRIVER_ETH0_BOOTP } + cdl_option CYGPRI_USBS_ETHDRV_ETH1 { display "Enable/disable generic eth1 configury" flavor bool calculated { "\"eth1\"" == CYGDAT_USBS_ETHDRV_NAME } implements CYGHWR_NET_DRIVER_ETH1 + requires !CYGHWR_NET_DRIVER_ETH1_BOOTP } } } diff --git a/packages/io/usb/eth/slave/current/doc/io-usb-slave-eth.html b/packages/io/usb/eth/slave/current/doc/io-usb-slave-eth.html --- a/packages/io/usb/eth/slave/current/doc/io-usb-slave-eth.html +++ b/packages/io/usb/eth/slave/current/doc/io-usb-slave-eth.html @@ -2,165 +2,167 @@ - + - - - - -eCos Support for Developing USB-ethernet Peripherals - +eCos Support for Developing USB-ethernet Peripherals - -
-
- - - - - -
  - - -Next -
-
Next
-
- - -
-

-I. eCos Support for Developing USB-ethernet Peripherals

-
-
-
- -Table of Contents -
-
- -Introduction - — eCos support for developing USB ethernet peripherals
-
- -Initializing the USB-ethernet Package - — Initializing the USB-ethernet Package
-
- -USB-ethernet Data Transfers - — Exchanging ethernet packets with the USB host
-
- -USB-ethernet State Handling - — Maintaining the USB-ethernet connection with the host
-
- -Network Device for the eCos TCP/IP Stack - — USB-ethernet support for the eCos TCP/IP Stack
-
- -Example Host-side Device Driver - — Provide host-side support for the eCos USB-ethernet package
-
- -Communication Protocol - — Protocol used between the host-side device driver and the eCos -USB-ethernet package
-
-
-
-
-
-

I. eCos Support for Developing USB-ethernet Peripherals

Table of Contents
Introduction — eCos support for developing USB ethernet peripherals
Initializing the USB-ethernet Package — Initializing the USB-ethernet Package
USB-ethernet Data Transfers — Exchanging ethernet packets with the USB host
USB-ethernet State Handling — Maintaining the USB-ethernet connection with the host
Network Device for the eCos TCP/IP Stack — USB-ethernet support for the eCos TCP/IP Stack
Example Host-side Device Driver — Provide host-side support for the eCos USB-ethernet package
Communication Protocol — Protocol used between the host-side device driver and the eCos +USB-ethernet package

- - - - - - - - - - -
   - -Next -
Next
   -Introduction
-
- - +VALIGN="top" +>Introduction \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth-control.html b/packages/io/usb/eth/slave/current/doc/usbseth-control.html --- a/packages/io/usb/eth/slave/current/doc/usbseth-control.html +++ b/packages/io/usb/eth/slave/current/doc/usbseth-control.html @@ -2,20 +2,21 @@ - + - - - - -USB-ethernet State Handling - +USB-ethernet State Handling - -
-
- - - - - - - - -
-eCos Support for Developing USB-ethernet Peripherals
eCos Support for Developing USB-ethernet Peripherals
- -Prev -Prev - - -Next -
-
Next
-

- -USB-ethernet State Handling -

-
- - -

-Name

-USB-ethernet State Handling -- Maintaining the USB-ethernet connection with the host
-
- - -

-Synopsis

-
-

-

-

USB-ethernet State Handling

Name

USB-ethernet State Handling -- Maintaining the USB-ethernet connection with the host

Synopsis

- - - -
-
-#include <cyg/io/usb/usbs_eth.h>
-
-

- - -usbs_control_return usbs_eth_class_control_handler -(usbs_control_endpoint* ep0, void* callback_data); -

-

- - -void usbs_eth_state_change_handler -(usbs_control_endpoint* ep0, void* callback_data, usbs_state_change change, int old_state); -

-

- - -void usbs_eth_disable -(usbs_eth* usbseth>); -

-

- - -void usbs_eth_enable -(usbs_eth* usbseth>); -

-

-

-
-
-
- - -

-Description

-

-When the USB-ethernet package is initialized by a call to - -usbs_eth_init - - it +WIDTH="100%" +>

#include <cyg/io/usb/usbs_eth.h>

usbs_control_return usbs_eth_class_control_handler(usbs_control_endpoint* ep0, void* callback_data);

void usbs_eth_state_change_handler(usbs_control_endpoint* ep0, void* callback_data, usbs_state_change change, int old_state);

void usbs_eth_disable(usbs_eth* usbseth>);

void usbs_eth_enable(usbs_eth* usbseth>);

Description

When the USB-ethernet package is initialized by a call to usbs_eth_init it installs -usbs_eth_state_change_handler - to handle +CLASS="FUNCTION" +>usbs_eth_state_change_handler to handle USB state changes. This allows the package to detect when the connection between the host and the peripheral is established or broken, resulting in internal calls to -usbs_eth_enable - and +CLASS="FUNCTION" +>usbs_eth_enable and -usbs_eth_disable - respectively. This is +CLASS="FUNCTION" +>usbs_eth_disable respectively. This is appropriate if no other code needs to access the USB device. However, if there is other code, either other USB-related packages or the application itself, that needs to perform I/O over the USB bus, then @@ -178,39 +182,39 @@ state change events. Instead, the assump code, typically provided by the application, will install an alternative state change handler in the control endpoint data structure after the call to -usbs_eth_init -. This +CLASS="FUNCTION" +>usbs_eth_init. This alternative handler will either chain into -usbs_eth_state_change_handler - when appropriate, +CLASS="FUNCTION" +>usbs_eth_state_change_handler when appropriate, or else it will invoke -usbs_eth_enable - and +CLASS="FUNCTION" +>usbs_eth_enable and -usbs_eth_disable - directly. For further details of +CLASS="FUNCTION" +>usbs_eth_disable directly. For further details of state change handlers and control endpoints generally, see the -documentation for the common USB-slave package.

-

-Similarly, -usbs_eth_init - will install +documentation for the common USB-slave package.

Similarly, usbs_eth_init will install -usbs_eth_class_control_handler - in the control +CLASS="FUNCTION" +>usbs_eth_class_control_handler in the control endpoint data structure as the appropriate handler for class-specific USB control messages. This code will handle the ethernet-specific -control messages -, for example +HREF="usbseth-protocol.html" +>control messages , for example requests by the host to enable or disable promiscuous mode or to obtain the MAC address. If the USB device is not shared with any other code then this is both necessary and sufficient. However, if other code @@ -221,84 +225,85 @@ request code is encoded in just a single possibility that exactly the same number will be used by different protocols for different requests. Any such problems will have to be identified and resolved by application developers, and may involve -modifying the source code for the USB-ethernet package.

-

-As an alternative to chaining the state change handler, higher-level +modifying the source code for the USB-ethernet package.

As an alternative to chaining the state change handler, higher-level code can instead call -usbs_eth_disable - and +CLASS="FUNCTION" +>usbs_eth_disable and -usbs_eth_enable - directly. These functions may +CLASS="FUNCTION" +>usbs_eth_enable directly. These functions may also be called if the USB-ethernet package should become inactive for reasons not related directly to events on the USB bus. The main effect of -usbs_eth_enable - is to restart receive +CLASS="FUNCTION" +>usbs_eth_enable is to restart receive operations and to allow transmits. The main effect of -usbs_eth_disable - is to block further transmits: +CLASS="FUNCTION" +>usbs_eth_disable is to block further transmits: any current receive operations need to be aborted at the USB level, -for example by halting the appropriate endpoint.

-
-
-

- - - - - - - - - - -
- -Prev -Prev - -Home -Home - -Next -
Next
-USB-ethernet Data TransfersUSB-ethernet Data Transfers  -Network Device for the eCos TCP/IP Stack
-
- - +VALIGN="top" +>Network Device for the eCos TCP/IP Stack \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth-data.html b/packages/io/usb/eth/slave/current/doc/usbseth-data.html --- a/packages/io/usb/eth/slave/current/doc/usbseth-data.html +++ b/packages/io/usb/eth/slave/current/doc/usbseth-data.html @@ -2,20 +2,21 @@ - + - - - - -USB-ethernet Data Transfers - +USB-ethernet Data Transfers - -
-
- - - - - - - - -
-eCos Support for Developing USB-ethernet Peripherals
eCos Support for Developing USB-ethernet Peripherals
- -Prev -Prev - - -Next -
-
Next
-

- -USB-ethernet Data Transfers -

-
- - -

-Name

-USB-ethernet Data Transfers -- Exchanging ethernet packets with the USB host
-
- - -

-Synopsis

-
-

-

-

USB-ethernet Data Transfers

Name

USB-ethernet Data Transfers -- Exchanging ethernet packets with the USB host

Synopsis

- - - -
-
-#include <cyg/io/usb/usbs_eth.h>
-
-

- - -void usbs_eth_start_rx -(usbs_eth* usbseth, unsigned char* buffer, void (*)(usbs_eth*, void*, int) complete_fn, void* complete_data); -

-

- - -void usbs_eth_start_tx -(usbs_eth* usbseth, unsigned char* buffer, void (*)(usbs_eth*, void*, int) complete_fn, void* complete_data); -

-

-

-
-
-
- - -

-Description

-

-The USB-ethernet package provides two main modes of operation. In the +WIDTH="100%" +>

#include <cyg/io/usb/usbs_eth.h>

void usbs_eth_start_rx(usbs_eth* usbseth, unsigned char* buffer, void (*)(usbs_eth*, void*, int) complete_fn, void* complete_data);

void usbs_eth_start_tx(usbs_eth* usbseth, unsigned char* buffer, void (*)(usbs_eth*, void*, int) complete_fn, void* complete_data);

Description

The USB-ethernet package provides two main modes of operation. In the first mode it provides a -network device -driver - for use by a TCP/IP stack running inside the USB +HREF="usbseth-netdev.html" +>network device +driver for use by a TCP/IP stack running inside the USB peripheral. All incoming ethernet packages should be passed up the TCP/IP stack, and only the stack will generate outgoing packets. Apart from -initialization - and possibly +HREF="usbseth-init.html" +>initialization and possibly certain -control operations -, +HREF="usbseth-control.html" +>control operations, higher-level code will not interact with the USB-ethernet package -directly.

-

-In the second mode there is no TCP/IP stack running inside the USB +directly.

In the second mode there is no TCP/IP stack running inside the USB peripheral. For example, a simple USB-ethernet converter has an ethernet chip and a USB port: ethernet packets received by the ethernet chip need to be forwarded to the USB host, and ethernet packets sent by the USB host need to be sent out of the ethernet chip. -usbs_eth_start_rx - and +CLASS="FUNCTION" +>usbs_eth_start_rx and -usbs_eth_start_tx - allow for this lower-level -access to the USB-ethernet package.

-

-The two modes of operation are mutually exclusive. If the network +CLASS="FUNCTION" +>usbs_eth_start_tx allow for this lower-level +access to the USB-ethernet package.

The two modes of operation are mutually exclusive. If the network device driver mode is enabled then application code should communicate at the TCP/IP level, and not by using the lower-level functions. Instead, it is the network device driver that will make use of these functions, and it assumes that it has exclusive access. The package -does not perform any locking.

-

-The transmit and receive functions work in much the same way. The +does not perform any locking.

The transmit and receive functions work in much the same way. The first argument identifies the -usbs_eth - +CLASS="STRUCTNAME" +>usbs_eth structure that should be used. For the majority of applications this will be -usbs_eth0 -. The second argument specifies +CLASS="LITERAL" +>usbs_eth0. The second argument specifies the location of the ethernet packet; outgoing for -usbs_eth_start_tx - and incoming for +CLASS="FUNCTION" +>usbs_eth_start_tx and incoming for -usbs_eth_start_rx -. This buffer should correspond +CLASS="FUNCTION" +>usbs_eth_start_rx. This buffer should correspond to the -protocol -:

-

-

-
    -
  1. -

    -Outgoing packets can consist of up to 1516 bytes, consisting of a +HREF="usbseth-protocol.html" +>protocol:

    1. Outgoing packets can consist of up to 1516 bytes, consisting of a two-byte header specific to USB-ethernet followed by a standard ethernet frame (a header with 6-byte destination address, 6-byte source address and a further two bytes, followed by a payload of up to 1500 bytes). The two-byte USB-ethernet header consists simply of the size of the ethernet frame, i.e. the size of the rest of the packet not including the USB-ethernet header, with the least -significant byte first.

      -
    2. -
    3. -

      -For incoming packets the supplied buffer should usually be at least +significant byte first.

    4. For incoming packets the supplied buffer should usually be at least 1516 bytes. There may be special circumstances in which a smaller buffer might be safe; for example, if the host-side device driver is modified to support only smaller packets. Once the packet has been received the buffer will contain a two-byte header specific to USB-ethernet, followed by a normal ethernet frame. The header gives the size of the ethernet frame, excluding the header, with the -least significant byte first.

      -
    5. -
    -

    -Both -usbs_eth_start_tx - and +least significant byte first.

Both usbs_eth_start_tx and -usbs_eth_start_rx - are asynchronous: the transfer +CLASS="FUNCTION" +>usbs_eth_start_rx are asynchronous: the transfer is started and, some time later, a completion function will be invoked. The third and fourth arguments to both -usbs_eth_start_tx - and +CLASS="FUNCTION" +>usbs_eth_start_tx and -usbs_eth_start_rx - supply the completion function +CLASS="FUNCTION" +>usbs_eth_start_rx supply the completion function and an argument to that function respectively. The completion function will be invoked with three arguments: a pointer to the -usbs_eth - data structure, usually +CLASS="STRUCTNAME" +>usbs_eth data structure, usually -usbs_eth0 -; the supplied completion data ; and a +CLASS="LITERAL" +>usbs_eth0; the supplied completion data ; and a return code field. A negative value indicates that an error occurred, for example --EPIPE - if the connection between USB +CLASS="LITERAL" +>-EPIPE if the connection between USB host and peripheral has been broken, or --EAGAIN - if +CLASS="LITERAL" +>-EAGAIN if an endpoint has been halted. A positive value indicates the total size of the transfer, which should correspond to the size in the USB-ethernet header plus an additional two bytes for the header -itself.

-

-If the data transfer is succesful then the completion function will +itself.

If the data transfer is succesful then the completion function will typically be invoked in DSR context rather than in thread context, although this depends on the implementation of the underlying USB device driver. Therefore the completion function is restricted in what @@ -278,92 +282,93 @@ documentation should be consulted for mo interrupt handling generally. Note that if the transfer finishes quickly then the completion function may be invoked before -usbs_eth_start_rx - or +CLASS="FUNCTION" +>usbs_eth_start_rx or -usbs_eth_start_tx - returns. This is especially +CLASS="FUNCTION" +>usbs_eth_start_tx returns. This is especially likely to happen if the current thread is descheduled after starting -the data transfer but before returning from these functions.

-

-For transmit operations, it is possible for +the data transfer but before returning from these functions.

For transmit operations, it is possible for -usbs_eth_start_tx - to invoke the completion +CLASS="FUNCTION" +>usbs_eth_start_tx to invoke the completion function immediately. If there is no current connection between host and target then the transmit will fail immediately with --EPIPE -. In addition the USB-ethernet package will +CLASS="LITERAL" +>-EPIPE. In addition the USB-ethernet package will check the destination MAC address and make sure that the ethernet frame really is intended for the host: either it must be for the address specified in the initialization call - -usbs_eth_init - -, or +HREF="usbseth-init.html" +>usbs_eth_init, or it must be a broadcast packet, or the host must have enabled -promiscuous mode.

-
-
-

- - - - - - - - - - -
- -Prev -Prev - -Home -Home - -Next -
Next
-Initializing the USB-ethernet PackageInitializing the USB-ethernet Package  -USB-ethernet State Handling
-
- - +VALIGN="top" +>USB-ethernet State Handling \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth-host.html b/packages/io/usb/eth/slave/current/doc/usbseth-host.html --- a/packages/io/usb/eth/slave/current/doc/usbseth-host.html +++ b/packages/io/usb/eth/slave/current/doc/usbseth-host.html @@ -2,20 +2,21 @@ - + - - - - -Example Host-side Device Driver - +Example Host-side Device Driver - -
-
- - - - - - - - -
-eCos Support for Developing USB-ethernet Peripherals
eCos Support for Developing USB-ethernet Peripherals
- -Prev -Prev - - -Next -
-
Next
-

- -Example Host-side Device Driver -

-
- - -

-Name

-Example Host-side Device Driver -- Provide host-side support for the eCos USB-ethernet package
-
- - -

-Description

-

-The USB-ethernet package is supplied with a single host-side device +WIDTH="100%">

Example Host-side Device Driver

Name

Example Host-side Device Driver -- Provide host-side support for the eCos USB-ethernet package

Description

The USB-ethernet package is supplied with a single host-side device driver. This driver has been developed against the Linux kernel 2.2.16-22, as shipped with Red Hat 7. The driver is provided as is and should not be considered production quality: for example it only checks for a bogus vendor id -0x4242 - rather than an +CLASS="LITERAL" +>0x4242 rather than an official vendor id supplied by the -USB Implementers Forum -. Also, if the +TARGET="_top" +>USB Implementers Forum. Also, if the peripheral involves multiple configurations or multiple interfaces, it will fail to detect this. However, the driver can be used for simple testing and as the basis of a full device driver. Details of the protocol used between host and peripheral can be found in the -Communication Protocol - section.

-

-The host-side device driver can be found in the -host - subdirectory of the USB-ethernet +HREF="usbseth-protocol.html" +>Communication Protocol section.

The host-side device driver can be found in the host subdirectory of the USB-ethernet package, specifically the file -ecos_usbeth.c -, and +CLASS="FILENAME" +>ecos_usbeth.c, and comes with a -Makefile -. Both files may need +CLASS="FILENAME" +>Makefile. Both files may need to be modified for specific applications. For example, the vendor id table -ecos_usbeth_implementations - may need to be +CLASS="LITERAL" +>ecos_usbeth_implementations may need to be updated for the specific USB peripheral being built. The -Makefile - assumes that the Linux kernel sources +CLASS="FILENAME" +>Makefile assumes that the Linux kernel sources reside in -/usr/src/linux -, and +CLASS="FILENAME" +>/usr/src/linux, and that the kernel has already been configured and built. Assuming this is the case, the device driver can be built simply by invoking -make - with no additional arguments. This will result +CLASS="COMMAND" +>make with no additional arguments. This will result in a dynamically loadable kernel module, -ecos_usbeth.o -, in the current directory.

-
-
-

- -Note: -As normal for Linux kernel builds, the generated files such as +CLASS="FILENAME" +>ecos_usbeth.o, in the current directory.

Note: As normal for Linux kernel builds, the generated files such as -ecos_usbeth.o - live in the same directory as the +CLASS="FILENAME" +>ecos_usbeth.o live in the same directory as the source tree. This is very different from eCos where the source tree (or component repository) is kept separate from any builds. There may be problems if the component repository is kept read-only or if it is put under source code control. Any such problems can be avoided by making a copy of the -host - -subdirectory and building that copy.

-
-
-

-Loading the kernel module into the current system requires root +CLASS="FILENAME" +>host +subdirectory and building that copy.

Loading the kernel module into the current system requires root privileges. If the generic USB support is also a loadable module and -has not been loaded already, this must happen first:

-
- - - -
-
-# insmod usb-uhci
-Using /lib/modules/2.2.16-22/usb/usb-uhci.o
-
-

-Depending on the host hardware, the -uhci - or +WIDTH="100%" +>

# insmod usb-uhci
+Using /lib/modules/2.2.16-22/usb/usb-uhci.o

Depending on the host hardware, the uhci or -usb-ohci - modules may be more appropriate. Loading +CLASS="LITERAL" +>usb-ohci modules may be more appropriate. Loading the generic USB module will typically result in a number of messages to the logfile -/var/log/messages -, giving details +CLASS="FILENAME" +>/var/log/messages, giving details of the specific host-side hardware that has been detected plus any -hubs. The next step is to load the USB-ethernet module:

-
- - - -
-
-# insmod ecos_usbeth.o
-
-

-This should result in a number of additional diagnostics in the -logfile:

-
# insmod ecos_usbeth.o

This should result in a number of additional diagnostics in the +logfile:

- - - -
-
-Apr 1 18:01:08 grumpy kernel: eCos USB-ethernet device driver
-Apr 1 18:01:08 grumpy kernel: usb.c: registered new driver ecos_usbeth
-
-

-If a suitable USB peripheral is now connected the host will detect +WIDTH="100%" +>

Apr 1 18:01:08 grumpy kernel: eCos USB-ethernet device driver
+Apr 1 18:01:08 grumpy kernel: usb.c: registered new driver ecos_usbeth

If a suitable USB peripheral is now connected the host will detect this, assign an address in the local USB network, obtain enumeration data, and find a suitable device driver. Assuming the peripheral and device driver agree on the supported vendor ids, the -ecos_usbeth.o - module will be selected and this -will be reported in the system log:

-ecos_usbeth.o module will be selected and this +will be reported in the system log:

- - - -
-
-Apr 1 18:04:12 grumpy kernel: usb.c: USB new device connect, assigned device number 3
-Apr 1 18:04:12 grumpy kernel: eCos-based USB ethernet peripheral active at eth1
-
-

-What can happen next depends very much on the software that is running +WIDTH="100%" +>

Apr 1 18:04:12 grumpy kernel: usb.c: USB new device connect, assigned device number 3
+Apr 1 18:04:12 grumpy kernel: eCos-based USB ethernet peripheral active at eth1

What can happen next depends very much on the software that is running on top of the USB-ethernet package inside the peripheral. For example, if there is a TCP/IP stack then it should be possible to bring up a network connection between host and peripheral using -ifconfig -.

-
-
-
ifconfig.


- - - - - - - - - - -
- -Prev -Prev - -Home -Home - -Next -
Next
-Network Device for the eCos TCP/IP StackNetwork Device for the eCos TCP/IP Stack  -Communication Protocol
-
- - +VALIGN="top" +>Communication Protocol \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth-init.html b/packages/io/usb/eth/slave/current/doc/usbseth-init.html --- a/packages/io/usb/eth/slave/current/doc/usbseth-init.html +++ b/packages/io/usb/eth/slave/current/doc/usbseth-init.html @@ -2,20 +2,21 @@ - + - - - - -Initializing the USB-ethernet Package - +Initializing the USB-ethernet Package - -
-
- - - - - - - - -
-eCos Support for Developing USB-ethernet Peripherals
eCos Support for Developing USB-ethernet Peripherals
- -Prev -Prev - - -Next -
-
Next
-

- -Initializing the USB-ethernet Package -

-
- - -

-Name

- -usbs_eth_init - -- Initializing the USB-ethernet Package
-
- - -

-Synopsis

-
-

-

-

Initializing the USB-ethernet Package

Name

usbs_eth_init -- Initializing the USB-ethernet Package

Synopsis

- - - -
-
-#include <cyg/io/usb/usbs_eth.h>
-
-

- - -void usbs_eth_init -(usbs_eth* usbeth, usbs_control_endpoint* ep0, usbs_rx_endpoint* ep1, usbs_tx_endpoint* ep2, unsigned char* mac_address); -

-

-

-
-
-
- - -

-Description

-

-The USB-ethernet package is not tied to any specific hardware. It +WIDTH="100%" +>

#include <cyg/io/usb/usbs_eth.h>

void usbs_eth_init(usbs_eth* usbeth, usbs_control_endpoint* ep0, usbs_rx_endpoint* ep1, usbs_tx_endpoint* ep2, unsigned char* mac_address);

Description

The USB-ethernet package is not tied to any specific hardware. It requires certain functionality: there must be USB-slave hardware supported by a device driver; there must also be two endpoints for bulk transfers between host and peripheral, one for each direction; there must also be a control endpoint, although of course that is -implicit with any USB hardware.

-

-However, USB-slave hardware may well provide more endpoints than the +implicit with any USB hardware.

However, USB-slave hardware may well provide more endpoints than the minimum required for ethernet support. Some of those endpoints might be used by other packages, while other endpoints might be used directly by the application, or might not be needed for the peripheral @@ -147,34 +151,34 @@ only some of those configurations. The U knowledge about any of this, so it relies on higher-level code to tell it which endpoints should be used and other information. This is the purpose of the -usbs_eth_init - function.

-

-The first argument identifies the specific +CLASS="FUNCTION" +>usbs_eth_init function.

The first argument identifies the specific -usbs_eth - data structure that is affected. It +CLASS="STRUCTNAME" +>usbs_eth data structure that is affected. It is expected that the vast majority of affected applications will only provide a single USB-ethernet device to a single host, and the package automatically provides a suitable data structure -usbs_eth0 - to support this. If multiple +CLASS="LITERAL" +>usbs_eth0 to support this. If multiple -usbs_eth - structures are needed for some +CLASS="STRUCTNAME" +>usbs_eth structures are needed for some reason then these need to be instantiated by other code, and each one needs to be initialised by a call to -usbs_eth_init() -.

-

-The next three arguments identify the endpoints that should be used +CLASS="FUNCTION" +>usbs_eth_init().

The next three arguments identify the endpoints that should be used for USB communications: a control endpoint, a receive endpoint for ethernet packets coming from the host to the peripheral, and a transmit endpoint for ethernet packets going in the other direction. @@ -182,72 +186,72 @@ Obviously all three endpoints should be hardware. The USB-ethernet package assumes that it has sole access to the receive and transmit endpoints, subject to the use of -usbs_eth_disable - and +CLASS="FUNCTION" +>usbs_eth_disable and -usbs_eth_enable - control functions. The package +CLASS="FUNCTION" +>usbs_eth_enable control functions. The package also assumes that no other code is interested in USB state changes or class control messages: it installs handlers - -usbs_eth_state_change_handler - - +HREF="usbseth-control.html" +>usbs_eth_state_change_handler and - -usbs_eth_class_control_handler - - +HREF="usbseth-control.html" +>usbs_eth_class_control_handler in the control endpoint. If any other code does need to handle USB state changes or class control messages then replacement handlers should be installed after the call to -usbs_eth_init -, and those replacements should -invoke the USB-ethernet ones when appropriate.

-

-The final argument to -usbs_eth_init - specifies +CLASS="FUNCTION" +>usbs_eth_init, and those replacements should +invoke the USB-ethernet ones when appropriate.

The final argument to usbs_eth_init specifies the MAC address (or Ethernet Station Address) that should be provided to the host-side device driver. Since the USB-ethernet package does not interact directly with a real ethernet device it cannot obtain the MAC address from any hardware. Instead, it must be supplied by higher-level code. The details depend on the -scenario - in which the -USB-ethernet package is being used.

-

-The call to -usbs_eth_init - should normally happen +HREF="usbseth-intro.html#AEN22" +>scenario in which the +USB-ethernet package is being used.

The call to usbs_eth_init should normally happen after the enumeration data has been provided but before the underlying USB device driver has been started. If the USB device were to be started first then a connection between host and peripheral could be established immediately, and the host-side device driver would attempt to contact the USB-ethernet package for information such as the MAC -address.

-
- - - -
-
-int
+WIDTH="100%"
+>
int
 main(int argc, char** argv)
 {
     unsigned char host_MAC[6] = { 0x40, 0x5d, 0x90, 0xa9, 0xbc, 0x02 };
@@ -258,64 +262,65 @@ main(int argc, char** argv)
     …
     usbs_start(&usbs_sa11x0_ep0);
     …
-}
-
-
-
-

- - - - - - - - - - -
- -Prev -Prev - -Home -Home - -Next -
Next
-IntroductionIntroduction  -USB-ethernet Data Transfers
-
- - +VALIGN="top" +>USB-ethernet Data Transfers \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth-intro.html b/packages/io/usb/eth/slave/current/doc/usbseth-intro.html --- a/packages/io/usb/eth/slave/current/doc/usbseth-intro.html +++ b/packages/io/usb/eth/slave/current/doc/usbseth-intro.html @@ -2,20 +2,21 @@ - + - - - - -Introduction - +Introduction - -
-
- - - - - - - - -
-eCos Support for Developing USB-ethernet Peripherals
eCos Support for Developing USB-ethernet Peripherals
- -Prev -Prev - - -Next -
-
Next
-

- -Introduction -

-
- - -

-Name

-Introduction -- eCos support for developing USB ethernet peripherals
-
- - -

-Introduction

-

-The eCos USB-ethernet package provides additional support for USB +WIDTH="100%">

Introduction

Name

Introduction -- eCos support for developing USB ethernet peripherals

Introduction

The eCos USB-ethernet package provides additional support for USB peripherals that involve some sort of ethernet-style network. This can be a traditional ethernet, or it can involve some other networking technology that uses ethernet frames as a unit of transfer. It provides functions to transfer ethernet frames over the USB bus, handles certain control messages from the host, and optionally it can provide a network device driver for use by the eCos TCP/IP stack. -The package comes with an example host-side device driver.

-

-The USB-ethernet package is not tied to any specific hardware. It +The package comes with an example host-side device driver.

The USB-ethernet package is not tied to any specific hardware. It requires the presence of USB hardware and a suitable device driver, but not all USB peripherals involve ethernet communications. Hence the configuration system cannot load the package automatically for specific targets, in the way that a USB device driver or an ethernet driver can be loaded automatically. Instead, the package has to be added explicitly. When using the command line tools this will involve -an operation like the following:

-
- - - -
-
-$ ecosconfig add usbs_eth
-
-

-Typically, this will automatically cause the USB device driver to +WIDTH="100%" +>

$ ecosconfig add usbs_eth

Typically, this will automatically cause the USB device driver to become active. Loading the USB-ethernet package automatically provides functionality for -initialization -, +HREF="usbseth-init.html" +>initialization, -data transfer -, and the handling of +HREF="usbseth-data.html" +>data transfer, and the handling of -control messages - and state +HREF="usbseth-control.html" +>control messages and state changes. If the current configuration includes the eCos TCP/IP stack then the -network device driver - +HREF="usbseth-netdev.html" +>network device driver support will be enabled as well by default, allowing the stack to -exchange ethernet frames over the USB bus.

-

-There is a USB standard for a class of communication devices including +exchange ethernet frames over the USB bus.

There is a USB standard for a class of communication devices including ethernet. The package does not implement this standard, due to limitations in the hardware for which the package was first developed. Instead, the package uses its own -protocol - between USB +HREF="usbseth-protocol.html" +>protocol between USB -host device driver - and the -peripheral.

-
-
- - -

-Usage Scenarios

-

-The USB-ethernet package can be used several different scenarios. In +HREF="usbseth-host.html" +>host device driver and the +peripheral.

Usage Scenarios

The USB-ethernet package can be used several different scenarios. In a simple scenario, the peripheral serves only to connect the USB host -to a suitable network:

-
-

-

-
-

- - -

-
-

-

-
-

-After initialization, and once the USB connection between host and +to a suitable network:

After initialization, and once the USB connection between host and peripheral has been established, higher-level code needs to detect packets that are intended for the host, and to forward these. This can be achieved by the low-level -usbs_eth_start_tx - +CLASS="FUNCTION" +>usbs_eth_start_tx function. Similarly, higher-level code needs to detect packets coming from the host, using -usbs_eth_start_rx -, and to +CLASS="FUNCTION" +>usbs_eth_start_rx, and to forward these using the real network. As far as the host is concerned it is connected directly to the network. In this scenario there is no confusion about addresses: there is a single MAC address for the host/peripheral combination, corresponding to the connection to the real network, and it is this address which should be supplied during -initialization -.

-

-In a more complicated scenario, there is a TCP/IP stack running inside -the peripheral.

-
-

-

-
-

- - -

-
-

-

-
-

-This involves the USB-ethernet package providing a service both to the +HREF="usbseth-init.html" +>initialization.

In a more complicated scenario, there is a TCP/IP stack running inside +the peripheral.

This involves the USB-ethernet package providing a service both to the host and to the eCos TCP/IP stack. It achieves the latter by acting as an eCos network device. Typically, the TCP/IP stack will be configured to act as a network bridge. The USB peripheral needs to examine the @@ -239,68 +246,69 @@ stack inside the peripheral. Packets gen TCP/IP stack may need to be sent via the real network or over the USB bus. The network bridge software will have to take care of all these possibilities. Unusually for a network bridge, one of the network -segments being bridged will only ever have one machine attached.

-

-There are other possible usage scenarios. For example, the peripheral +segments being bridged will only ever have one machine attached.

There are other possible usage scenarios. For example, the peripheral might not be attached to a real network at all. Instead it could be the USB host that acts as a network bridge, allowing a TCP/IP stack inside the peripheral to communicate with the outside world. The various details will depend on the exact type of peripheral being -developed.

-
-
-

- - - - - - - - - - -
- -Prev -Prev - -Home -Home - -Next -
Next
-eCos Support for Developing USB-ethernet PeripheralseCos Support for Developing USB-ethernet Peripherals  -Initializing the USB-ethernet Package
-
- - +VALIGN="top" +>Initializing the USB-ethernet Package \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth-netdev.html b/packages/io/usb/eth/slave/current/doc/usbseth-netdev.html --- a/packages/io/usb/eth/slave/current/doc/usbseth-netdev.html +++ b/packages/io/usb/eth/slave/current/doc/usbseth-netdev.html @@ -2,20 +2,21 @@ - + - - - - -Network Device for the eCos TCP/IP Stack - +Network Device for the eCos TCP/IP Stack - -
-
- - - - - - - - -
-eCos Support for Developing USB-ethernet Peripherals
eCos Support for Developing USB-ethernet Peripherals
- -Prev -Prev - - -Next -
-
Next
-

- -Network Device for the eCos TCP/IP Stack -

-
- - -

-Name

-Network Device -- USB-ethernet support for the eCos TCP/IP Stack
-
- - -

-Description

-

-If the USB peripheral involves running the eCos TCP/IP stack and that +WIDTH="100%">

Network Device for the eCos TCP/IP Stack

Name

Network Device -- USB-ethernet support for the eCos TCP/IP Stack

Description

If the USB peripheral involves running the eCos TCP/IP stack and that stack needs to use USB-ethernet as a transport layer (or as one of the transports), then the USB-ethernet package can provide a suitable network device driver. It is still necessary for higher-level code to perform appropriate initialization by calling - -usbs_eth_init - -, but +HREF="usbseth-init.html" +>usbs_eth_init, but after that it will be the TCP/IP stack rather than application code -that transmits or receives ethernet frames.

-

-Not all peripherals involving the USB-ethernet package will require a +that transmits or receives ethernet frames.

Not all peripherals involving the USB-ethernet package will require a TCP/IP stack. Hence the provision of the network device is controlled by a configuration option -CYGPKG_USBS_ETHDRV -. By +CLASS="LITERAL" +>CYGPKG_USBS_ETHDRV. By default this will be enabled if the TCP/IP package -CYGPKG_NET - is loaded, and disabled otherwise.

-

-There are a number of other configuration options related to the +CLASS="LITERAL" +>CYGPKG_NET is loaded, and disabled otherwise.

There are a number of other configuration options related to the network device. -CYGFUN_USBS_ETHDRV_STATISTICS - +CLASS="LITERAL" +>CYGFUN_USBS_ETHDRV_STATISTICS determines whether or not the package will maintain statistics, mainly intended for SNMP: by default this will be enabled if the SNMP support package -CYGPKG_SNMPAGENT - is loaded, and disabled +CLASS="LITERAL" +>CYGPKG_SNMPAGENT is loaded, and disabled otherwise. The name of the ethernet device is controlled by -CYGDATA_USBS_ETHDRV_NAME -, and has a default value -of -eth0 -. If there are other network device drivers -present in the configuration then it is the responsibility of the -application developer to give each device a unique name.

-
-
-
CYGDATA_USBS_ETHDRV_NAME, and has a default value +of either eth0 or eth1 +depending on whether or not there is another network device driver +present in the configuration.

Usually eCos network device drivers default to using DHCP for +obtaining necessary information such as IP addresses. This is not +appropriate for USB-ethernet devices. On the host-side the +USB-ethernet network device will not exist until the USB peripheral +has been plugged in and communication has been established. Therefore +any DHCP daemon on the host would not be listening on that network +device at the point that eCos requests its IP and other information. A +related issue is that the use of DHCP would imply the presence of a +DHCP daemon on every affected host machine, as opposed to a single +daemon (plus backups) for the network as a whole. For these reasons +the USB-ethernet package precludes the use of DHCP as a way of setting +the IP address, instead requiring alternatives such as manual +configuration.


- - - - - - - - - - -
- -Prev -Prev - -Home -Home - -Next -
Next
-USB-ethernet State HandlingUSB-ethernet State Handling  -Example Host-side Device Driver
-
- - +VALIGN="top" +>Example Host-side Device Driver \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth-protocol.html b/packages/io/usb/eth/slave/current/doc/usbseth-protocol.html --- a/packages/io/usb/eth/slave/current/doc/usbseth-protocol.html +++ b/packages/io/usb/eth/slave/current/doc/usbseth-protocol.html @@ -2,100 +2,101 @@ - + - - - - -Communication Protocol - +Communication Protocol - -
-
- - - - - - - - -
-eCos Support for Developing USB-ethernet Peripherals
eCos Support for Developing USB-ethernet Peripherals
- -Prev -Prev -
-
 
-

- -Communication Protocol -

-
- - -

-Name

-Communication Protocol -- Protocol used between the host-side device driver and the eCos -USB-ethernet package
-
- - -

-Description

-

-There is a USB standard for the protocol to be used between the host +WIDTH="100%">

Communication Protocol

Name

Communication Protocol -- Protocol used between the host-side device driver and the eCos +USB-ethernet package

Description

There is a USB standard for the protocol to be used between the host and a class of communication devices, including ethernet. However, the eCos USB-ethernet package does not implement this protocol: the target hardware for which the package was first developed had certain limitations, and could not implement the standard. Instead, the package -implements a simple new protocol.

-

-A USB-ethernet peripheral involves bulk transfers on two endpoints: +implements a simple new protocol.

A USB-ethernet peripheral involves bulk transfers on two endpoints: one endpoint will be used for packets from host to peripheral and the other will be used for the opposite direction. Transfers in both directions are variable length, with a lower limit of 16 bytes and an @@ -105,163 +106,164 @@ the normal header for an ethernet frame: source MAC address, and a protocol field. The remaining data, up to 1500 bytes, are the payload. The first two bytes give the size of the ethernet frame, least significant byte first, with a value between 14 -and 1514.

-

-For example an ARP request from host to peripheral involves an +and 1514.

For example an ARP request from host to peripheral involves an ethernet frame of 42 bytes (0x002A), with the usual 14-byte header and a 28-byte payload. The destination is the broadcast address 0xFFFFFFFFFFFF. The source depends on the MAC address specified for the host in the call to - -usbs_eth_init - -, e.g. +HREF="usbseth-init.html" +>usbs_eth_init, e.g. 0x405D90A9BC02. The remaining data is as specified by the appropriate -IETF RFC's -. The actual bulk -USB transfer involves the following sequence of 44 bytes:

-IETF RFC's. The actual bulk +USB transfer involves the following sequence of 44 bytes:

- - - -
-
-2a 00 ff ff ff ff ff ff 40 5d 90 a9 bc 02 08 06
+WIDTH="100%"
+>
2a 00 ff ff ff ff ff ff 40 5d 90 a9 bc 02 08 06
 00 01 08 00 06 04 00 01 40 5d 90 a9 bc 02 0a 00
-00 01 00 00 00 00 00 00 0a 00 00 02
-
-

-In addition there are two control messages. These will be sent by the +00 01 00 00 00 00 00 00 0a 00 00 02

In addition there are two control messages. These will be sent by the host to endpoint 0, the control endpoint, and by default they will be handled by - -usbs_eth_class_control_handler - -. If class-specific +HREF="usbseth-control.html" +>usbs_eth_class_control_handler. If class-specific control messages are intercepted by other code then it is the responsibility of that code to invoke the USB-ethernet handler when -appropriate.

-

-The first control message can be used by the host to obtain a MAC -address:

-

The first control message can be used by the host to obtain a MAC +address:

- - - -
-
-#define ECOS_USBETH_CONTROL_GET_MAC_ADDRESS         0x01
-
-

-The control message's type field should specify IN as the direction. +WIDTH="100%" +>

#define ECOS_USBETH_CONTROL_GET_MAC_ADDRESS         0x01

The control message's type field should specify IN as the direction. The request field should be -0x01 -. The length fields +CLASS="LITERAL" +>0x01. The length fields should specify a size of 6 bytes. The remaining fields of the control message will be ignored by the USB-ethernet package. The response consists of the 6-byte MAC address supplied by the initialization call - -usbs_eth_init - -.

-

-The second control message can be used by the host to enable or -disable promiscuous mode.

-usbs_eth_init.

The second control message can be used by the host to enable or +disable promiscuous mode.

- - - -
-
-#define ECOS_USBETH_CONTROL_SET_PROMISCUOUS_MODE    0x02
-
-

-This control message involves no further data so the length field +WIDTH="100%" +>

#define ECOS_USBETH_CONTROL_SET_PROMISCUOUS_MODE    0x02

This control message involves no further data so the length field should be set to 0. The value field should be non-zero to enable promiscuous mode, zero to disable it. The request field should be -0x02 -. The remaining fields in the control message +CLASS="LITERAL" +>0x02. The remaining fields in the control message will be ignored. It is the responsibility of the host-side device driver to keep track of whether or not promiscuous mode is currently enabled. It will be disabled when the peripheral changes to Configured state, typically at the point where the host-side device -driver has been activated.

-
-
-

- - - - - - - - - - -
- -Prev -Prev - -Home -Home
 
-Example Host-side Device DriverExample Host-side Device Driver 
-
- - +VALIGN="top" +>  \ No newline at end of file diff --git a/packages/io/usb/eth/slave/current/doc/usbseth.sgml b/packages/io/usb/eth/slave/current/doc/usbseth.sgml --- a/packages/io/usb/eth/slave/current/doc/usbseth.sgml +++ b/packages/io/usb/eth/slave/current/doc/usbseth.sgml @@ -585,9 +585,24 @@ intended for SNMP: by default this will package CYGPKG_SNMPAGENT is loaded, and disabled otherwise. The name of the ethernet device is controlled by CYGDATA_USBS_ETHDRV_NAME, and has a default value -of eth0. If there are other network device drivers -present in the configuration then it is the responsibility of the -application developer to give each device a unique name. +of either eth0 or eth1 +depending on whether or not there is another network device driver +present in the configuration. + + +Usually eCos network device drivers default to using DHCP for +obtaining necessary information such as IP addresses. This is not +appropriate for USB-ethernet devices. On the host-side the +USB-ethernet network device will not exist until the USB peripheral +has been plugged in and communication has been established. Therefore +any DHCP daemon on the host would not be listening on that network +device at the point that eCos requests its IP and other information. A +related issue is that the use of DHCP would imply the presence of a +DHCP daemon on every affected host machine, as opposed to a single +daemon (plus backups) for the network as a whole. For these reasons +the USB-ethernet package precludes the use of DHCP as a way of setting +the IP address, instead requiring alternatives such as manual +configuration. diff --git a/packages/kernel/current/ChangeLog b/packages/kernel/current/ChangeLog --- a/packages/kernel/current/ChangeLog +++ b/packages/kernel/current/ChangeLog @@ -1,3 +1,8 @@ +2001-07-09 Jonathan Larmour + + * include/sched.inl (unlock_reschedule): Fix commenting. + * src/sched/sched.cxx: Improve description of unlock_inner(). + 2001-06-21 Jonathan Larmour * src/common/thread.cxx (Cyg_Thread::Cyg_Thread): Initialize diff --git a/packages/kernel/current/include/sched.inl b/packages/kernel/current/include/sched.inl --- a/packages/kernel/current/include/sched.inl +++ b/packages/kernel/current/include/sched.inl @@ -112,8 +112,8 @@ inline void Cyg_Scheduler:: unlock_resch // This function decrements the scheduler lock and also looks for // a reschedule opportunity. When the lock is being decremented // from 1 to zero this function is equivalent to unlock. When the - // lock is being decremented to a non-zero value, it is equivalent - // to unlock() followed by reschedule(). + // lock is being decremented to a non-zero value, it is more or less + // equivalent to reschedule() followed by unlock(). CYG_INSTRUMENT_SCHED(UNLOCK,sched_lock,0); diff --git a/packages/kernel/current/src/sched/sched.cxx b/packages/kernel/current/src/sched/sched.cxx --- a/packages/kernel/current/src/sched/sched.cxx +++ b/packages/kernel/current/src/sched/sched.cxx @@ -93,17 +93,26 @@ cyg_ucount32 Cyg_Scheduler_Base // ------------------------------------------------------------------------- // Scheduler unlock function. -// This is only called when the lock is to be zeroed and there is the -// potential for real work to be done. Other cases are handled in -// Cyg_Scheduler::unlock() which is an inline. The new_lock argument -// contains the value that the scheduler lock should have after this -// function has completed. If it is zero then the lock is being -// released and some extra work (running ASRs, checking for DSRs) is +// This is only called when there is the potential for real work to be +// done. Other cases are handled in Cyg_Scheduler::unlock() which is +// an inline; _or_ this function may have been called from +// Cyg_Scheduler::reschedule(), or Cyg_Scheduler::unlock_reschedule. The +// new_lock argument contains the value that the scheduler lock should +// have after this function has completed. If it is zero then the lock is +// being released and some extra work (running ASRs, checking for DSRs) is // done before returning. If it is non-zero then it must equal the // current value of the lock, and is used to indicate that we want to // reacquire the scheduler lock before returning. This latter option // only makes any sense if the current thread is no longer runnable, -// otherwise this function will do nothing. +// e.g. sleeping, otherwise this function will do nothing. +// This approach of passing in the lock value at the end effectively +// makes the scheduler lock a form of per-thread variable. Each call +// to unlock_inner() carries with it the value the scheduler should +// have when it reschedules this thread back, and leaves this function. +// When it is non-zero, and the thread is rescheduled, no ASRS are run, +// or DSRs processed. By doing this, it makes it possible for threads +// that want to go to sleep to wake up with the scheduler lock in the +// same state it was in before. void Cyg_Scheduler::unlock_inner( cyg_ucount32 new_lock ) { diff --git a/packages/language/c/libc/stdio/current/ChangeLog b/packages/language/c/libc/stdio/current/ChangeLog --- a/packages/language/c/libc/stdio/current/ChangeLog +++ b/packages/language/c/libc/stdio/current/ChangeLog @@ -1,3 +1,10 @@ +2001-07-12 Jonathan Larmour + + * src/common/fflush.cxx (cyg_libc_stdio_flush_all_but): Don't + flush a stream that was last used for reading - it doesn't need it. + * include/stream.hxx: cyg_libc_stdio_flush_all_but needs to be a + friend of class Cyg_StdioStream to do the above. + 2001-06-18 Jonathan Larmour * src/input/fread.cxx (fread): Fix compilation problem with below diff --git a/packages/language/c/libc/stdio/current/include/stream.hxx b/packages/language/c/libc/stdio/current/include/stream.hxx --- a/packages/language/c/libc/stdio/current/include/stream.hxx +++ b/packages/language/c/libc/stdio/current/include/stream.hxx @@ -64,9 +64,15 @@ // TYPE DEFINITIONS +class Cyg_StdioStream; +__externC Cyg_ErrNo +cyg_libc_stdio_flush_all_but( Cyg_StdioStream * ); + class Cyg_StdioStream { friend int setvbuf( FILE *, char *, int, size_t ); + friend Cyg_ErrNo + cyg_libc_stdio_flush_all_but( Cyg_StdioStream * ); private: diff --git a/packages/language/c/libc/stdio/current/src/common/fflush.cxx b/packages/language/c/libc/stdio/current/src/common/fflush.cxx --- a/packages/language/c/libc/stdio/current/src/common/fflush.cxx +++ b/packages/language/c/libc/stdio/current/src/common/fflush.cxx @@ -86,14 +86,16 @@ cyg_libc_stdio_flush_all_but( Cyg_StdioS } // if else { // valid stream - - if ( stream->trylock_me() ) { - err = stream->flush_output_unlocked(); - stream->unlock_me(); - files_flushed[i] = true; - } // if - else - loop_again = true; + // only buffers which we've written to need flushing + if ( !stream->flags.last_buffer_op_was_read) { + if ( stream->trylock_me() ) { + err = stream->flush_output_unlocked(); + stream->unlock_me(); + files_flushed[i] = true; + } // if + else + loop_again = true; + } } // else } // if } // for diff --git a/packages/pkgconf/fixhtml.tcl b/packages/pkgconf/fixhtml.tcl --- a/packages/pkgconf/fixhtml.tcl +++ b/packages/pkgconf/fixhtml.tcl @@ -68,11 +68,6 @@ set copyright_banner \ " -# The generated files all have a .htm suffix rather than a .html -# suffix. For now this is preserved, to avoid having to change all the -# anchors. It might be better to rename all the files to .html in -# future, and perhaps also to change book1.htm to index.htm - set files [glob *.html] foreach file $files { set status [catch { @@ -84,7 +79,6 @@ foreach file $files { # If there is already a (C) message on the first line, skip this file. if {[regexp {[^\n]*Copyright (C) [0-9]* Red Hat.*} $data] == 0} { - # The DSSSL has the annoying habit of splitting tags over several lines. # This should sort things out. # REMOVED by jifl: doing this can add newlines in tags like @@ -94,6 +88,13 @@ foreach file $files { # Add a copyright banner set data "[set copyright_banner]\n[set data]" + # Look for a smarttags meta. If absent, insert one. There should + # already be one meta present identifying the stylesheet, so + # that identifies a sensible location for inserting another meta. + if {[regexp {MSSmartTagsPreventParsing} $data] == 0} { + regsub -nocase {\n $@ @rm $(@:.o.d=.tmp) %.o.d : %.cxx +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s/\\\\\/\\//g"` +else @mkdir -p $(dir $@) +endif $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $< @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.o.d=.tmp) %.o.d : %.S +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s/\\\\\/\\//g"` +else @mkdir -p $(dir $@) +endif $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $< @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.o.d=.tmp) @@ -72,26 +85,42 @@ endif # object filenames are not prefixed # a single dependency rule is generated (file extension = ".d") %.d : %.c +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s/\\\\\/\\//g"` +else @mkdir -p $(dir $@) +endif $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $< @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.d=.tmp) %.d : %.cxx +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s/\\\\\/\\//g"` +else @mkdir -p $(dir $@) +endif $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $< @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.d=.tmp) %.d : %.S +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s/\\\\\/\\//g"` +else @mkdir -p $(dir $@) +endif $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $< @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.d=.tmp) # rule to generate a test executable from object code $(PREFIX)/tests/$(PACKAGE)/%$(EXEEXT): %.d $(wildcard $(PREFIX)/lib/target.ld) $(wildcard $(PREFIX)/lib/*.[ao]) +ifeq ($(HOST),CYGWIN) + @mkdir -p `cygpath -w "$(dir $@)" | sed "s/\\\\\/\\//g"` +else @mkdir -p $(dir $@) +endif ifneq ($(IGNORE_LINK_ERRORS),) -$(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o) else diff --git a/packages/redboot/current/ChangeLog b/packages/redboot/current/ChangeLog --- a/packages/redboot/current/ChangeLog +++ b/packages/redboot/current/ChangeLog @@ -1,3 +1,18 @@ +2001-07-16 Gary Thomas + + * src/main.c (do_version): Use external function _flash_info() to + display information about installed FLASH. + + * src/load.c (load_srec_image): Remove extra '\n' on out of range msg. + + * src/flash.c (_flash_info): New function - displays information + about FLASH found in system. Used by 'version' command. + +2001-07-12 Gary Thomas +2001-07-12 Fabrice Gautier + + * cdl/redboot.cdl: Improve some descriptions of options. + 2001-07-02 Jesper Skov * src/io.c (do_channel): Fox build for !CYGPKG_REDBOOT_ANY_CONSOLE diff --git a/packages/redboot/current/cdl/redboot.cdl b/packages/redboot/current/cdl/redboot.cdl --- a/packages/redboot/current/cdl/redboot.cdl +++ b/packages/redboot/current/cdl/redboot.cdl @@ -69,7 +69,13 @@ cdl_package CYGPKG_REDBOOT { requires CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT cdl_option CYGBLD_BUILD_REDBOOT_WITH_THREADS { + display "Threads debugging support" no_define + description " + Enabling this option will include special code in the GDB stubs to + support debugging of threaded programs. In the case of eCos programs, + this support allows GDB to have complete access to the eCos threads + in the program." active_if { CYG_HAL_STARTUP != "RAM" } requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT } @@ -94,7 +100,7 @@ cdl_package CYGPKG_REDBOOT { } cdl_component CYGPKG_REDBOOT_NETWORKING { - display "Build Redboot ROM binary image" + display "Redboot Networking" flavor bool active_if CYGPKG_IO_ETH_DRIVERS default_value 1 @@ -441,10 +447,14 @@ cdl_package CYGPKG_REDBOOT { } cdl_option CYGPRI_REDBOOT_ROM_MONITOR { + display "Behave like a ROM monitor" active_if { CYG_HAL_STARTUP == "ROM" } requires CYGSEM_HAL_ROM_MONITOR calculated 1 no_define + description " + Enabling this option will allow RedBoot to provide ROM monitor-style + services to programs which it executes." } cdl_option CYGSEM_REDBOOT_BSP_SYSCALLS { diff --git a/packages/redboot/current/src/flash.c b/packages/redboot/current/src/flash.c --- a/packages/redboot/current/src/flash.c +++ b/packages/redboot/current/src/flash.c @@ -1004,14 +1004,23 @@ fis_unlock(int argc, char *argv[]) } #endif +static int __flash_init = 0; + +void +_flash_info(void) +{ + if (!__flash_init) return; + printf("FLASH: %p - %p, %d blocks of %p bytes each.\n", + flash_start, flash_end, blocks, (void *)block_size); +} + static bool do_flash_init(void) { int stat; - static int init = 0; - if (!init) { - init = 1; + if (!__flash_init) { + __flash_init = 1; if ((stat = flash_init((void *)(workspace_end-FLASH_MIN_WORKSPACE), FLASH_MIN_WORKSPACE, printf)) != 0) { printf("FLASH: driver init failed!, status: 0x%x\n", stat); @@ -1019,10 +1028,9 @@ do_flash_init(void) } flash_get_limits((void *)0, (void **)&flash_start, (void **)&flash_end); flash_get_block_info(&block_size, &blocks); - printf("FLASH: %p - %p, %d blocks of %p bytes each.\n", - flash_start, flash_end, blocks, (void *)block_size); fis_work_block = (unsigned char *)(workspace_end-FLASH_MIN_WORKSPACE-block_size); workspace_end = fis_work_block; + _flash_info(); } return true; } diff --git a/packages/redboot/current/src/load.c b/packages/redboot/current/src/load.c --- a/packages/redboot/current/src/load.c +++ b/packages/redboot/current/src/load.c @@ -160,7 +160,7 @@ load_srec_image(int (*getc)(void), unsig } if ((addr < user_ram_start) || (addr > user_ram_end)) { if (!verify_action("Attempt to load S-record data to address: %p\n" - "RedBoot does not believe this is in RAM\n", (void*)addr)) + "RedBoot does not believe this is in RAM", (void*)addr)) return 0; } count -= ((type-'1'+2)+1); diff --git a/packages/redboot/current/src/main.c b/packages/redboot/current/src/main.c --- a/packages/redboot/current/src/main.c +++ b/packages/redboot/current/src/main.c @@ -140,6 +140,10 @@ void do_version(int argc, char *argv[]) { extern char RedBoot_version[]; +#ifdef CYGPKG_IO_FLASH + externC void _flash_info(void); +#endif + printf(RedBoot_version); #ifdef HAL_PLATFORM_CPU printf("Platform: %s (%s) %s\n", HAL_PLATFORM_BOARD, HAL_PLATFORM_CPU, HAL_PLATFORM_EXTRA); @@ -148,6 +152,9 @@ do_version(int argc, char *argv[]) printf("RAM: %p-%p, %p-%p available\n", (void*)ram_start, (void*)ram_end, (void*)user_ram_start, (void *)user_ram_end); +#ifdef CYGPKG_IO_FLASH + _flash_info(); +#endif } void diff --git a/packages/services/memalloc/common/current/ChangeLog b/packages/services/memalloc/common/current/ChangeLog --- a/packages/services/memalloc/common/current/ChangeLog +++ b/packages/services/memalloc/common/current/ChangeLog @@ -1,3 +1,10 @@ +2001-07-12 Jonathan Larmour + + * tests/malloc1.c (main): Accoutn for allocators that do allocate + space for allocs of 0. + Test that allocating all space works. + * src/dlmalloc.cxx (get_status): Correct again calculation of maxfree + 2001-06-28 Jonathan Larmour * include/memjoin.inl (~Cyg_Mempool_Joined): free even when asserts diff --git a/packages/services/memalloc/common/current/src/dlmalloc.cxx b/packages/services/memalloc/common/current/src/dlmalloc.cxx --- a/packages/services/memalloc/common/current/src/dlmalloc.cxx +++ b/packages/services/memalloc/common/current/src/dlmalloc.cxx @@ -206,6 +206,7 @@ #include // assertions #include // for size_t #include +//#include /* Debugging: @@ -1255,6 +1256,8 @@ Cyg_Mempool_dlmalloc_Implementation::try remainder_size = long_sub_size_t(chunksize(top), nb); if (chunksize(top) < nb || remainder_size < (long)MINSIZE) { + //diag_printf("chunksize(top)=%ld, nb=%d, remainder=%ld\n", chunksize(top), + // nb, remainder_size); MALLOC_UNLOCK; return NULL; /* propagate failure */ } @@ -1619,9 +1622,15 @@ Cyg_Mempool_dlmalloc_Implementation::get status.totalallocated = arenasize - avail; // as quick or quicker to just set most of these, rather than // test flag first - status.totalfree = avail - (2*SIZE_SZ) - MINSIZE; + status.totalfree = (avail & ~(MALLOC_ALIGN_MASK)) - SIZE_SZ - MINSIZE; + CYG_ASSERT( ((avail + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK) + >= MINSIZE, "free mem negative!" ); status.freeblocks = navail; - status.maxfree = maxfree - (2*SIZE_SZ) - MINSIZE; + status.maxfree = (maxfree & ~(MALLOC_ALIGN_MASK)) - SIZE_SZ - MINSIZE; + //diag_printf("raw mf: %d, ret mf: %d\n", maxfree, status.maxfree); + CYG_ASSERT( ((maxfree + SIZE_SZ + MALLOC_ALIGN_MASK) & + ~MALLOC_ALIGN_MASK) >= MINSIZE, + "max free block size negative!" ); } // if // as quick or quicker to just set most of these, rather than diff --git a/packages/services/memalloc/common/current/tests/malloc1.c b/packages/services/memalloc/common/current/tests/malloc1.c --- a/packages/services/memalloc/common/current/tests/malloc1.c +++ b/packages/services/memalloc/common/current/tests/malloc1.c @@ -193,10 +193,12 @@ main( int argc, char *argv[] ) free(str); } // else - // Test 4 +#if defined(CYGIMP_MEMALLOC_MALLOC_VARIABLE_SIMPLE) && \ + defined(CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE) + poolmax = mallinfo().maxfree; // recalculate for non-coalescing allocator +#endif str=(char *)malloc( poolmax+1 ); - CYG_TEST_PASS_FAIL( str==NULL, "malloc too much data returns NULL" ); // Test 5 @@ -204,10 +206,10 @@ main( int argc, char *argv[] ) CYG_TEST_PASS_FAIL( str==NULL, "calloc too much data returns NULL" ); // Test 6 - str=(char *)malloc(0); - str=(char *)calloc(0, 1); - str=(char *)calloc(1, 0); - str=(char *)calloc(0, 0); + str=(char *)malloc(0); if (str != NULL) free(str); + str=(char *)calloc(0, 1); if (str != NULL) free(str); + str=(char *)calloc(1, 0); if (str != NULL) free(str); + str=(char *)calloc(0, 0); if (str != NULL) free(str); // simply shouldn't barf by this point CYG_TEST_PASS_FAIL( 1, "malloc and calloc of 0 bytes doesn't crash" ); @@ -239,6 +241,16 @@ main( int argc, char *argv[] ) free(str); free(str2); + // Test 9 + +#if defined(CYGIMP_MEMALLOC_MALLOC_VARIABLE_SIMPLE) && \ + defined(CYGSEM_MEMALLOC_ALLOCATOR_VARIABLE_COALESCE) + poolmax = mallinfo().maxfree; // recalculate for non-coalescing allocator +#endif + str = (char *)malloc( poolmax ); + CYG_TEST_PASS_FAIL( str != NULL, "malloc of maximum free block size works"); + free(str); + CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library " "malloc(), calloc() and free() functions");