# HG changeset patch # User jlarmour # Date 993233924 0 # Node ID 0d2b193a635ffbc196a8587d8781ddf5148d8839 # Parent 2395031e7a66778d19f839d678643834ed083e86 Merge from eCos master repository on 2001-06-22-17:38:39-BST diff --git a/host/ChangeLog b/host/ChangeLog --- a/host/ChangeLog +++ b/host/ChangeLog @@ -1,3 +1,8 @@ +2001-06-18 Julian Smart + + * Added possible fix for Tcl crash bug under Windows 9x, by + using the wxWindows Mkdir function instead of Tcl's mkdir. + 2001-06-04 Julian Smart * Changed cygpath in build.cxx to use /cygdrive notation, diff --git a/host/libcdl/ChangeLog b/host/libcdl/ChangeLog --- a/host/libcdl/ChangeLog +++ b/host/libcdl/ChangeLog @@ -1,3 +1,36 @@ +2001-06-21 Bart Veer + + + * base.cxx, cdlcore.hxx, property.cxx, parse.cxx, value.cxx, refer.cxx: + Allow an empty string to be used for parent properties, implying + reparenting below the root + + * expr.cxx, cdlcore.hxx, infer.cxx: + Add support for new operators implies, xor and eqv + + * func.cxx: + Add new function is_xsubstr(), is_loaded(), is_active(), + is_enabled(), get_data() and version_cmp() + + * doc/main.sgml: + Add 2001 to copyright year. + + * doc/language.sgml, doc/reference.sgml: + Document the above changes + + * doc/*.html: + Regenerate following above changes, and using newer stylesheets + etc. + +2001-06-20 Bart Veer + + * database.cxx, cdl.hxx: + + Add a verbosity flag to control whether or not certain warnings + are issued. The main warnings of interest are inconsistencies + between the database and the repository, e.g. packages listed + but not actually installed, as can happen in anoncvs checkouts. + 2001-05-16 Bart Veer * Makefile.am: use new compiler flag support diff --git a/host/libcdl/base.cxx b/host/libcdl/base.cxx --- a/host/libcdl/base.cxx +++ b/host/libcdl/base.cxx @@ -485,9 +485,14 @@ CdlNodeBody::is_active(CdlTransaction tr CYG_REPORT_FUNCNAMETYPE("CdlNode::is_active", "result %d"); CYG_REPORT_FUNCARG2XV(this, transaction); CYG_PRECONDITION_THISC(); - CYG_PRECONDITION_CLASSC(transaction); - - bool result = transaction->is_active(this); + CYG_PRECONDITION_ZERO_OR_CLASSC(transaction); + + bool result; + if (0 != transaction) { + result = transaction->is_active(this); + } else { + result = active; + } CYG_REPORT_RETVAL(result); return result; } @@ -3598,16 +3603,35 @@ CdlParentableBody::update_handler(CdlTra } // Now either dest is valid or it is not. If it is then we need to - // reparent below the destination. Otherwise we need to reparent - // below the orphans container. There are also a few nasty special - // cases to consider. - + // reparent below the destination. Otherwise if the specified + // parent is "" then we need to reparent below the root. Otherwise + // the node ends up in the orphans container. There are a few + // nasty special cases to consider like reparenting below + // something that is not a container. if (0 == dest) { - // Orphan the node. It still has a parent, either as a - // consequence of the loading process or because of a previous - // binding operation. CdlToplevel toplevel = source->get_toplevel(); - toplevel->change_parent(source->get_owner(), source->get_parent(), 0, source); + + CdlProperty_Reference refprop = dynamic_cast(prop); + if ("" == refprop->get_destination_name()) { + dest = toplevel; + // Now to find the correct insertion point. Nodes which should be + // reparented below the root should come first, ahead of any nodes + // which are not specifically reparented. + const std::vector& contents = toplevel->get_contents(); + unsigned int index; + for (index = 0; index < contents.size(); index++) { + if (!contents[index]->has_property(CdlPropertyId_Parent)) { + break; + } + } + toplevel->change_parent(source->get_owner(), source->get_parent(), toplevel, source, index); + + } else { + // Orphan the node. It still has a parent, either as a + // consequence of the loading process or because of a previous + // binding operation. + toplevel->change_parent(source->get_owner(), source->get_parent(), 0, source); + } // The Unresolved conflict is handled by // CdlProperty_Reference::update(). The "else" code below may @@ -3674,7 +3698,7 @@ CdlParentableBody::parse_parent(CdlInter { CYG_REPORT_FUNCNAMETYPE("parse_parent", "result %d"); - int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Parent, 0, 0, &update_handler); + int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Parent, 0, 0, true, &update_handler); CYG_REPORT_RETVAL(result); return result; diff --git a/host/libcdl/cdl.dsp b/host/libcdl/cdl.dsp --- a/host/libcdl/cdl.dsp +++ b/host/libcdl/cdl.dsp @@ -163,7 +163,7 @@ OutDir=v:\cdl\Debug InputPath=.\ChangeLog BuildCmds= \ - if not exist $(IntDir)\tools\configtool\standalone\common\Makefile sh -c "ECOSHOST=`echo ""puts [ file attributes [ pwd ] -shortname ]"" | cygtclsh80`/.. ; echo ""ECOSHOST=$ECOSHOST"" ; echo ""TCLHOME=$TCLHOME"" ; mkdir -p `cygpath -u ""$(IntDir)""` ; cd `cygpath -u ""$(IntDir)""` && CC=cl CXX=cl `cygpath -u ""$ECOSHOST""`/configure --prefix=`cygpath -u ""$(OutDir)""` --with-tcl=`cygpath -u ""$TCLHOME""` --with-tcl_version=82d --enable-debug --enable-maintainer-mode" \ + if not exist $(IntDir)\tools\configtool\standalone\common\Makefile sh -c "ECOSHOST=`echo ""puts [ file attributes [ pwd ] -shortname ]"" | cygtclsh80`/.. ; echo ""ECOSHOST=$ECOSHOST"" ; echo ""TCLHOME=$TCLHOME"" ; mkdir -p `cygpath -u ""$(IntDir)""` ; cd `cygpath -u ""$(IntDir)""` && CC=cl CXX=cl `cygpath -u ""$ECOSHOST""`/configure --prefix=`cygpath -u ""$(OutDir)""` --with-tcl=`cygpath -u ""$TCLHOME""` --with-tcl_version=82 --enable-debug --enable-maintainer-mode" \ cd $(IntDir) \ v: \ make --unix install \ diff --git a/host/libcdl/cdl.hxx b/host/libcdl/cdl.hxx --- a/host/libcdl/cdl.hxx +++ b/host/libcdl/cdl.hxx @@ -13,7 +13,7 @@ //####COPYRIGHTBEGIN#### // // ---------------------------------------------------------------------------- -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. // // This file is part of the eCos host tools. // @@ -154,6 +154,9 @@ class CdlPackagesDatabaseBody { // For now the library provides a static vector of these things, but // this area is likely to change in future static const std::vector& get_valid_cflags(); + + // Control verbosity when reading in a database + static void set_verbose(bool); bool check_this(cyg_assert_class_zeal = cyg_quick) const; CYGDBG_DECLARE_MEMLEAK_COUNTER(); @@ -210,6 +213,10 @@ class CdlPackagesDatabaseBody { // This allows test cases to overwrite the name of the file // containing the database information. static char* database_name; + + // Control whether or not minor problems with the database should be + // reported. + static bool verbose_mode; // The default constructor, copy constructor and assignment operator are illegal. CdlPackagesDatabaseBody(); diff --git a/host/libcdl/cdlcore.hxx b/host/libcdl/cdlcore.hxx --- a/host/libcdl/cdlcore.hxx +++ b/host/libcdl/cdlcore.hxx @@ -1579,6 +1579,11 @@ class CdlEvalContext { CdlEvalContext(CdlTransaction, CdlNode = 0, CdlProperty = 0, CdlToplevel = 0); ~CdlEvalContext(); + + // Given a reference inside an expression, try to resolve this to either + // a node or, more specifically, a valuable. + CdlNode resolve_reference(CdlExpression, int); + CdlValuable resolve_valuable_reference(CdlExpression, int); bool check_this(cyg_assert_class_zeal = cyg_quick) const; CYGDBG_DECLARE_MEMLEAK_COUNTER(); @@ -2128,7 +2133,10 @@ enum CdlExprOp { CdlExprOp_And = 32, // x && y CdlExprOp_Or = 33, // x || y CdlExprOp_Cond = 34, // x ? a : b - CdlExprOp_StringConcat = 35 // x . y + CdlExprOp_StringConcat = 35, // x . y + CdlExprOp_Implies = 36, // x implies y + CdlExprOp_Xor = 37, // x xor y + CdlExprOp_Eqv = 38 // x eqv y }; // ---------------------------------------------------------------------------- @@ -3314,6 +3322,8 @@ class CdlParse { static int get_error_count(CdlInterpreter); static void incr_error_count(CdlInterpreter, int=1); + static std::string get_expression_error_location(void); + // Support for Tcl's "unknown" command static int unknown_command(CdlInterpreter, int, char**); @@ -3335,6 +3345,7 @@ class CdlParse { bool /* allow_empty */ = false); static int parse_reference_property(CdlInterpreter, int, char**, std::string, char**, void (*)(CdlInterpreter, CdlProperty_Reference), + bool /* allow_empty */, CdlUpdateHandler); static int parse_expression_property(CdlInterpreter, int, char**, std::string, char **, void (*)(CdlInterpreter, CdlProperty_Expression), diff --git a/host/libcdl/database.cxx b/host/libcdl/database.cxx --- a/host/libcdl/database.cxx +++ b/host/libcdl/database.cxx @@ -73,6 +73,9 @@ char* CdlPackagesDatabaseBody::database_name = "ecos.db"; +// Should warnings be issued for minor database inconsistencies? +bool CdlPackagesDatabaseBody::verbose_mode = false; + // The new_package etc. commands need to store the name of the // current package so that subsequent commands can do the right thing. // Using constant strings as the key avoids typo problems. @@ -201,16 +204,21 @@ CdlDbParser::new_package(CdlInterpreter CdlParse::report_error(interp, diag_package + pkg_name, "At least one alias should be supplied."); } - // Additional checks. Is the package directory actually present. + // Additional checks. Is the package directory actually present? + // Note that there are scenarios where a package may be listed + // in the database but not installed, e.g. an anoncvs checkout + // of selected modules. if ("" != package.directory) { std::string repo = interp->get_variable(dbparser_component_repository); CYG_ASSERTC("" != repo); std::string pkgdir = repo + "/" + package.directory; if (!interp->is_directory(pkgdir)) { - CdlParse::report_warning(interp, diag_package + pkg_name, - std::string("This package is not present in the component repository.\nThere is no directory `") - + pkgdir + "'."); + if (CdlPackagesDatabaseBody::verbose_mode) { + CdlParse::report_warning(interp, diag_package + pkg_name, + std::string("This package is not present in the component repository.\n" + "There is no directory `") + pkgdir + "'."); + } package_ok = false; } else { @@ -808,24 +816,26 @@ CdlPackagesDatabaseBody::CdlPackagesData // Consistency checks. All target-specific packages should // have the hardware attribute. Also, all the packages should - // exist. Problems only result in warnings, to allow for - // somewhat inconsistent repositories e.g. an anoncvs tree. - std::vector::const_iterator name_i; - std::vector::const_iterator name_j; - for (name_i = target_names.begin(); name_i != target_names.end(); name_i++) { - for (name_j = targets[*name_i].packages.begin(); name_j != targets[*name_i].packages.end(); name_j++) { - if (std::find(package_names.begin(), package_names.end(), *name_j) == package_names.end()) { - CdlParse::report_warning(interp, diag_target + *name_i, - std::string("This target refers to an unknown package `") + *name_j + "'."); - } - if (!packages[*name_j].hardware) { - CdlParse::report_warning(interp, diag_target + *name_i, - std::string("This target refers to a package `") + *name_j + - "' that is not hardware-specific."); + // exist. Problems only result in warnings and only when + // operating in verbose mode, to allow for somewhat + // inconsistent repositories e.g. an anoncvs tree. + if (CdlPackagesDatabaseBody::verbose_mode) { + std::vector::const_iterator name_i; + std::vector::const_iterator name_j; + for (name_i = target_names.begin(); name_i != target_names.end(); name_i++) { + for (name_j = targets[*name_i].packages.begin(); name_j != targets[*name_i].packages.end(); name_j++) { + if (std::find(package_names.begin(), package_names.end(), *name_j) == package_names.end()) { + CdlParse::report_warning(interp, diag_target + *name_i, + std::string("This target refers to an unknown package `") + *name_j + "'."); + } + if (!packages[*name_j].hardware) { + CdlParse::report_warning(interp, diag_target + *name_i, + std::string("This target refers to a package `") + *name_j + + "' that is not hardware-specific."); + } } } } - // Now, were there any errors while reading in the database? // If so it is necessary to throw an exception here, to make sure // that things get cleaned up properly. @@ -969,6 +979,17 @@ CdlPackagesDatabaseBody::get_component_r return component_repository; } +void +CdlPackagesDatabaseBody::set_verbose(bool new_mode) +{ + CYG_REPORT_FUNCNAME("CdlPackagesDatabase::set_verbose"); + CYG_REPORT_FUNCARG1XV(new_mode); + + verbose_mode = new_mode; + + CYG_REPORT_RETURN(); +} + //}}} //{{{ CdlPackagesDatabase:: get package information diff --git a/host/libcdl/expr.cxx b/host/libcdl/expr.cxx --- a/host/libcdl/expr.cxx +++ b/host/libcdl/expr.cxx @@ -130,6 +130,56 @@ CdlEvalContext::~CdlEvalContext() CYG_REPORT_RETURN(); } +// Given a context and a reference inside an expression, obtain the node +// being referenced - if it is loaded. +CdlNode +CdlEvalContext::resolve_reference(CdlExpression expr, int index) +{ + CYG_REPORT_FUNCNAMETYPE("CdlEvalContext::resolve_reference", "result %"); + CYG_REPORT_FUNCARG2XV(expr, index); + CYG_PRECONDITION_THISC(); + CYG_PRECONDITION_CLASSC(expr); + CYG_PRECONDITIONC((0 <= index) && (index <= (int)expr->references.size())); + + // This expression may be happening in the context of a particular + // property. If so then the destination may or may not be + // resolved, which will have been handled when the containing package + // was loaded. Alternatively this expression may be evaluated inside + // some arbitrary Tcl code, in which case references remain unbound + // and need to be resolved the hard way. + CdlNode result = 0; + if (0 != this->property) { + // There is a property, use the bound/unbound reference. + result = expr->references[index].get_destination(); + } else { + // The destination name can be retrieved, but we still need some + // way of resolving it. + if (0 != this->toplevel) { + std::string destination_name = expr->references[index].get_destination_name(); + result = this->toplevel->lookup(destination_name); + } + } + + CYG_REPORT_RETVAL(result); + return result; +} + +// Ditto, but also check that the result is a valuable. +CdlValuable +CdlEvalContext::resolve_valuable_reference(CdlExpression expr, int index) +{ + CYG_REPORT_FUNCNAMETYPE("CdlEvalContext::resolve_reference", "result %"); + CYG_REPORT_FUNCARG2XV(expr, index); + + CdlValuable result = 0; + CdlNode node = this->resolve_reference(expr, index); + if (0 != node) { + result = dynamic_cast(node); + } + CYG_REPORT_RETVAL(result); + return result; +} + bool CdlEvalContext::check_this(cyg_assert_class_zeal zeal) const { @@ -234,7 +284,10 @@ enum token { T_Colon = 29, // : (in a conditional) T_StringConcat = 30, // . T_Function = 31, // is_substr etc. - T_Comma = 32 // , (inside a function) + T_Comma = 32, // , (inside a function) + T_Implies = 33, // implies + T_Xor = 34, // xor + T_Eqv = 35 // eqv }; @@ -249,6 +302,7 @@ static int current_char static token current_token = T_Invalid; static std::string current_string = ""; static std::string current_reference = ""; +static std::string current_special = ""; static cdl_int current_int = 0; static double current_double = 0.0; static CdlValueFormat current_format = CdlValueFormat_Default; @@ -331,6 +385,14 @@ get_error_location() return result; } +// Export this functionality available to other modules, especially func.cxx and its +// argument checking routines. +std::string +CdlParse::get_expression_error_location(void) +{ + return get_error_location(); +} + //}}} //{{{ Token translation @@ -363,6 +425,9 @@ token_to_binary_expr_op() case T_And: result = CdlExprOp_And; break; case T_Or: result = CdlExprOp_Or; break; case T_StringConcat: result = CdlExprOp_StringConcat; break; + case T_Implies: result = CdlExprOp_Implies; break; + case T_Xor: result = CdlExprOp_Xor; break; + case T_Eqv: result = CdlExprOp_Eqv; break; default: result = CdlExprOp_Invalid; break; } @@ -459,6 +524,9 @@ token_to_string() case T_Or: result = "or operator ||"; break; case T_Colon: result = "colon"; break; case T_StringConcat: result = "string concatenation operator ."; break; + case T_Implies: result = "implies operator"; break; + case T_Xor: result = "logical xor operator"; break; + case T_Eqv: result = "logical equivalence operator eqv"; break; case T_Function: result = std::string("function call ") + CdlFunction::get_name(current_function_id); break; case T_Invalid: default: result = ""; break; @@ -788,13 +856,23 @@ process_special() if ("to" == current_reference) { current_token = T_Range; result = true; + } else if ("implies" == current_reference) { + current_token = T_Implies; + result = true; + } else if ("xor" == current_reference) { + current_token = T_Xor; + result = true; + } else if ("eqv" == current_reference) { + current_token = T_Eqv; + result = true; } else if (CdlFunction::is_function(current_reference.c_str(), current_function_id)) { - current_token = T_Function; + current_token = T_Function; result = true; } if (result) { - current_reference = ""; + current_special = current_reference; + current_reference = ""; } CYG_REPORT_RETVAL(result); return result; @@ -817,6 +895,7 @@ next_token() current_token = T_Invalid; current_string = ""; current_reference = ""; + current_special = ""; current_int = 0; current_double = 0.0; current_format = CdlValueFormat_Default; @@ -1059,17 +1138,19 @@ initialise_tokenisation(std::string data // The BNF of CDL expressions is something like this: // // ::= -// ::= ? : | -// ::= [ ] || -// ::= [ ] ?? -// ::= [ ] | -// ::= [ ] ^ -// ::= [ ] & -// ::= [ ] == != -// ::= [ ] < <= > >= -// ::= [ ] << >> -// ::= [ ] + - . -// ::= [ ] * / % +// ::= ? : | +// ::= [ ] implies +// ::= [ ] xor, eqv +// ::= [ ] || +// ::= [ ] && +// ::= [ ] | +// ::= [ ] ^ +// ::= [ ] & +// ::= [ ] == != +// ::= [ ] < <= > >= +// ::= [ ] << >> +// ::= [ ] + - . +// ::= [ ] * / % // ::= - | + | ! | * | ? | // ~ | // | | @@ -1135,7 +1216,7 @@ parse_function(CdlExpression expr) int number_of_args = CdlFunction::get_args_count(current_function_id); CYG_ASSERTC((0 < number_of_args) && (number_of_args <= CdlFunction_MaxArgs)); - std::string name = current_reference; + std::string name = current_special; // check for the opening bracket: xyzzy(arg1, arg2) next_token(); @@ -1156,6 +1237,9 @@ parse_function(CdlExpression expr) next_token(); } } + if (T_Comma == current_token) { + throw CdlParseException(std::string("Too many arguments passed to function ") + name + "\n" + get_error_location()); + } if (T_CloseBracket != current_token) { throw CdlParseException(std::string("Expected closing bracket after function ") + name + "\n" + get_error_location()); } @@ -1559,11 +1643,55 @@ parse_or(CdlExpression expr) } static void +parse_eqv(CdlExpression expr) +{ + CYG_REPORT_FUNCNAME("parse_eqv"); + + parse_or(expr); + while ((T_Xor == current_token) || (T_Eqv == current_token)) { + + CdlSubexpression subexpr; + subexpr.op = (T_Xor == current_token) ? CdlExprOp_Xor : CdlExprOp_Eqv; + subexpr.lhs_index = expr->first_subexpression; + + next_token(); + parse_or(expr); + + subexpr.rhs_index = expr->first_subexpression; + push_subexpression(expr, subexpr); + } + + CYG_REPORT_RETURN(); +} + +static void +parse_implies(CdlExpression expr) +{ + CYG_REPORT_FUNCNAME("parse_implies"); + + parse_eqv(expr); + while (T_Implies == current_token) { + + CdlSubexpression subexpr; + subexpr.op = CdlExprOp_Implies; + subexpr.lhs_index = expr->first_subexpression; + + next_token(); + parse_eqv(expr); + + subexpr.rhs_index = expr->first_subexpression; + push_subexpression(expr, subexpr); + } + + CYG_REPORT_RETURN(); +} + +static void parse_conditional(CdlExpression expr) { CYG_REPORT_FUNCNAME("parse_conditional"); - parse_or(expr); + parse_implies(expr); if (T_Questionmark == current_token) { CdlSubexpression subexpr; subexpr.op = CdlExprOp_Cond; @@ -2153,6 +2281,60 @@ evaluate_subexpr(CdlEvalContext& context } break; } + case CdlExprOp_Xor : + { + // x xor y. Both sides should be interpreted as boolean values. + CdlSimpleValue lhs; + CdlSimpleValue rhs; + evaluate_subexpr(context, expr, subexpr.lhs_index, lhs); + evaluate_subexpr(context, expr, subexpr.rhs_index, rhs); + + bool lhs_bool = lhs.get_bool_value(); + bool rhs_bool = rhs.get_bool_value(); + if ((lhs_bool && !rhs_bool) || (!lhs_bool && rhs_bool)) { + result = true; + } else { + result = false; + } + + break; + } + case CdlExprOp_Eqv : + { + // x eqv y. Both sides should be interpreted as boolean values. + CdlSimpleValue lhs; + CdlSimpleValue rhs; + evaluate_subexpr(context, expr, subexpr.lhs_index, lhs); + evaluate_subexpr(context, expr, subexpr.rhs_index, rhs); + + bool lhs_bool = lhs.get_bool_value(); + bool rhs_bool = rhs.get_bool_value(); + if ((!lhs_bool && !rhs_bool) || (lhs_bool && rhs_bool)) { + result = true; + } else { + result = false; + } + + break; + } + case CdlExprOp_Implies : + { + // x implies y. Both sides should be interpreted as boolean values. + CdlSimpleValue lhs; + CdlSimpleValue rhs; + evaluate_subexpr(context, expr, subexpr.lhs_index, lhs); + evaluate_subexpr(context, expr, subexpr.rhs_index, rhs); + + bool lhs_bool = lhs.get_bool_value(); + bool rhs_bool = rhs.get_bool_value(); + if (!lhs_bool || rhs_bool) { + result = true; + } else { + result = false; + } + + break; + } case CdlExprOp_Cond : { // x ? a : b. diff --git a/host/libcdl/func.cxx b/host/libcdl/func.cxx --- a/host/libcdl/func.cxx +++ b/host/libcdl/func.cxx @@ -334,6 +334,99 @@ static bool is_substr_infer_bool(CdlTransaction transaction, CdlExpression expr, unsigned int index, bool goal, int level) { CYG_REPORT_FUNCNAMETYPE("is_substr_infer_bool", "result %d"); + CYG_REPORT_FUNCARG5XV(transaction, expr, index, goal, level); + + bool result = false; + + CdlSubexpression& subexpr = expr->sub_expressions[index]; + CdlSubexpression& arg0 = expr->sub_expressions[subexpr.args[0]]; + try { + if (CdlExprOp_Reference == arg0.op) { + + CdlSimpleValue needle_value; + CdlEvalContext context(transaction); + expr->eval_subexpression(context, subexpr.args[1], needle_value); + std::string needle = needle_value.get_value(); + + CdlNode node = expr->references[arg0.reference_index].get_destination(); + CdlValuable valuable = 0; + if (0 != node) { + valuable = dynamic_cast(node); + } + if ((0 != valuable) && ((CdlValueFlavor_BoolData == valuable->get_flavor()) || + (CdlValueFlavor_Data == valuable->get_flavor()))) { + // OK, we have a valuable which can be given a suitable value. + // What is the current string? + const CdlValue& current_value = transaction->get_whole_value(valuable); + std::string haystack = current_value.get_simple_value().get_value(); + + // What is the goal? If the needle should be in the + // haystack, append it if necessary. If the needle + // should not be in the haystack, remove all current occurrences. + if (goal) { + std::string::size_type len; + if (std::string::npos == is_substr_find(haystack, needle, len)) { + haystack = haystack + needle; + } + } else { + std::string::size_type posn, len; + for (posn = is_substr_find(haystack, needle, len); + std::string::npos != posn; + posn = is_substr_find(haystack, needle, len)) { + haystack.erase(posn, len); + } + } + + // OK, we have a new value for the haystack which should match the desired goal. + // Try and set this value. + CdlSimpleValue new_value(haystack); + result = CdlInfer::set_valuable_value(transaction, valuable, new_value, level); + } + } + } catch (...) { + result = false; + } + + CYG_REPORT_RETVAL(result); + return result; +} + +static CdlFunction is_substr("is_substr", 2, CdlFunction::null_check, &is_substr_eval, + &is_substr_infer_bool, CdlFunction::null_infer_value); + +//}}} +//{{{ is_xsubstr() + +// ---------------------------------------------------------------------------- +// is_xsubstr(A, B) +// +// Like is_substr() but only deals with exact matches, i.e. there is no special +// treatment for leading and trailing spaces in the needle. + +static void +is_xsubstr_eval(CdlEvalContext& context, CdlExpression expr, const CdlSubexpression& subexpr, CdlSimpleValue& result) +{ + CYG_REPORT_FUNCNAME("is_xsubstr_eval"); + CYG_REPORT_FUNCARG4XV(&context, expr, &subexpr, &result); + CYG_PRECONDITION_CLASSOC(context); + CYG_PRECONDITION_CLASSC(expr); + + CdlSimpleValue arg0; + CdlSimpleValue arg1; + expr->eval_subexpression(context, subexpr.args[0], arg0); + expr->eval_subexpression(context, subexpr.args[1], arg1); + + result = (std::string::npos != arg0.get_value().find(arg1.get_value())); + CYG_REPORT_RETURN(); +} + +// Inference is only supported if the haystack argument is a reference that can be +// updated. The needle can be an arbitrary expression. +static bool +is_xsubstr_infer_bool(CdlTransaction transaction, CdlExpression expr, unsigned int index, bool goal, int level) +{ + CYG_REPORT_FUNCNAMETYPE("is_xsubstr_infer_bool", "result %d"); + CYG_REPORT_FUNCARG5XV(transaction, expr, index, goal, level); bool result = false; @@ -352,7 +445,8 @@ is_substr_infer_bool(CdlTransaction tran if (0 != node) { valuable = dynamic_cast(node); } - if ((0 != valuable) && ((CdlValueFlavor_BoolData == valuable->get_flavor()) || (CdlValueFlavor_Data == valuable->get_flavor()))) { + if ((0 != valuable) && ((CdlValueFlavor_BoolData == valuable->get_flavor()) || + (CdlValueFlavor_Data == valuable->get_flavor()))) { // OK, we have a valuable which can be given a suitable value. // What is the current string? const CdlValue& current_value = transaction->get_whole_value(valuable); @@ -362,14 +456,13 @@ is_substr_infer_bool(CdlTransaction tran // haystack, append it if necessary. If the needle // should not be in the haystack, remove all current occurrences. if (goal) { - std::string::size_type len; - if (std::string::npos == is_substr_find(haystack, needle, len)) { + if (std::string::npos == haystack.find(needle)) { haystack = haystack + needle; } } else { - std::string::size_type posn, len; - for (posn = is_substr_find(haystack, needle, len); std::string::npos != posn; posn = is_substr_find(haystack, needle, len)) { - haystack.erase(posn, len); + std::string::size_type posn; + for (posn = haystack.find(needle); std::string::npos != posn; posn = haystack.find(needle)) { + haystack.erase(posn, needle.length()); } } @@ -387,6 +480,351 @@ is_substr_infer_bool(CdlTransaction tran return result; } -static CdlFunction is_substr("is_substr", 2, CdlFunction::null_check, &is_substr_eval, &is_substr_infer_bool, CdlFunction::null_infer_value); +static CdlFunction is_xsubstr("is_xsubstr", 2, CdlFunction::null_check, &is_xsubstr_eval, + &is_xsubstr_infer_bool, CdlFunction::null_infer_value); + +//}}} +//{{{ is_loaded() + +// ---------------------------------------------------------------------------- +// is_loaded(x) +// Check whether or not a particular configuration option is loaded. +// This takes a single argument which must be a reference. No +// inference is possible, since loading and unloading packages is +// currently beyond the scope of the inference engine. + +static void +is_loaded_check(CdlExpression expr, const CdlSubexpression& subexpr) +{ + CYG_REPORT_FUNCNAME("is_loaded_check"); + CYG_REPORT_FUNCARG2XV(expr, &subexpr); + + CdlSubexpression& arg0 = expr->sub_expressions[subexpr.args[0]]; + if (CdlExprOp_Reference != arg0.op) { + throw CdlParseException(std::string("The argument to is_loaded() should be a reference to a configuration option.\n") + + CdlParse::get_expression_error_location()); + } + + CYG_REPORT_RETURN(); +} + +static void +is_loaded_eval(CdlEvalContext& context, CdlExpression expr, const CdlSubexpression& subexpr, CdlSimpleValue& result) +{ + CYG_REPORT_FUNCNAME("is_loaded_eval"); + CYG_REPORT_FUNCARG4XV(&context, expr, &subexpr, &result); + CYG_PRECONDITION_CLASSOC(context); + CYG_PRECONDITION_CLASSC(expr); + + CdlSubexpression arg0 = expr->sub_expressions[subexpr.args[0]]; + CYG_ASSERTC(CdlExprOp_Reference == arg0.op); + + result = (0 != context.resolve_reference(expr, arg0.reference_index)); + CYG_REPORT_RETURN(); +} + +static CdlFunction is_loaded("is_loaded", 1, &is_loaded_check, &is_loaded_eval, + CdlFunction::null_infer_bool, CdlFunction::null_infer_value); + +//}}} +//{{{ is_active() + +// ---------------------------------------------------------------------------- +// is_active(x) +// Check whether or not a particular configuration option is loaded +// and active. This takes a single argument which must be a reference. + +static void +is_active_check(CdlExpression expr, const CdlSubexpression& subexpr) +{ + CYG_REPORT_FUNCNAME("is_active_check"); + CYG_REPORT_FUNCARG2XV(expr, &subexpr); + + CdlSubexpression& arg0 = expr->sub_expressions[subexpr.args[0]]; + if (CdlExprOp_Reference != arg0.op) { + throw CdlParseException(std::string("The argument to is_active() should be a reference to a configuration option.\n") + + CdlParse::get_expression_error_location()); + } + + CYG_REPORT_RETURN(); +} + +static void +is_active_eval(CdlEvalContext& context, CdlExpression expr, const CdlSubexpression& subexpr, CdlSimpleValue& result) +{ + CYG_REPORT_FUNCNAME("is_active_eval"); + CYG_REPORT_FUNCARG4XV(&context, expr, &subexpr, &result); + CYG_PRECONDITION_CLASSOC(context); + CYG_PRECONDITION_CLASSC(expr); + + CdlSubexpression arg0 = expr->sub_expressions[subexpr.args[0]]; + CYG_ASSERTC(CdlExprOp_Reference == arg0.op); + + CdlNode node = context.resolve_reference(expr, arg0.reference_index); + if (0 != node) { + result = node->is_active(context.transaction); + } else { + result = false; + } + CYG_REPORT_RETURN(); +} + +static bool +is_active_infer_bool(CdlTransaction transaction, CdlExpression expr, unsigned int index, bool goal, int level) +{ + CYG_REPORT_FUNCNAMETYPE("is_active_infer_bool", "result %d"); + CYG_REPORT_FUNCARG5XV(transaction, expr, index, goal, level); + + bool result = false; + + CdlSubexpression subexpr = expr->sub_expressions[index]; + CdlSubexpression arg0 = expr->sub_expressions[subexpr.args[0]]; + CYG_ASSERTC(CdlExprOp_Reference == arg0.op); + + CdlNode node = expr->references[arg0.reference_index].get_destination(); + if (0 != node) { + if (goal) { + result = CdlInfer::make_active(transaction, node, level); + } else { + result = CdlInfer::make_inactive(transaction, node, level); + } + } + + CYG_REPORT_RETVAL(result); + return result; +} + +static CdlFunction is_active("is_active", 1, &is_active_check, &is_active_eval, + &is_active_infer_bool, CdlFunction::null_infer_value); //}}} +//{{{ is_enabled() + +// ---------------------------------------------------------------------------- +// is_enabled(x) +// Check whether or not a particular configuration option is loaded +// and enabled. The active/inactive state is ignored. This function +// takes a single argument which must be a reference. + +static void +is_enabled_check(CdlExpression expr, const CdlSubexpression& subexpr) +{ + CYG_REPORT_FUNCNAME("is_enabled_check"); + CYG_REPORT_FUNCARG2XV(expr, &subexpr); + + CdlSubexpression& arg0 = expr->sub_expressions[subexpr.args[0]]; + if (CdlExprOp_Reference != arg0.op) { + throw CdlParseException(std::string("The argument to is_enabled() should be a reference to a configuration option.\n") + + CdlParse::get_expression_error_location()); + } + + CYG_REPORT_RETURN(); +} + +static void +is_enabled_eval(CdlEvalContext& context, CdlExpression expr, const CdlSubexpression& subexpr, CdlSimpleValue& result) +{ + CYG_REPORT_FUNCNAME("is_enabled_eval"); + CYG_REPORT_FUNCARG4XV(&context, expr, &subexpr, &result); + CYG_PRECONDITION_CLASSOC(context); + CYG_PRECONDITION_CLASSC(expr); + + CdlSubexpression arg0 = expr->sub_expressions[subexpr.args[0]]; + CYG_ASSERTC(CdlExprOp_Reference == arg0.op); + + CdlValuable valuable = context.resolve_valuable_reference(expr, arg0.reference_index); + if (0 != valuable) { + if (0 != context.transaction) { + result = valuable->is_enabled(context.transaction); + } else { + result = valuable->is_enabled(); + } + } else { + result = false; + } + CYG_REPORT_RETURN(); +} + +static bool +is_enabled_infer_bool(CdlTransaction transaction, CdlExpression expr, unsigned int index, bool goal, int level) +{ + CYG_REPORT_FUNCNAMETYPE("is_enabled_infer_bool", "result %d"); + CYG_REPORT_FUNCARG5XV(transaction, expr, index, goal, level); + + bool result = false; + + CdlSubexpression subexpr = expr->sub_expressions[index]; + CdlSubexpression arg0 = expr->sub_expressions[subexpr.args[0]]; + CYG_ASSERTC(CdlExprOp_Reference == arg0.op); + + CdlNode node = expr->references[arg0.reference_index].get_destination(); + if (0 != node) { + CdlValuable valuable = dynamic_cast(node); + if (0 != valuable) { + // OK, we have found a valuable. Is it already enabled? + // Does it have a boolean component? Is it modifiable? Has + // it already been modified by the user in this transaction? + if (goal == valuable->is_enabled()) { + result = true; + } else { + CdlValueFlavor flavor = valuable->get_flavor(); + if ((CdlValueFlavor_Bool == flavor) || (CdlValueFlavor_BoolData == flavor)) { + if (valuable->is_modifiable()) { + if (!transaction->changed_by_user(valuable)) { + // We have a modifiable option and want to set the enabled flag. + // However we do not want to lose the current data part - unless + // some other constraint has caused that to be set. + const CdlValue& old_value = transaction->get_whole_value(valuable); + CdlValue new_value = old_value; + if (!old_value.has_source(CdlValueSource_Inferred)) { + CdlSimpleValue simple_value = old_value.get_simple_value(CdlValueSource_Current); + new_value.set_value(simple_value, CdlValueSource_Inferred); + } + new_value.set_enabled(goal, CdlValueSource_Inferred); + new_value.set_source(CdlValueSource_Inferred); + transaction->set_whole_value(valuable, old_value, new_value); + result = transaction->resolve_recursion(level); + } + } + } + } + } + } + + CYG_REPORT_RETVAL(result); + return result; +} + +static CdlFunction is_enabled("is_enabled", 1, &is_enabled_check, &is_enabled_eval, + &is_enabled_infer_bool, CdlFunction::null_infer_value); + +//}}} +//{{{ get_data() + +// ---------------------------------------------------------------------------- +// get_data(x) +// Returns "0" if the specified option is not enabled, otherwise +// the current data part fo the value. The active/inactive and the +// enabled states are ignored. This function takes a single argument +// which must be a reference. + +static void +get_data_check(CdlExpression expr, const CdlSubexpression& subexpr) +{ + CYG_REPORT_FUNCNAME("get_data_check"); + CYG_REPORT_FUNCARG2XV(expr, &subexpr); + + CdlSubexpression& arg0 = expr->sub_expressions[subexpr.args[0]]; + if (CdlExprOp_Reference != arg0.op) { + throw CdlParseException(std::string("The argument to get_data() should be a reference to a configuration option.\n") + + CdlParse::get_expression_error_location()); + } + + CYG_REPORT_RETURN(); +} + +static void +get_data_eval(CdlEvalContext& context, CdlExpression expr, const CdlSubexpression& subexpr, CdlSimpleValue& result) +{ + CYG_REPORT_FUNCNAME("get_data_eval"); + CYG_REPORT_FUNCARG4XV(&context, expr, &subexpr, &result); + CYG_PRECONDITION_CLASSOC(context); + CYG_PRECONDITION_CLASSC(expr); + + CdlSubexpression arg0 = expr->sub_expressions[subexpr.args[0]]; + CYG_ASSERTC(CdlExprOp_Reference == arg0.op); + + CdlValuable valuable = context.resolve_valuable_reference(expr, arg0.reference_index); + if (0 != valuable) { + if (0 != context.transaction) { + result = valuable->get_value(context.transaction); + } else { + result = valuable->get_value(); + } + } else { + result = false; + } + CYG_REPORT_RETURN(); +} + +static bool +get_data_infer_value(CdlTransaction transaction, CdlExpression expr, unsigned int index, CdlSimpleValue& goal, int level) +{ + CYG_REPORT_FUNCNAMETYPE("get_data_infer_value", "result %d"); + CYG_REPORT_FUNCARG5XV(transaction, expr, index, &goal, level); + + bool result = false; + + CdlSubexpression subexpr = expr->sub_expressions[index]; + CdlSubexpression arg0 = expr->sub_expressions[subexpr.args[0]]; + CYG_ASSERTC(CdlExprOp_Reference == arg0.op); + + CdlNode node = expr->references[arg0.reference_index].get_destination(); + if (0 != node) { + CdlValuable valuable = dynamic_cast(node); + if (0 != valuable) { + // OK, we have found a valuable. Does it have a data component? + // Does it already have the right value. Is it modifiable? Has + // it already been modified by the user in this transaction? + CdlValueFlavor flavor = valuable->get_flavor(); + if ((CdlValueFlavor_Data == flavor) || (CdlValueFlavor_BoolData == flavor)) { + CdlSimpleValue current_value = valuable->get_simple_value(transaction); + if (goal != current_value) { + if (valuable->is_modifiable()) { + if (!transaction->changed_by_user(valuable)) { + // We have a modifiable option and want to set the data part. + // However we do not want to lose the enabled part - unless + // some other constraint has caused that to be set. + const CdlValue& old_value = transaction->get_whole_value(valuable); + CdlValue new_value = old_value; + if (!old_value.has_source(CdlValueSource_Inferred)) { + new_value.set_enabled(old_value.is_enabled(), CdlValueSource_Inferred); + } + new_value.set_value(goal, CdlValueSource_Inferred); + new_value.set_source(CdlValueSource_Inferred); + transaction->set_whole_value(valuable, old_value, new_value); + result = transaction->resolve_recursion(level); + } + } + } + } + } + } + + CYG_REPORT_RETVAL(result); + return result; +} + +static CdlFunction get_data("get_data", 1, &get_data_check, &get_data_eval, + CdlFunction::null_infer_bool, &get_data_infer_value); + +//}}} +//{{{ version_cmp() + +// ---------------------------------------------------------------------------- +// version_cmp(a, b) +// Evaluate both arguments, interpret them as version strings, and then +// return -1, 0 or 1. + +static void +version_cmp_eval(CdlEvalContext& context, CdlExpression expr, const CdlSubexpression& subexpr, CdlSimpleValue& result) +{ + CYG_REPORT_FUNCNAME("version_cmp_eval"); + CYG_REPORT_FUNCARG4XV(&context, expr, &subexpr, &result); + CYG_PRECONDITION_CLASSOC(context); + CYG_PRECONDITION_CLASSC(expr); + + CdlSimpleValue arg0; + CdlSimpleValue arg1; + expr->eval_subexpression(context, subexpr.args[0], arg0); + expr->eval_subexpression(context, subexpr.args[1], arg1); + + result = (cdl_int) Cdl::compare_versions(arg0.get_value(), arg1.get_value()); + + CYG_REPORT_RETURN(); +} + +static CdlFunction version_cmp("version_cmp", 2, CdlFunction::null_check, &version_cmp_eval, + CdlFunction::null_infer_bool, CdlFunction::null_infer_value); + +//}}} diff --git a/host/libcdl/infer.cxx b/host/libcdl/infer.cxx --- a/host/libcdl/infer.cxx +++ b/host/libcdl/infer.cxx @@ -621,7 +621,7 @@ infer_handle_reference_value(CdlTransact } //}}} -//{{{ infer_handle_string_constant() +//{{{ infer_handle_xxx_constant() // ---------------------------------------------------------------------------- // Somewhere in the expression processing we have encountered a string @@ -661,9 +661,6 @@ infer_handle_string_constant_value(CdlSi return result; } -//}}} -//{{{ infer_handle_integer_constant() - // ---------------------------------------------------------------------------- // Integers are also fairly straightforward. static bool @@ -702,9 +699,6 @@ infer_handle_integer_constant_value(CdlS return result; } -//}}} -//{{{ infer_handle_double_constant() - // ---------------------------------------------------------------------------- // Doubles are also straightforward, except than an exact comparision may // be too strict. There is not a lot that can be done about this right now. @@ -746,7 +740,7 @@ infer_handle_double_constant_value(CdlSi } //}}} -//{{{ infer_handle_logical_NOT() +//{{{ infer_handle_logical_xxx() // ---------------------------------------------------------------------------- // Logical not simply involves inverting the goal and then trying to infer @@ -762,29 +756,9 @@ infer_handle_logical_NOT_bool(CdlTransac return result; } -static bool -infer_handle_logical_NOT_value(CdlTransaction transaction, CdlExpression expr, unsigned int index, - CdlSimpleValue& goal, int level) -{ - CYG_REPORT_FUNCNAMETYPE("infer_handle_logical_NOT_value", "result %d"); - - bool new_goal = false; - if (("0" == goal.get_value()) || ("" == goal.get_value())) { - new_goal = true; - } - - bool result = CdlInfer::subexpr_bool(transaction, expr, index, new_goal, level); - CYG_REPORT_RETVAL(result); - return result; -} - -//}}} -//{{{ infer_handle_AND() - // ---------------------------------------------------------------------------- // Depending on the goal, we want either both sides of the AND to evaluate to // true, or we want one of the sides to evaluate to false. - static bool infer_handle_AND_bool(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, bool goal, int level) @@ -799,13 +773,18 @@ infer_handle_AND_bool(CdlTransaction tra if (goal) { // Both sides must be true in the same transaction, in case - // the solutions overlap in conflicting ways. - // NOTE: this leaves the transaction argument in an indeterminate - // state. Care has to be taken in the calling code. - if (CdlInfer::subexpr_bool(transaction, expr, lhs, true, level) && - CdlInfer::subexpr_bool(transaction, expr, rhs, true, level)) { + // the solutions overlap in conflicting ways. A sub-transaction + // is still used to avoid polluting current values if the lhs + // can be inferred but not the rhs. + CdlTransaction sub_transaction = transaction->make(transaction->get_conflict()); + if (CdlInfer::subexpr_bool(sub_transaction, expr, lhs, true, level) && + CdlInfer::subexpr_bool(sub_transaction, expr, rhs, true, level)) { + sub_transaction->commit(); result = true; + } else { + sub_transaction->cancel(); } + delete sub_transaction; } else { // We need to try out both sides of the OR and see which one is preferable. // An optimization would be to only try the LHS, but trying both allows @@ -822,26 +801,9 @@ infer_handle_AND_bool(CdlTransaction tra return result; } -static bool -infer_handle_AND_value(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, - CdlSimpleValue& goal, int level) -{ - CYG_REPORT_FUNCNAMETYPE("infer_handle_AND_value", "result %d"); - - bool new_goal = true; - if (("0" == goal.get_value()) || ("" == goal.get_value())) { - new_goal = false; - } - bool result = infer_handle_AND_bool(transaction, expr, lhs, rhs, new_goal, level); - CYG_REPORT_RETVAL(result); - return result; -} - -//}}} -//{{{ infer_handle_OR() - // ---------------------------------------------------------------------------- -// The support for OR logic is much the same as for AND +// The support for the other logical operations involves basically minor +// variants of the above. static bool infer_handle_OR_bool(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, @@ -866,31 +828,154 @@ infer_handle_OR_bool(CdlTransaction tran bool rhs_result = CdlInfer::subexpr_bool(rhs_transaction, expr, rhs, true, level); result = infer_choose2(lhs_transaction, lhs_result, rhs_transaction, rhs_result); - } else { // !(A || B) -> !A && !B - if (CdlInfer::subexpr_bool(transaction, expr, lhs, false, level) && - CdlInfer::subexpr_bool(transaction, expr, rhs, false, level)) { + CdlTransaction sub_transaction = transaction->make(transaction->get_conflict()); + if (CdlInfer::subexpr_bool(sub_transaction, expr, lhs, false, level) && + CdlInfer::subexpr_bool(sub_transaction, expr, rhs, false, level)) { + sub_transaction->commit(); result = true; + } else { + sub_transaction->cancel(); } + delete sub_transaction; + } + + CYG_REPORT_RETVAL(result); + return result; +} + +// ---------------------------------------------------------------------------- + +static bool +infer_handle_IMPLIES_bool(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, + bool goal, int level) +{ + CYG_REPORT_FUNCNAMETYPE("infer_handle_implies_bool", "result %d"); + CYG_REPORT_FUNCARG4XV(transaction, expr, lhs, rhs); + CYG_PRECONDITION_CLASSC(transaction); + CYG_PRECONDITION_CLASSC(expr); + CYG_PRECONDITIONC(lhs != rhs); + + + bool result = false; + + if (goal) { + // A implies B -> !A || B + // Given a choice between !A or B, arguably the "implies" + // operator has the connotation that B is preferred. All other + // things being equal, infer_choose2() will prefer the rhs + // over the lhs so this is achieved automagically. + + CdlTransaction lhs_transaction = transaction->make(transaction->get_conflict()); + CdlTransaction rhs_transaction = transaction->make(transaction->get_conflict()); + bool lhs_result = CdlInfer::subexpr_bool(lhs_transaction, expr, lhs, false, level); + bool rhs_result = CdlInfer::subexpr_bool(rhs_transaction, expr, rhs, true, level); + + result = infer_choose2(lhs_transaction, lhs_result, rhs_transaction, rhs_result); + + } else { + + // !(A implies B) -> !(!A || B) -> (A && !B) + CdlTransaction sub_transaction = transaction->make(transaction->get_conflict()); + if (CdlInfer::subexpr_bool(sub_transaction, expr, lhs, true, level) && + CdlInfer::subexpr_bool(sub_transaction, expr, rhs, false, level)) { + sub_transaction->commit(); + result = true; + } else { + sub_transaction->cancel(); + } + delete sub_transaction; } CYG_REPORT_RETVAL(result); return result; } +// ---------------------------------------------------------------------------- + static bool -infer_handle_OR_value(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, - CdlSimpleValue& goal, int level) +infer_handle_XOR_bool(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, + bool goal, int level) { - CYG_REPORT_FUNCNAMETYPE("infer_handle_OR_value", "result %d"); + CYG_REPORT_FUNCNAMETYPE("infer_handle_XOR_bool", "result %d"); + CYG_REPORT_FUNCARG4XV(transaction, expr, lhs, rhs); + CYG_PRECONDITION_CLASSC(transaction); + CYG_PRECONDITION_CLASSC(expr); + CYG_PRECONDITIONC(lhs != rhs); + + + bool result = false; + + if (goal) { + // (A xor B) -> (A && !B) || (!A && B) - bool new_goal = true; - if (("0" == goal.get_value()) || ("" == goal.get_value())) { - new_goal = false; + CdlTransaction sub1 = transaction->make(transaction->get_conflict()); + CdlTransaction sub2 = transaction->make(transaction->get_conflict()); + bool result1 = (CdlInfer::subexpr_bool(sub1, expr, lhs, true, level) && + CdlInfer::subexpr_bool(sub1, expr, rhs, false, level)); + bool result2 = (CdlInfer::subexpr_bool(sub2, expr, lhs, false, level) && + CdlInfer::subexpr_bool(sub2, expr, rhs, true, level)); + + result = infer_choose2(sub1, result1, sub2, result2); + + } else { + + // !(A xor B) -> (!A && !B) || (A && B) + CdlTransaction sub1 = transaction->make(transaction->get_conflict()); + CdlTransaction sub2 = transaction->make(transaction->get_conflict()); + bool result1 = (CdlInfer::subexpr_bool(sub1, expr, lhs, false, level) && + CdlInfer::subexpr_bool(sub1, expr, rhs, false, level)); + bool result2 = (CdlInfer::subexpr_bool(sub2, expr, lhs, true, level) && + CdlInfer::subexpr_bool(sub2, expr, rhs, true, level)); + + result = infer_choose2(sub1, result1, sub2, result2); } - bool result = infer_handle_OR_bool(transaction, expr, lhs, rhs, new_goal, level); + + CYG_REPORT_RETVAL(result); + return result; +} + +// ---------------------------------------------------------------------------- + +static bool +infer_handle_EQV_bool(CdlTransaction transaction, CdlExpression expr, unsigned int lhs, unsigned int rhs, + bool goal, int level) +{ + CYG_REPORT_FUNCNAMETYPE("infer_handle_EQV_bool", "result %d"); + CYG_REPORT_FUNCARG4XV(transaction, expr, lhs, rhs); + CYG_PRECONDITION_CLASSC(transaction); + CYG_PRECONDITION_CLASSC(expr); + CYG_PRECONDITIONC(lhs != rhs); + + + bool result = false; + + if (goal) { + // (A eqv B) -> (A && B) || (!A && !B) + + CdlTransaction sub1 = transaction->make(transaction->get_conflict()); + CdlTransaction sub2 = transaction->make(transaction->get_conflict()); + bool result1 = (CdlInfer::subexpr_bool(sub1, expr, lhs, true, level) && + CdlInfer::subexpr_bool(sub1, expr, rhs, true, level)); + bool result2 = (CdlInfer::subexpr_bool(sub2, expr, lhs, false, level) && + CdlInfer::subexpr_bool(sub2, expr, rhs, false, level)); + + result = infer_choose2(sub1, result1, sub2, result2); + } else { + // !(A eqv B) -> (A && !B) || (!A && B) + + CdlTransaction sub1 = transaction->make(transaction->get_conflict()); + CdlTransaction sub2 = transaction->make(transaction->get_conflict()); + bool result1 = (CdlInfer::subexpr_bool(sub1, expr, lhs, true, level) && + CdlInfer::subexpr_bool(sub1, expr, rhs, false, level)); + bool result2 = (CdlInfer::subexpr_bool(sub2, expr, lhs, false, level) && + CdlInfer::subexpr_bool(sub2, expr, rhs, true, level)); + + result = infer_choose2(sub1, result1, sub2, result2); + } + CYG_REPORT_RETVAL(result); return result; } @@ -1090,6 +1175,18 @@ CdlInfer::subexpr_bool(CdlTransaction tr result = infer_handle_OR_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, goal, level); break; + case CdlExprOp_Implies : + result = infer_handle_IMPLIES_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, goal, level); + break; + + case CdlExprOp_Xor : + result = infer_handle_XOR_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, goal, level); + break; + + case CdlExprOp_Eqv : + result = infer_handle_EQV_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, goal, level); + break; + case CdlExprOp_Equal : result = infer_handle_equal_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, goal, level); break; @@ -1101,23 +1198,13 @@ CdlInfer::subexpr_bool(CdlTransaction tr // <= is satisfied by a numerical equality. However the inverse relation > cannot be handled that way // The other comparison operators are much the same. case CdlExprOp_LessEqual : + case CdlExprOp_GreaterEqual : if (goal) { result = infer_handle_numerical_equal_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, true, level); } break; case CdlExprOp_LessThan : - if (!goal) { - result = infer_handle_numerical_equal_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, true, level); - } - break; - - case CdlExprOp_GreaterEqual : - if (goal) { - result = infer_handle_numerical_equal_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, true, level); - } - break; - case CdlExprOp_GreaterThan : if (!goal) { result = infer_handle_numerical_equal_bool(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, true, level); @@ -1180,17 +1267,20 @@ CdlInfer::subexpr_value(CdlTransaction t break; case CdlExprOp_LogicalNot : - result = infer_handle_logical_NOT_value(transaction, expr, subexpr.lhs_index, goal, level); - break; - - case CdlExprOp_And : - result = infer_handle_OR_value(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, goal, level); + case CdlExprOp_And : + case CdlExprOp_Or : + case CdlExprOp_Implies : + case CdlExprOp_Xor : + case CdlExprOp_Eqv : + { + bool new_goal = true; + if (("0" == goal.get_value()) || ("" == goal.get_value())) { + new_goal = false; + } + result = CdlInfer::subexpr_bool(transaction, expr, index, new_goal, level); break; + } - case CdlExprOp_Or : - result = infer_handle_AND_value(transaction, expr, subexpr.lhs_index, subexpr.rhs_index, goal, level); - break; - case CdlExprOp_Function : result = CdlFunction::infer_value(transaction, expr, index, goal, level); break; @@ -1283,19 +1373,19 @@ CdlConflict_RequiresBody::inner_resolve( CYG_PRECONDITION_CLASSC(transaction); bool result = false; + + CdlProperty_GoalExpression gexpr = dynamic_cast(this->get_property()); + CdlExpression expr = gexpr->get_expression(); - CdlProperty_GoalExpression gexpr = dynamic_cast(this->get_property()); - CdlExpression expr = gexpr->get_expression(); - - // Only create the sub-transactions when needed + // Only create the sub-transactions when needed. CdlTransaction expr_transaction = 0; CdlTransaction disable_transaction = 0; CdlTransaction inactive_transaction = 0; // Keep track of the preferred solution found to date. CdlTransaction preferred_transaction = 0; - - expr_transaction = transaction->make(this); + + expr_transaction = transaction->make(this); if (!CdlInfer::subexpr_bool(expr_transaction, expr, expr->first_subexpression, true, level)) { // No luck here. expr_transaction->cancel(); diff --git a/host/libcdl/parse.cxx b/host/libcdl/parse.cxx --- a/host/libcdl/parse.cxx +++ b/host/libcdl/parse.cxx @@ -801,7 +801,8 @@ CdlParse::parse_string_property(CdlInter } throw; } - + + CYG_REPORT_RETURN(); return TCL_OK; } @@ -901,7 +902,7 @@ CdlParse::parse_stringvector_property(Cd int CdlParse::parse_reference_property(CdlInterpreter interp, int argc, char** argv, std::string name, char** options_desc, void (*final_parser)(CdlInterpreter, CdlProperty_Reference), - CdlUpdateHandler update_handler) + bool allow_empty, CdlUpdateHandler update_handler) { CYG_REPORT_FUNCNAME("parse_reference_property"); CYG_PRECONDITION_CLASSC(interp); @@ -917,7 +918,7 @@ CdlParse::parse_reference_property(CdlIn CdlParse::report_property_parse_error(interp, argv[0], "Too many arguments, expecting just one."); } else { std::string refname = argv[data_index]; - if (!Cdl::is_valid_cdl_name(refname)) { + if (!(Cdl::is_valid_cdl_name(refname) || (allow_empty && ("" == refname)))) { CdlParse::report_property_parse_error(interp, argv[0], "`" + refname + "' is not a valid CDL name"); } else { CdlNode current_node = interp->get_node(); diff --git a/host/libcdl/property.cxx b/host/libcdl/property.cxx --- a/host/libcdl/property.cxx +++ b/host/libcdl/property.cxx @@ -582,7 +582,7 @@ CdlProperty_ReferenceBody::~CdlProperty_ // ---------------------------------------------------------------------------- // Reference handling. It is useful at this level to cope with the // four cases of Loaded, Unloaded, Created, and Destroyed. In addition -// the update handler needs to be invoked. +// the property-specific update handler needs to be invoked. void CdlProperty_ReferenceBody::update(CdlTransaction transact, CdlNode source, CdlNode dest, CdlUpdate change) @@ -596,13 +596,18 @@ CdlProperty_ReferenceBody::update(CdlTra case CdlUpdate_Loaded : { // The source has just been loaded, try to resolve the reference. + // Note that e.g. the parent property allow for a reference to "" + // The necessary validation will have happened during parsing. CYG_ASSERTC(0 == dest); CdlToplevel toplevel = source->get_toplevel(); - dest = toplevel->lookup(get_destination_name()); - if (0 == dest) { - CdlConflict_UnresolvedBody::make(transact, source, this, get_destination_name()); - } else { - bind(source, this, dest); + std::string dest_name = get_destination_name(); + if ("" != dest_name) { + dest = toplevel->lookup(dest_name); + if (0 == dest) { + CdlConflict_UnresolvedBody::make(transact, source, this, get_destination_name()); + } else { + bind(source, this, dest); + } } break; } diff --git a/host/libcdl/refer.cxx b/host/libcdl/refer.cxx --- a/host/libcdl/refer.cxx +++ b/host/libcdl/refer.cxx @@ -96,7 +96,6 @@ CdlReference::CdlReference(const std::st { CYG_REPORT_FUNCNAME("CdlReference:: constructor"); CYG_REPORT_FUNCARG1("this %p", this); - CYG_PRECONDITIONC("" != dest_arg); dest_name = dest_arg; dest = 0; diff --git a/host/libcdl/value.cxx b/host/libcdl/value.cxx --- a/host/libcdl/value.cxx +++ b/host/libcdl/value.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. // @@ -1587,7 +1587,7 @@ CdlValuableBody::parse_dialog(CdlInterpr { CYG_REPORT_FUNCNAMETYPE("parse_dialog", "result %d"); - int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Dialog, 0, 0, &dialog_update_handler); + int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Dialog, 0, 0, false, &dialog_update_handler); CYG_REPORT_RETVAL(result); return result; @@ -1686,7 +1686,7 @@ CdlValuableBody::parse_wizard(CdlInterpr { CYG_REPORT_FUNCNAMETYPE("parse_wizard", "result %d"); - int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Wizard, 0, 0, &wizard_update_handler); + int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Wizard, 0, 0, false, &wizard_update_handler); CYG_REPORT_RETVAL(result); return result; } @@ -1872,7 +1872,6 @@ int CdlValuableBody::parse_default_value(CdlInterpreter interp, int argc, char** argv) { CYG_REPORT_FUNCNAMETYPE("parse_default_value", "result %d"); - int result = CdlParse::parse_expression_property(interp, argc, argv, CdlPropertyId_DefaultValue, 0, 0, &default_value_update_handler); CYG_REPORT_RETVAL(result); @@ -2235,7 +2234,7 @@ CdlValuableBody::parse_implements(CdlInt { CYG_REPORT_FUNCNAMETYPE("parse_implements", "result %d"); - int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Implements, 0, 0, + int result = CdlParse::parse_reference_property(interp, argc, argv, CdlPropertyId_Implements, 0, 0, false, &implements_update_handler); CYG_REPORT_RETVAL(result); @@ -3267,7 +3266,7 @@ CdlValuableBody::set_enabled(CdlTransact CYG_ASSERTC((source == CdlValueSource_Default) || !has_property(CdlPropertyId_Calculated)); CYG_PRECONDITION_THISC(); CYG_PRECONDITION_CLASSC(transaction); - + const CdlValue& old_value = transaction->get_whole_value(this); CdlValue new_value = old_value; new_value.set_enabled(enabled_arg, source); diff --git a/host/tools/Utils/common/eCosStd.h b/host/tools/Utils/common/eCosStd.h --- a/host/tools/Utils/common/eCosStd.h +++ b/host/tools/Utils/common/eCosStd.h @@ -1,26 +1,26 @@ //####COPYRIGHTBEGIN#### -// +// // ---------------------------------------------------------------------------- // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. // // This program is part of the eCos host tools. // -// This program is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 of the License, or (at your option) +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 of the License, or (at your option) // any later version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for // more details. -// +// // You should have received a copy of the GNU General Public License along with -// this program; if not, write to the Free Software Foundation, Inc., +// this program; if not, write to the Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // ---------------------------------------------------------------------------- -// +// //####COPYRIGHTEND#### //#####DESCRIPTIONBEGIN#### // @@ -37,15 +37,15 @@ // Apart from header includes it defines the time-related quantities: // Time - type to measure an absolute time // Duration - type to measure the difference between two times, or a delay -// Now() - the time now. +// Now() - the time now. // MIN and MAX -// LogFunc - a function to which output can be sent +// LogFunc - a function to which output can be sent // ---------------------------------------------------------------------------- #if !defined(AFX_STDAFX_H__F20BA9C4_CFD5_11D2_BF75_00A0C949ADAC__INCLUDED_) #define AFX_STDAFX_H__F20BA9C4_CFD5_11D2_BF75_00A0C949ADAC__INCLUDED_ -#if defined(__GNUWIN32__) +#if defined(__CYGWIN__) #include #if 0 @@ -64,7 +64,7 @@ #include #define cPathsep '/' - #include // malloc + #include // malloc #include // atoi #include #define WOULDBLOCK EWOULDBLOCK @@ -127,7 +127,7 @@ #include #define cPathsep '/' - #include // malloc + #include // malloc #include // atoi #include #define WOULDBLOCK EWOULDBLOCK 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 @@ -45,6 +45,14 @@ #ifdef __CYGWIN__ #include /* for cygwin_conv_to_posix_path() */ #endif +#ifdef __WXMSW__ +// We take advantage of wxWindows' recursive wxFileName::Mkdir function +// to workaround a bug in Tcl on Windows 9x +#include "wx/filename.h" +# ifdef new +# undef new +# endif +#endif #include "flags.hxx" #include "build.hxx" @@ -185,7 +193,15 @@ std::string cygpath (const std::string i // create a directory bool create_directory (const std::string directory) { - return eval_tcl_command ("file mkdir \"" + directory + "\""); +// We take advantage of wxWindows' recursive wxFileName::Mkdir function +// to workaround a bug in Tcl on Windows 9x +#if defined(__WXMSW__) + if (wxDirExists(directory.c_str())) + return TRUE; + return wxFileName::Mkdir(directory.c_str(), 0777, TRUE); +#else + return eval_tcl_command ("file mkdir \"" + directory + "\""); +#endif } // copy a file diff --git a/host/tools/configtool/standalone/common/ChangeLog b/host/tools/configtool/standalone/common/ChangeLog --- a/host/tools/configtool/standalone/common/ChangeLog +++ b/host/tools/configtool/standalone/common/ChangeLog @@ -1,3 +1,9 @@ +2001-06-20 Bart Veer + + * cdl_exec.cxx (set_verbose_mode): + Make the ecosconfig -v verbosity flag control libcdl database + verbosity as well. + 2001-05-16 Bart Veer * ecosconfig.cxx: clean up cygwin->windows path translations diff --git a/host/tools/configtool/standalone/common/cdl_exec.cxx b/host/tools/configtool/standalone/common/cdl_exec.cxx --- a/host/tools/configtool/standalone/common/cdl_exec.cxx +++ b/host/tools/configtool/standalone/common/cdl_exec.cxx @@ -1,7 +1,7 @@ //####COPYRIGHTBEGIN#### // // ---------------------------------------------------------------------------- -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. // // This program is part of the eCos host tools. // @@ -89,6 +89,7 @@ void cdl_exec::set_verbose_mode(bool new_val) { verbose = new_val; + CdlPackagesDatabaseBody::set_verbose(new_val); } void diff --git a/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp b/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp --- a/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp +++ b/host/tools/configtool/standalone/wxwin/ConfigtoolVC.dsp @@ -643,6 +643,10 @@ SOURCE=.\about.htm # End Source File # Begin Source File +SOURCE=..\..\..\..\ChangeLog +# End Source File +# Begin Source File + SOURCE=.\setup\innobott.txt # End Source File # Begin Source File @@ -651,6 +655,10 @@ SOURCE=.\setup\innotop.txt # End Source File # Begin Source File +SOURCE=.\Makefile +# End Source File +# Begin Source File + SOURCE=.\setup\makesetup.sh # End Source File # Begin Source File @@ -669,6 +677,10 @@ SOURCE=.\README.txt SOURCE=.\symbols.h # End Source File +# Begin Source File + +SOURCE=.\TODO.txt +# End Source File # End Group # Begin Source File diff --git a/host/tools/configtool/standalone/wxwin/README.txt b/host/tools/configtool/standalone/wxwin/README.txt --- a/host/tools/configtool/standalone/wxwin/README.txt +++ b/host/tools/configtool/standalone/wxwin/README.txt @@ -79,6 +79,27 @@ Known bugs: (normally when the repository is first seen by the Configuration Tool). +Version History +--------------- + +*** Version 2.01, June 2001 + +- Clicking Save when tool was first loaded didn't do anything. + Now behaves like Save As for a first-time save. + +- Mix-up with directory names fixed. + +- Windows installer now leaves existing DLLs intact even if + the installer's files were newer. + +- The Unix tarball now contains a subdirectory containing the current + version in the name. + + +*** Version 2.0, May 2001 + +- Initial public release + Installing the Configuration Tool ================================= 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.34 2001/05/02 10:36:15 julians Exp $ +// Version: $Id: configtool.cpp,v 1.35 2001/06/18 14:41:13 julians Exp $ // Purpose: // Description: Implementation file for the ConfigTool application class // Requires: @@ -1037,9 +1037,10 @@ void ecApp::Build(const wxString &strWha // wxSetWorkingDirectory(pDoc->GetBuildTree()); m_pipedProcess = new ecPipedProcess; - int pid = wxExecute(strCmd, FALSE, m_pipedProcess); + long pid = wxExecute(strCmd, FALSE, m_pipedProcess); if ( pid ) { + m_pipedProcess->SetPid(pid); // wxLogStatus(_T("Process %ld (%s) launched."), pid, cmd.c_str()); } else 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.22 2001/05/02 10:36:15 julians Exp $ +// Version: $Id: configtool.h,v 1.23 2001/06/18 14:41:13 julians Exp $ // Purpose: // Description: main header file for the ConfigTool application // Requires: @@ -242,6 +242,7 @@ public: { Redirect(); m_pingTimer.Start(100); + m_pid = 0; } ~ecPipedProcess() { @@ -254,8 +255,13 @@ public: //// Operations virtual bool HasInput(); +//// Accessors + void SetPid(long pid) { m_pid = pid; } + long GetPid() const { return m_pid; } + protected: ecPingTimer m_pingTimer; + long m_pid; }; // IDs for the controls and the menu commands diff --git a/host/tools/configtool/standalone/wxwin/configtooldoc.cpp b/host/tools/configtool/standalone/wxwin/configtooldoc.cpp --- a/host/tools/configtool/standalone/wxwin/configtooldoc.cpp +++ b/host/tools/configtool/standalone/wxwin/configtooldoc.cpp @@ -30,7 +30,7 @@ // Author(s): julians // Contact(s): julians // Date: 2000/10/05 -// Version: $Id: configtooldoc.cpp,v 1.30 2001/06/11 14:49:49 julians Exp $ +// Version: $Id: configtooldoc.cpp,v 1.31 2001/06/18 14:41:13 julians Exp $ // Purpose: // Description: Implementation file for the ecConfigToolDoc class // Requires: @@ -68,7 +68,7 @@ #ifdef __WXMSW__ #include -#ifndef __GNUWIN32__ +#ifndef __CYGWIN__ #include #endif #include "wx/msw/winundef.h" @@ -110,9 +110,9 @@ ecConfigToolDoc::~ecConfigToolDoc() { wxGetApp().m_currentDoc = NULL; wxGetApp().GetSettings().m_strRepository = m_strRepository; - + CloseRepository(); - + // Delete remaining items -- most (if not all) should already // have been deleted via the tree item client data DeleteItems(); @@ -126,7 +126,7 @@ void ecConfigToolDoc::DeleteItems() { ecConfigItem* item = wxDynamicCast(node->Data(), ecConfigItem); wxNode* next = node->Next(); - + // Note: automatically removes itself from this list in ~ecConfigItem delete item; node = next; @@ -164,7 +164,7 @@ bool ecConfigToolDoc::Save() bool ecConfigToolDoc::OnCreate(const wxString& path, long flags) { wxGetApp().m_currentDoc = this; - + if (flags & wxDOC_NEW) { m_bRepositoryOpen = FALSE; @@ -196,13 +196,13 @@ bool ecConfigToolDoc::OnCreate(const wxS { wxBusyCursor wait; - ecConfigToolHint hint(NULL, ecSelChanged); + ecConfigToolHint hint(NULL, ecSelChanged); UpdateAllViews (NULL, & hint); SetFilename(GetFilename(), TRUE); // load the memory layout for the default target-platform-startup from the current repository - + // TODO // m_memoryMap.set_map_size (0xFFFFFFFF); // set the maximum memory map size // NewMemoryLayout (CFileName (m_strPackagesDir, m_strMemoryLayoutFolder, _T("include\\pkgconf"))); @@ -221,73 +221,73 @@ bool ecConfigToolDoc::OnCreate(const wxS bool ecConfigToolDoc::OnSaveDocument(const wxString& filename) { wxBusyCursor cursor; - + const wxString strOldPath(GetFilename()); -#if 0 +#if 0 bool bSaveAs=(filename!=strOldPath); if(!IsModified() && wxFileExists(filename)) { return TRUE; } #endif - + bool rc=FALSE; if (CheckConflictsBeforeSave()) { // errors already emitted - + const wxString strPathName(filename); - + wxString str; str.Printf(_("Saving configuration %s"), (const wxChar*) filename); - + /* TODO CIdleMessage IM(str); if(CConfigTool::GetCellView()){ CConfigTool::GetCellView()->CancelCellEdit(); } */ - + // check the configuration - + wxASSERT (m_CdlConfig->check_this (cyg_extreme)); - + // save the configuration - + try { m_CdlConfig->save ((const wxChar*) filename); rc=TRUE; } - + catch (CdlStringException exception) { wxString msg; msg.Printf(_("Error saving eCos configuration:\n\n%s"), exception.get_message ().c_str ()); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } - + catch (...) { wxString msg; msg.Printf(_("Error saving eCos configuration")); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } - + if(rc){ rc=FALSE; SetFilename (filename); // called to ensure that MLTDir() will work in this function TODO?? - + // save the memory layout files to the build tree and copy to the install tree - /* TODO + /* TODO if (bSaveAs || MemoryMap.map_modified ()) { SaveMemoryMap(); } */ - + ecConfigToolHint hint(NULL, ecAllSaved); UpdateAllViews (NULL, & hint); - + wxASSERT( !m_strBuildTree.IsEmpty() ); wxASSERT( !m_strInstallTree.IsEmpty() ); @@ -309,9 +309,9 @@ bool ecConfigToolDoc::OnSaveDocument(con rc=generate_build_tree (GetCdlConfig(), ecUtils::UnicodeToStdStr(m_strBuildTree), ecUtils::UnicodeToStdStr(m_strInstallTree)); rc = TRUE; } - + } - } + } if(rc) { Modify(FALSE); @@ -322,6 +322,7 @@ bool ecConfigToolDoc::OnSaveDocument(con { SetFilename(strOldPath); } + wxGetApp().GetMainFrame()->UpdateFrameTitle(); return rc; } @@ -330,15 +331,15 @@ bool ecConfigToolDoc::OnOpenDocument(con wxGetApp().GetSettings().m_lastFilename = filename; wxBusyCursor cursor; - + bool rc=FALSE; // Assume the worst CdlInterpreter NewCdlInterp = NULL; CdlConfiguration NewCdlConfig = NULL; - + // We have to open the repository or m_CdlPkgData and co. won't be set if (!OpenRepository()) return FALSE; - + wxString str; str.Printf(_("Opening save file %s"), (const wxChar*) filename); wxGetApp().SetStatusText(str); @@ -363,28 +364,28 @@ bool ecConfigToolDoc::OnOpenDocument(con msg.Printf(_("Error opening eCos configuration")); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } - + if (rc) { rc=FALSE; // check the new configuration - + wxASSERT (NewCdlConfig->check_this (cyg_extreme)); - + // switch to the new configuration - + delete m_CdlConfig; delete m_CdlInterp; m_CdlInterp = NewCdlInterp; m_CdlConfig = NewCdlConfig; //SetPathName (lpszPathName, TRUE); // called to ensure that MLTDir() will work in this function - + AddAllItems (); // must precede NewMemoryLayout() [CurrentLinkerScript() calls Find()] - + // load the memory layout from the build tree // TODO NewMemoryLayout (MLTDir ()); - + UpdateFailingRuleCount(); UpdateBuildInfo(); @@ -396,10 +397,10 @@ bool ecConfigToolDoc::OnOpenDocument(con ecConfigToolHint hint(NULL, ecFilenameChanged); UpdateAllViews (NULL, & hint); } - - // re-enable the transaction callback + + // re-enable the transaction callback EnableCallbacks(TRUE); - + SetDocumentSaved(TRUE); // Necessary or it will pop up the Save As dialog wxGetApp().SetStatusText(wxEmptyString, FALSE); @@ -411,30 +412,30 @@ void ecConfigToolDoc::AddAllItems() { ecConfigTreeCtrl* treeCtrl = wxGetApp().GetMainFrame()->GetTreeCtrl(); // Ensure there's no dangling pointer - wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(NULL); + wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(NULL); treeCtrl->DeleteAllItems(); m_strMemoryLayoutFolder = wxT(""); m_strLinkerScriptFolder = wxT(""); - + // Add the root item ecConfigItem* item = NULL; wxTreeItemId rootId = treeCtrl->AddRoot(_(""), -1, -1, new ecTreeItemData(item = new ecConfigItem(NULL, _("Configuration"), ecContainer))); item->SetTreeItem(rootId); item->UpdateTreeItem(* treeCtrl); item->SetDescription(_("The root node for all configurable items")); - m_items.Append(item); - + m_items.Append(item); + AddContents(m_CdlConfig, item); treeCtrl->Expand(rootId); - + // check that exactly one radio button in each group is enabled CheckRadios (); - + // update the rules (conflicts) view UpdateFailingRuleCount (); - + if( ! wxGetApp().GetMainFrame() || ! wxGetApp().GetMainFrame()->GetConflictsWindow() || ! wxGetApp().GetMainFrame()->GetConflictsWindow()->IsShown()) { @@ -458,7 +459,7 @@ void ecConfigToolDoc::AddAllItems() void ecConfigToolDoc::AddContents (const CdlContainer container, ecConfigItem *pParent) { // determine the container contents - + const std::vector& contents = container->get_contents (); std::vector::const_iterator node_i; for (node_i = contents.begin (); node_i != contents.end (); node_i++) @@ -468,7 +469,7 @@ void ecConfigToolDoc::AddContents (const const CdlComponent comp = dynamic_cast (node); const CdlOption opt = dynamic_cast (node); const CdlContainer contnr = dynamic_cast (node); - + // if the node in the container is a package, component or option // then it is visible and should be added to the tree if (0 != pkg) // the node is a package @@ -483,10 +484,10 @@ void ecConfigToolDoc::AddContents (const } else if (0 != opt) // the node is an option AddItem (opt, pParent); // add the option - + else if (0 != contnr) // if the node is a container AddContents (contnr, pParent); // add the container contents - + // ignore nodes of any other class } } @@ -494,9 +495,9 @@ void ecConfigToolDoc::AddContents (const ecConfigItem * ecConfigToolDoc::AddItem (const CdlUserVisible vitem, ecConfigItem * pParent) { ecConfigItem * pItem = new ecConfigItem (pParent, vitem); - + m_items.Append(pItem); - + if (vitem->get_name () == "CYGHWR_MEMORY_LAYOUT") { wxASSERT (m_strMemoryLayoutFolder.IsEmpty ()); @@ -506,7 +507,7 @@ ecConfigItem * ecConfigToolDoc::AddItem #endif //TRACE (_T("Found memory layout folder: %s\n"), m_strMemoryLayoutFolder); } - + if (vitem->get_name () == "CYGBLD_LINKER_SCRIPT") { wxASSERT (m_strLinkerScriptFolder.IsEmpty ()); @@ -515,25 +516,25 @@ ecConfigItem * ecConfigToolDoc::AddItem m_strLinkerScriptFolder.Replace(wxT("/"),wxT("\\")); #endif //TRACE (_T("Found linker script folder: %s\n"), m_strLinkerScriptFolder); - + // the CDL hardware template name will eventually become the target name, // but for now we must deduce the target name from the linker script file name - + const CdlValuable valuable = dynamic_cast (vitem); ecFileName strLinkerScript (m_strPackagesDir, m_strLinkerScriptFolder, wxString (valuable->get_value ().c_str ())); #ifdef __WXMSW__ strLinkerScript.Replace (wxT("/"), wxT("\\")); #endif - + if(!strLinkerScript.Exists ()){ wxString msg; msg.Printf(wxT("%s does not exist\n"), (const wxChar*) strLinkerScript); wxGetApp().Log(msg); } //TRACE (_T("Target '%s' selected\n"), strLinkerScript.Tail ().Root (), pItem->Macro()); - } - + } + //TRACE(_T("Created new item from cdl: ")); //pItem->DumpItem(); return pItem; @@ -541,17 +542,17 @@ ecConfigItem * ecConfigToolDoc::AddItem void ecConfigToolDoc::CheckRadios() { - int nItem; + int nItem; for(nItem=0; nItem < GetItems().Number() ; nItem++) { ecConfigItem *pItem=(ecConfigItem*) GetItems()[nItem]; - + if(pItem->HasRadio () && pItem==pItem->FirstRadio()) { wxString strMsg; ecConfigItem *pFirstSet=NULL; ecConfigItem *pSibItem; - + for ( pSibItem=pItem; pSibItem; pSibItem = pSibItem->NextRadio() ) { if(pSibItem->IsEnabled ()) @@ -566,7 +567,7 @@ void ecConfigToolDoc::CheckRadios() } } } - + if ( !strMsg.IsEmpty() ) { wxString msg2; @@ -655,14 +656,14 @@ bool ecConfigToolDoc::OpenRepository(con if(!m_bRepositoryOpen) { UpdateFailingRuleCount(); - + wxString strNewRepository; while(!m_bRepositoryOpen) { if(bPromptInitially) { ecChooseRepositoryDialog dlg(wxGetApp().GetTopWindow()); - + if(wxID_CANCEL==dlg.ShowModal()){ wxGetApp().SetStatusText(wxEmptyString); return FALSE; @@ -675,7 +676,7 @@ bool ecConfigToolDoc::OpenRepository(con strNewRepository = pszRepository; else strNewRepository = m_strRepository; - + bPromptInitially=TRUE; } wxString str; @@ -683,15 +684,15 @@ bool ecConfigToolDoc::OpenRepository(con str.Printf(_("Opening repository...")); else str.Printf(_("Opening repository %s..."), (const wxChar*) strNewRepository); - wxGetApp().SetStatusText(str); - + wxGetApp().SetStatusText(str); + CdlPackagesDatabase NewCdlPkgData = NULL; CdlInterpreter NewCdlInterp = NULL; CdlConfiguration NewCdlConfig = NULL; wxString strNewPackagesDir; - + EnableCallbacks(FALSE); // disable transaction callbacks until the config tree is regenerated - + wxBusyCursor wait; if(OpenRepository(strNewRepository,NewCdlPkgData,NewCdlInterp,NewCdlConfig,strNewPackagesDir)) { @@ -705,7 +706,7 @@ bool ecConfigToolDoc::OpenRepository(con if (templates.size () != 0) default_template = templates [0]; } - + m_templateVersion = ""; try { @@ -723,33 +724,33 @@ bool ecConfigToolDoc::OpenRepository(con msg.Printf(_("Error loading package template '%s'."), default_template.c_str ()); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } - + // check the configuration wxASSERT (NewCdlConfig->check_this (cyg_extreme)); - + // use the new package database, interpreter and configuration delete m_CdlConfig; // delete the previous configuration delete m_CdlInterp; // delete the previous interpreter delete m_CdlPkgData; // delete the previous package database - + m_CdlPkgData = NewCdlPkgData; m_CdlInterp = NewCdlInterp; m_CdlConfig = NewCdlConfig; - + // save the repository location - + SetRepository(strNewRepository); m_strPackagesDir = strNewPackagesDir; - + // clear the previously specified document file name (if any), // OnNewDocument() calls DeleteContents() so must be called // before AddAllItems() - + wxDocument::OnNewDocument (); - + // generate the CConfigItems from their CDL descriptions AddAllItems (); - + m_bRepositoryOpen=TRUE; // Rebuild help index if it needs building @@ -760,13 +761,13 @@ bool ecConfigToolDoc::OpenRepository(con delete NewCdlConfig; NewCdlConfig = NULL; delete NewCdlInterp; NewCdlInterp = NULL; delete NewCdlPkgData; NewCdlPkgData = NULL; - + } - + // install a transaction handler callback function now that the tree exists EnableCallbacks(TRUE); } - + } wxGetApp().SetStatusText(wxEmptyString, FALSE); return m_bRepositoryOpen; @@ -775,7 +776,7 @@ bool ecConfigToolDoc::OpenRepository(con bool ecConfigToolDoc::OpenRepository (const ecFileName& strNewRepository, CdlPackagesDatabase &NewCdlPkgData,CdlInterpreter &NewCdlInterp,CdlConfiguration &NewCdlConfig, wxString &strNewPackagesDir) { bool rc=FALSE; - + if(!strNewRepository.IsEmpty()) { // Now strNewRepository is guaranteed non-empty, but does it exist? @@ -785,7 +786,7 @@ bool ecConfigToolDoc::OpenRepository (co msg.Printf(_("Cannot open repository - the folder %s does not exist"), (const wxChar*) strNewRepository); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } else - { + { // Ok so it exists, but does it look right? //strNewPackagesDir=strNewRepository+wxString(wxFILE_SEP_PATH)+wxT("ecc"); strNewPackagesDir=strNewRepository + wxT("ecc"); @@ -794,7 +795,7 @@ bool ecConfigToolDoc::OpenRepository (co //strNewPackagesDir=strNewRepository+wxString(wxFILE_SEP_PATH)+wxT("packages"); strNewPackagesDir=strNewRepository + wxT("packages"); } - + if(!wxDirExists(strNewPackagesDir)) { // Don't mention the ecc\ attempt @@ -803,7 +804,7 @@ bool ecConfigToolDoc::OpenRepository (co (const wxChar*) strNewRepository, (const wxChar*) strNewPackagesDir); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } else { - + const wxString strDatabase = strNewPackagesDir + wxString(wxFILE_SEP_PATH) + wxT("ecos.db"); if(!wxFileExists(strDatabase)) { @@ -811,7 +812,7 @@ bool ecConfigToolDoc::OpenRepository (co msg.Printf(_("%s does not seem to be a source repository: %s does not exist"), (const wxChar*) strNewRepository, (const wxChar*) strDatabase); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } else { - + // create a CDL repository, interpreter and configuration try {// create a new package database, interpreter and configuration NewCdlPkgData = CdlPackagesDatabaseBody::make ((const wxChar*) strNewPackagesDir, &CdlParseErrorHandler, &CdlParseWarningHandler); @@ -849,7 +850,7 @@ bool ecConfigToolDoc::OpenRepository (co default_hardware = targets [0].c_str(); } } - + try { m_strCdlErrorMessage = wxT(""); NewCdlConfig->set_hardware ((const wxChar*) default_hardware, &CdlParseErrorHandler, &CdlParseWarningHandler); @@ -880,17 +881,17 @@ bool ecConfigToolDoc::OpenRepository (co } } } - + return rc; } void ecConfigToolDoc::SelectTemplate (const wxString& newTemplate, const wxString& newTemplateVersion) { if ((newTemplate != m_CdlConfig->get_template().c_str()) || (newTemplateVersion != m_templateVersion)){ - + wxBusyCursor wait; // this may take a little while DeleteItems(); - + m_templateVersion = wxT(""); try { @@ -909,8 +910,8 @@ void ecConfigToolDoc::SelectTemplate (co msg.Printf(wxT("Error loading package template '%s'."), (const wxChar*) newTemplate.c_str ()); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } - RegenerateData(); - + RegenerateData(); + if (!GetFilename().IsEmpty()) { // not a new document #if 0 // TODO @@ -938,7 +939,7 @@ void ecConfigToolDoc::RegenerateData() #if 0 SwitchMemoryLayout (TRUE); // the hardware template may have changed #endif - + UpdateBuildInfo(); // TODO // CConfigTool::GetControlView()->SelectItem(Item(0)); @@ -949,7 +950,7 @@ void ecConfigToolDoc::SelectHardware (co const std::string OldTemplate=m_CdlConfig->get_hardware(); if (newTemplate != OldTemplate.c_str()){ DeleteItems(); - + try { m_CdlConfig->set_hardware (newTemplate.c_str(), CdlParseErrorHandler, CdlParseWarningHandler); @@ -968,9 +969,9 @@ void ecConfigToolDoc::SelectHardware (co wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); m_CdlConfig->set_hardware (OldTemplate, CdlParseErrorHandler, CdlParseWarningHandler); } - + RegenerateData(); - + // TODO #if 0 if (!GetFilename().IsEmpty()) @@ -978,7 +979,7 @@ void ecConfigToolDoc::SelectHardware (co CopyMLTFiles (); // copy new MLT files to the build tree as necessary } #endif - + Modify(TRUE); wxGetApp().GetMainFrame()->UpdateFrameTitle(); } @@ -989,13 +990,13 @@ void ecConfigToolDoc::SelectPackages () // Crashes the Cygwin 1.0 compiler #ifndef __CYGWIN10__ ecPackagesDialog dlg(wxGetApp().GetTopWindow()); - + // This map holds the ecConfigItem pointers for the packages loaded before the dialog is invoked. // We cannot use Find(), which traverses all items - potentially those that have been removed wxHashTable arLoadedPackages(wxKEY_STRING); - + wxBeginBusyCursor(); - + // generate the contents of the add/remove list boxes const std::vector & packages = m_CdlPkgData->get_packages (); std::vector::const_iterator package_i; @@ -1005,7 +1006,7 @@ void ecConfigToolDoc::SelectPackages () { const std::vector & aliases = m_CdlPkgData->get_package_aliases (* package_i); wxString strMacroName = package_i->c_str (); - + // use the first alias (if any) as the package identifier wxString strPackageName = aliases.size () ? aliases [0].c_str () : strMacroName.c_str(); ecConfigItem * pItem = Find (strMacroName); @@ -1023,28 +1024,28 @@ void ecConfigToolDoc::SelectPackages () } } } - + wxEndBusyCursor(); - + if (wxID_OK == dlg.ShowModal ()) { bool bChanged = FALSE; // until proved otherwise - + // determine whether each package has changed loaded/unloaded state for (package_i = packages.begin (); package_i != packages.end (); package_i++) // if (! m_CdlPkgData->is_hardware_package (* package_i)) // do not check hardware packages { const std::vector & aliases = m_CdlPkgData->get_package_aliases (* package_i); wxString strMacroName = package_i->c_str (); - + // use the first alias (if any) as the package identifier wxString strPackageName = aliases.size () ? aliases [0].c_str () : strMacroName.c_str(); - + ecConfigItem *pItem = (ecConfigItem *) arLoadedPackages.Get(strMacroName); //bool bPreviouslyLoaded=arLoadedPackages.Lookup(strMacroName,(void *&)pItem); bool bPreviouslyLoaded = (pItem != NULL); bool bNowLoaded=dlg.IsAdded (strPackageName); - + // unload packages which are no longer required before // loading new ones to avoid potential duplicate macro definitions if (! bNowLoaded && bPreviouslyLoaded){ @@ -1077,9 +1078,9 @@ void ecConfigToolDoc::SelectPackages () wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); } } - } + } } - + if (bChanged) {// at least one package was loaded, unloaded or changed version Modify(TRUE); wxGetApp().GetMainFrame()->UpdateFrameTitle(); @@ -1107,7 +1108,7 @@ wxString ecConfigToolDoc::GetDefaultHard #ifdef __WXMSW__ // get the greatest eCos version subkey wxConfig config(wxT("eCos"), wxT("Red Hat"), wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE); - + wxString versionKey(wxT("")); wxString key(wxT("")); long index; @@ -1116,10 +1117,10 @@ wxString ecConfigToolDoc::GetDefaultHard { if (wxIsdigit(key[0]) && versionKey.CompareTo(key) < 0) versionKey = key; - + bMore = config.GetNextGroup(key, index); } - + if (!versionKey.IsEmpty()) { wxString defaultHardware; @@ -1146,16 +1147,16 @@ void ecConfigToolDoc::EnableCallbacks (b CdlInferenceCallbackResult ecConfigToolDoc::CdlGlobalInferenceHandler(CdlTransaction transaction) { CdlInferenceCallbackResult rc=CdlInferenceCallbackResult_Continue; - + ecConfigToolDoc *pDoc = wxGetApp().GetConfigToolDoc(); pDoc->m_ConflictsOutcome=NotDone; // prepare for the case that there are no solutions - const std::list& conflicts=pDoc->GetCdlConfig()->get_all_conflicts(); + const std::list& conflicts=pDoc->GetCdlConfig()->get_all_conflicts(); ecResolveConflictsDialog dlg(wxGetApp().GetTopWindow(), conflicts, transaction, &pDoc->m_arConflictsOfInterest); rc = (wxID_OK == dlg.ShowModal()) ? CdlInferenceCallbackResult_Continue:CdlInferenceCallbackResult_Cancel; pDoc->m_ConflictsOutcome=(CdlInferenceCallbackResult_Continue==rc)?OK:Cancel; - + return rc; } @@ -1181,12 +1182,12 @@ CdlInferenceCallbackResult ecConfigToolD ecResolveConflictsDialog dlg(wxGetApp().GetTopWindow(), s_conflicts, transaction); int ret = dlg.ShowModal() ; - + wxGetApp().UnlockValues(); return (wxID_OK == ret ? CdlInferenceCallbackResult_Continue:CdlInferenceCallbackResult_Cancel); } - } + } wxGetApp().LockValues(); @@ -1240,9 +1241,9 @@ void ecConfigToolDoc::CdlTransactionHand { const wxString strName((*node_i)->get_class_name().c_str()); //TRACE(_T("%s %s : the legal_values list has changed, a new widget may be needed.\n"), - // CString ((*val_i)->get_class_name().c_str()), strName); + // CString ((*val_i)->get_class_name().c_str()), strName); } - + for (val_i = data.value_source_changes.begin(); val_i != data.value_source_changes.end(); val_i++) { const wxString strName((*val_i)->get_name().c_str()); @@ -1256,7 +1257,7 @@ void ecConfigToolDoc::CdlTransactionHand */ pControlView->Refresh (strName); } - + pDoc->UpdateFailingRuleCount(); nNesting--; } @@ -1264,19 +1265,19 @@ void ecConfigToolDoc::CdlTransactionHand bool ecConfigToolDoc::ShowURL(const wxString& strURL1) { bool rc = TRUE; - + wxString strURL(strURL1); -/* +/* if(!QualifyDocURL(strURL)){ return FALSE; // error message already output } */ - + switch (wxGetApp().GetSettings().m_eUseCustomBrowser) { case ecInternal: - rc = ShowInternalHtmlHelp(strURL); + rc = ShowInternalHtmlHelp(strURL); break; case ecAssociatedExternal: { @@ -1399,10 +1400,10 @@ bool ecConfigToolDoc::ShowExternalHtmlHe } return rc; -#else +#else wxMessageBox(_("Sorry, ShowHtmlHelp not yet implemented"), wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); return FALSE; -#endif +#endif } bool ecConfigToolDoc::ShowInternalHtmlHelp (const wxString& strURL) @@ -1471,10 +1472,10 @@ bool ecConfigToolDoc::ShowInternalHtmlHe } return rc; -#else +#else wxMessageBox(_("Sorry, ShowHtmlHelp not yet implemented"), wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); return FALSE; -#endif +#endif } const wxString ecConfigToolDoc::HTMLHelpLinkFileName() @@ -1501,7 +1502,7 @@ bool ecConfigToolDoc::QualifyDocURL(wxSt if (prefix) strURL = wxT("file://") + strURL; } - + if(0==strURL.Find(wxT("file://"))) { ecFileName strFile(strURL.Right(strURL.Length()-7)); @@ -1537,7 +1538,7 @@ wxString ecConfigToolDoc::GetPackageName if (aliases.size () && (strAlias == strPackageAlias)) return package_i->c_str (); } - return wxEmptyString; + return wxEmptyString; } const wxString ecConfigToolDoc::GetCurrentTargetPrefix() @@ -1569,7 +1570,7 @@ ecConfigToolDoc::GlobalConflictOutcome e CdlTransactionBody::set_inference_callback_fn(fn); if(NotDone==m_ConflictsOutcome){ // No solutions were available, but we'll run the dialog anyway - const std::list& conflicts=GetCdlConfig()->get_all_conflicts(); + const std::list& conflicts=GetCdlConfig()->get_all_conflicts(); ecResolveConflictsDialog dlg(wxGetApp().GetTopWindow(), conflicts, NULL, &m_arConflictsOfInterest); m_ConflictsOutcome = (wxID_OK == dlg.ShowModal())?OK:Cancel; } @@ -1622,11 +1623,11 @@ void ecConfigToolDoc::UpdateFailingRuleC if (GetCdlConfig ()) { // if configuration information - + // calculate the number of conflicts nCount = GetCdlConfig ()->get_all_conflicts ().size (); // GetCdlConfig ()->get_structural_conflicts ().size () + ignore for now - + // update the conflicts view if (wxGetApp().GetMainFrame() && wxGetApp().GetMainFrame()->GetConflictsWindow()) { @@ -1653,7 +1654,7 @@ void ecConfigToolDoc::LogConflicts (cons bool ecConfigToolDoc::SetValue (ecConfigItem &ti, double dValue, CdlTransaction transaction/*=NULL*/) { wxASSERT (ti.GetOptionType () == ecDouble); - + // test if the new double value is in range const CdlValuable valuable = ti.GetCdlValuable(); CdlListValue list_value; @@ -1671,10 +1672,10 @@ bool ecConfigToolDoc::SetValue (ecConfig if (wxNO == wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_QUESTION|wxYES_NO)) return FALSE; } - + if (! ti.SetValue (dValue,transaction)) return FALSE; - + Modify(TRUE); wxGetApp().GetMainFrame()->UpdateFrameTitle(); @@ -1695,7 +1696,7 @@ bool ecConfigToolDoc::SetValue(ecConfigI (IDCANCEL == CUtils::MessageBoxFT (MB_OKCANCEL, _T("Changes to the current memory layout will be lost.")))) return false; #endif - + bool rc = FALSE; switch(ti.GetOptionType()) @@ -1721,7 +1722,7 @@ bool ecConfigToolDoc::SetValue(ecConfigI default: wxASSERT(FALSE); break; - + } if(rc){ Modify(TRUE); @@ -1746,19 +1747,19 @@ bool ecConfigToolDoc::SetValue(ecConfigI wxASSERT(FALSE); break; } - + bool rc = FALSE; // TODO #if 0 bool bChangingMemmap = MemoryMap.map_modified () && ((ti.Macro ().Compare (_T ("CYG_HAL_STARTUP")) == 0)); #endif - + if(nValue==ti.Value()) { return TRUE; } - + // test if the new integer value is in range if (ecLong == ti.GetOptionType ()) { @@ -1778,17 +1779,17 @@ bool ecConfigToolDoc::SetValue(ecConfigI goto Exit; }; } - + // TODO #if 0 // warn the user if the current memory layout has been changed and will be lost // this will happen when the layout has been modified and the target-platform-startup is changed - + if (bChangingMemmap && IDCANCEL==CUtils::MessageBoxFT(MB_OKCANCEL,_T("Changes to the current memory layout will be lost."))){ goto Exit; } #endif - + // Save state if(!ti.SetValue(nValue,transaction)){ // CanSetValue above should have caught this @@ -1796,8 +1797,8 @@ bool ecConfigToolDoc::SetValue(ecConfigI msg.Printf(_("Cannot set '%s' to %d"), (const wxChar*) ti.GetItemNameOrMacro(), nValue); wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); goto Exit; - } - + } + rc = TRUE; Exit: if(rc) @@ -1816,7 +1817,7 @@ Exit: bool ecConfigToolDoc::SetEnabled(ecConfigItem &ti, bool bEnabled, CdlTransaction transaction/*=NULL*/) { const bool bStatus = ti.SetEnabled (bEnabled, transaction); - + if (bStatus) { Modify(TRUE); @@ -1934,7 +1935,7 @@ bool ecConfigToolDoc::SaveMemoryMap() rc=MemoryMap.export_files (strMLTInstallBase + _T(".ldi"), strMLTInstallBase + _T(".h")); } } - } + } return rc; #else return FALSE; @@ -1946,7 +1947,7 @@ bool ecConfigToolDoc::CopyMLTFiles() wxString sep(wxFILE_SEP_PATH); // copy default MLT files for the selected target/platform from the repository if they do not already exist - + // TRACE (_T("Looking for MLT files at %s\n"), PackagesDir() + m_strMemoryLayoutFolder + _T("include\\pkgconf\\mlt_*.*")); const ecFileName strInstallDestination(GetInstallTree () + sep + wxString(wxT("include")) + sep + wxT("pkgconf")); const ecFileName strMLTDestination (MLTDir ()); @@ -1988,7 +1989,7 @@ bool ecConfigToolDoc::CopyMLTFiles() } else // a .h or .ldi file { - if (!ecFileName (strInstallDestination, ecFileName (fileName)).Exists () && + if (!ecFileName (strInstallDestination, ecFileName (fileName)).Exists () && !wxCopyFile (fullPath, strInstallDestination + ecFileName (fileName))){ return FALSE; // message already emitted } @@ -2063,7 +2064,7 @@ bool ecConfigToolDoc::ImportFile() wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_EXCLAMATION|wxOK); return FALSE; } - + wxBusyCursor wait; AddAllItems (); // regenerate all the config items since the topology may have changed @@ -2093,7 +2094,7 @@ bool ecConfigToolDoc::SwitchMemoryLayout // copy default MLT save files for the selected target/platform from the repository to the build tree if they do not already exist CopyMLTFiles(); } - + if (m_strBuildTree.IsEmpty ()) // load the memory layout from the repository { wxString sep(wxFILE_SEP_PATH); @@ -2111,7 +2112,7 @@ bool ecConfigToolDoc::SwitchMemoryLayout { rc = NewMemoryLayout (MLTDir ()); } - + return TRUE; // FIXME } @@ -2125,7 +2126,7 @@ bool ecConfigToolDoc::NewMemoryLayout (c m_memoryMap.new_memory_layout (); // delete the old memory layout regardless if (! strFileName.IsEmpty ()) m_memoryMap.import_linker_defined_sections (strFileName); // read the linker-defined section names from the repository (failure is silent) - + wxString strMemoryLayoutFileName = strPrefix + sep + wxString(wxT("mlt_")) + CurrentMemoryLayout () + wxT(".mlt"); m_memoryMap.load_memory_layout (strMemoryLayoutFileName); // load the new memory layout (failure is silent) diff --git a/host/tools/configtool/standalone/wxwin/ecutils.cpp b/host/tools/configtool/standalone/wxwin/ecutils.cpp --- a/host/tools/configtool/standalone/wxwin/ecutils.cpp +++ b/host/tools/configtool/standalone/wxwin/ecutils.cpp @@ -70,6 +70,10 @@ #endif #endif +#ifdef __WXMSW__ +#include +#endif + #if 0 #define INCLUDEFILE @@ -1005,3 +1009,432 @@ bool wxWindowSettings::ApplyFontsToWindo } return TRUE; } + +#if TODO + +#ifdef _WIN32 +class wxProcessInfo: public wxObject +{ +public: + wxProcessInfo() {} + + wxProcessInfo *pParent; +#ifdef _WIN32 + __int64 tCreation; +#endif + Time tCpu; + int PID; + int PPID; + bool IsChildOf(int pid) const; +}; + +void wxSetProcessInfoParents(CSubprocess::PInfoArray &arPinfo) +{ + int i; + for(i=0;i<(signed)arPinfo.size();i++){ + PInfo &p=arPinfo[i]; + p.pParent=0; + for(int j=0;j<(signed)arPinfo.size();j++){ + if(arPinfo[j].PID==p.PPID +#ifdef _WIN32 + && arPinfo[j].tCreationpParent; + } + // If all is well, p should be NULL here. Otherwise we have a loop. + if(p){ + // Make sure it can't foul things up: + arPinfo[i].pParent=0; + bCircularity=true; + } + } + + if(bCircularity){ + ERROR(_T("!!! Circularly linked process list at index %d\n"),i); + for(int k=0;k<(signed)arPinfo.size();k++){ + const PInfo &p=arPinfo[k]; + ERROR(_T("%d: %s ppid=%4d\n"),k,(LPCTSTR)Name(p.PID),p.PPID); + } + } +} + +bool CSubprocess::PInfo::IsChildOf(int pid) const +{ + for(PInfo *p=pParent;p && p!=this;p=p->pParent) { // guard against circular linkage + if(p->PID==pid){ + return true; + } + } + return false; +} + + +bool wxGetChildProcesses(wxList& children) +{ + int osVersion = wxGetOsVersion() ; + HINSTANCE hInstLib1 = wxWINDOWS_NT==osVersion ? LoadLibrary(_T("PSAPI.DLL")):LoadLibrary(_T("Kernel32.DLL")) ; + HINSTANCE hInstLib2 = wxWINDOWS_NT==osVersion ? LoadLibrary(_T("NTDLL.DLL")):NULL; + + bool rc=false; + children.Clear(); + // If Windows NT: + switch (osVersion) + { + case wxWINDOWS_NT: + if(hInstLib1) + { + + // Get procedure addresses. + static BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * ) = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))GetProcAddress( hInstLib1, "EnumProcesses" ) ; + if (lpfEnumProcesses) + { + + if (hInstLib2) + { + + static DWORD (WINAPI *lpfNtQueryInformationProcess)( HANDLE, int, void *, DWORD, LPDWORD ) = + (DWORD(WINAPI *)(HANDLE, int, void *, DWORD, LPDWORD)) GetProcAddress( hInstLib2,"NtQueryInformationProcess" ) ; + + if(lpfNtQueryInformationProcess) + { + DWORD dwMaxPids=256; + DWORD dwPidSize; + DWORD *arPids = NULL ; + do { + delete [] arPids; + arPids=new DWORD[dwMaxPids]; + } while(lpfEnumProcesses(arPids, dwMaxPids, &dwPidSize) && dwPidSize/sizeof(DWORD)==dwMaxPids) ; + + if(dwPidSize/sizeof(DWORD)=0 && + TRUE==::GetProcessTimes (hProcess,(FILETIME *)&ftCreation,(FILETIME *)&ftExit,(FILETIME *)&ftKernel,(FILETIME *)&ftUser)){ + // The second test is important. It excludes orphaned processes who appear to have been adopted by virtue of a new + // process having been created with the same ID as their original parent. + wxProcessInfo* p = new wxProcessInfo; + p->PID=pid; + p->PPID=pbi.InheritedFromUniqueProcessId; + p->tCreation=ftCreation; + p->tCpu=Time((ftKernel+ftUser)/10000); + children.Append(p); + } + + CloseHandle(hProcess); + + } + } + } + delete [] arPids; + } + } + } + } + break; + case wxWIN95: + + if( hInstLib1) { + + static HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD)= + (HANDLE(WINAPI *)(DWORD,DWORD))GetProcAddress( hInstLib1,"CreateToolhelp32Snapshot" ) ; + static BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32)= + (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))GetProcAddress( hInstLib1, "Process32First" ) ; + static BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32)= + (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))GetProcAddress( hInstLib1, "Process32Next" ) ; + if( lpfProcess32Next && lpfProcess32First && lpfCreateToolhelp32Snapshot) { + + // Get a handle to a Toolhelp snapshot of the systems + // processes. + HANDLE hSnapShot = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) ; + if(INVALID_HANDLE_VALUE != hSnapShot) { + // Get the first process' information. + PROCESSENTRY32 procentry; + procentry.dwSize = sizeof(PROCESSENTRY32) ; + if(lpfProcess32First( hSnapShot, &procentry )){ + rc=true; + do { + PInfo p; + p.PID=procentry.th32ProcessID; + p.PPID=procentry.th32ParentProcessID; + arPinfo.push_back(p); + } while(lpfProcess32Next( hSnapShot, &procentry )); + } + CloseHandle(hSnapShot); + } + } + } + break; + default: + break; + } + + SetParents(children); + + if(!rc){ + wxMessageBox(_T("Couldn't get process information!\n")); + } + return rc; +} +#endif + +#endif + +#ifdef __WIN32__ +// This will be obsolete when we switch to using the version included +// in wxWindows (from wxWin 2.3.1 onwards) +enum ecKillError +{ + ecKILL_OK, // no error + ecKILL_BAD_SIGNAL, // no such signal + ecKILL_ACCESS_DENIED, // permission denied + ecKILL_NO_PROCESS, // no such process + ecKILL_ERROR // another, unspecified error +}; +#endif + +// ---------------------------------------------------------------------------- +// process management +// ---------------------------------------------------------------------------- + +#ifdef __WIN32__ + +// structure used to pass parameters from wxKill() to wxEnumFindByPidProc() +struct wxNewFindByPidParams +{ + wxNewFindByPidParams() { hwnd = 0; pid = 0; } + + // the HWND used to return the result + HWND hwnd; + + // the PID we're looking from + DWORD pid; +}; + +// wxKill helper: EnumWindows() callback which is used to find the first (top +// level) window belonging to the given process +static BOOL CALLBACK wxEnumFindByPidProc(HWND hwnd, LPARAM lParam) +{ + DWORD pid; + (void)::GetWindowThreadProcessId(hwnd, &pid); + + wxNewFindByPidParams *params = (wxNewFindByPidParams *)lParam; + if ( pid == params->pid ) + { + // remember the window we found + params->hwnd = hwnd; + + // return FALSE to stop the enumeration + return FALSE; + } + + // continue enumeration + return TRUE; +} + +// This will be obsolete when we switch to using the version included +// in wxWindows (from wxWin 2.3.1 onwards) +int wxNewKill(long pid, wxSignal sig, ecKillError *krc = NULL) +{ +#ifdef __WIN32__ + // get the process handle to operate on + HANDLE hProcess = ::OpenProcess(SYNCHRONIZE | + PROCESS_TERMINATE | + PROCESS_QUERY_INFORMATION, + FALSE, // not inheritable + (DWORD)pid); + if ( hProcess == NULL ) + { + if ( krc ) + { + if ( ::GetLastError() == ERROR_ACCESS_DENIED ) + { + *krc = ecKILL_ACCESS_DENIED; + } + else + { + *krc = ecKILL_NO_PROCESS; + } + } + + return -1; + } + + bool ok = TRUE; + switch ( sig ) + { + case wxSIGKILL: + // kill the process forcefully returning -1 as error code + if ( !::TerminateProcess(hProcess, (UINT)-1) ) + { + wxLogSysError(_("Failed to kill process %d"), pid); + + if ( krc ) + { + // this is not supposed to happen if we could open the + // process + *krc = ecKILL_ERROR; + } + + ok = FALSE; + } + break; + + case wxSIGNONE: + // do nothing, we just want to test for process existence + break; + + default: + // any other signal means "terminate" + { + wxNewFindByPidParams params; + params.pid = (DWORD)pid; + + // EnumWindows() has nice semantics: it returns 0 if it found + // something or if an error occured and non zero if it + // enumerated all the window + if ( !::EnumWindows(wxEnumFindByPidProc, (LPARAM)¶ms) ) + { + // did we find any window? + if ( params.hwnd ) + { + // tell the app to close + // + // NB: this is the harshest way, the app won't have + // opportunity to save any files, for example, but + // this is probably what we want here. If not we + // can also use SendMesageTimeout(WM_CLOSE) + if ( !::PostMessage(params.hwnd, WM_QUIT, 0, 0) ) + { + wxLogLastError(_T("PostMessage(WM_QUIT)")); + } + } + else // it was an error then + { + wxLogLastError(_T("EnumWindows")); + + ok = FALSE; + } + } + else // no windows for this PID + { + if ( krc ) + { + *krc = ecKILL_ERROR; + } + + ok = FALSE; + } + } + } + + // the return code + DWORD rc; + + if ( ok ) + { + // as we wait for a short time, we can use just WaitForSingleObject() + // and not MsgWaitForMultipleObjects() + switch ( ::WaitForSingleObject(hProcess, 500 /* msec */) ) + { + case WAIT_OBJECT_0: + // process terminated + if ( !::GetExitCodeProcess(hProcess, &rc) ) + { + wxLogLastError(_T("GetExitCodeProcess")); + } + break; + + default: + wxFAIL_MSG( _T("unexpected WaitForSingleObject() return") ); + // fall through + + case WAIT_FAILED: + wxLogLastError(_T("WaitForSingleObject")); + // fall through + + case WAIT_TIMEOUT: + if ( krc ) + { + *krc = ecKILL_ERROR; + } + + rc = STILL_ACTIVE; + break; + } + } + else // !ok + { + // just to suppress the warnings about uninitialized variable + rc = 0; + } + + ::CloseHandle(hProcess); + + // the return code is the same as from Unix kill(): 0 if killed + // successfully or -1 on error + if ( sig == wxSIGNONE ) + { + if ( ok && rc == STILL_ACTIVE ) + { + // there is such process => success + return 0; + } + } + else // not SIGNONE + { + if ( ok && rc != STILL_ACTIVE ) + { + // killed => success + return 0; + } + } +#else // Win15 + wxFAIL_MSG( _T("not implemented") ); +#endif // Win32/Win16 + + // error + return -1; +} +#endif + +int ecKill(long pid, wxSignal sig) +{ +#ifdef __UNIX__ + return wxKill(pid, sig); +#elif defined(__WXMSW__) + return wxNewKill(pid, sig); +#else + return -1; +#endif +} + diff --git a/host/tools/configtool/standalone/wxwin/ecutils.h b/host/tools/configtool/standalone/wxwin/ecutils.h --- a/host/tools/configtool/standalone/wxwin/ecutils.h +++ b/host/tools/configtool/standalone/wxwin/ecutils.h @@ -203,6 +203,9 @@ void wxRefreshControls(wxWindow* win); // e.g. opt_ecos_ecos-1.4.5 out of /opt/ecos/ecos-1.4.5 wxString ecMakeNameFromPath(const wxString& path); +// Kill a process +int ecKill(long pid, wxSignal sig); + class WXDLLEXPORT wxOutputStream; wxOutputStream& operator <<(wxOutputStream&, const wxString& s); 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.42 2001/05/16 16:08:24 julians Exp $ +// Version: $Id: mainwin.cpp,v 1.43 2001/06/18 14:41:13 julians Exp $ // Purpose: // Description: Implementation file for the ConfigTool main window // Requires: @@ -1508,7 +1508,11 @@ void ecMainFrame::OnBuildTests(wxCommand void ecMainFrame::OnStopBuild(wxCommandEvent& event) { if (wxGetApp().m_pipedProcess) + { + long pid = wxGetApp().m_pipedProcess->GetPid(); wxGetApp().m_pipedProcess->Detach(); + ecKill(pid, wxSIGKILL); + } } void ecMainFrame::OnClean(wxCommandEvent& event) diff --git a/host/tools/configtool/standalone/wxwin/setup/configtool.iss b/host/tools/configtool/standalone/wxwin/setup/configtool.iss --- a/host/tools/configtool/standalone/wxwin/setup/configtool.iss +++ b/host/tools/configtool/standalone/wxwin/setup/configtool.iss @@ -4,13 +4,13 @@ [Setup] MinVersion=4.0,4.0 - AppName=eCos Configuration Tool 2.01 + AppName=eCos Configuration Tool 2.02 AppId=eCos Configuration Tool CreateUninstallRegKey=1 UsePreviousAppDir=1 UsePreviousGroup=1 - AppVersion=2.01 - AppVerName=eCos Configuration Tool 2.01 + AppVersion=2.02 + AppVerName=eCos Configuration Tool 2.02 AppCopyright=Copyright © Red Hat Inc., 2001 BackColor=$FF0000 BackColor2=$000000 @@ -183,7 +183,7 @@ Source: v:\deliver\configtool\README.txt; DestDir: {app}\ Source: v:\deliver\configtool\rhlogo.png; DestDir: {app}\ - Source: c:\winnt\system32\tcl82.dll; DestDir: {sys}\; DestName: tcl82.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall + Source: c:\winnt\system32\tcl84.dll; DestDir: {sys}\; DestName: tcl84.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall Source: c:\winnt\system32\msvcirt.dll; DestDir: {sys}\; DestName: msvcirt.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall Source: c:\winnt\system32\msvcp60.dll; DestDir: {sys}\; DestName: msvcp60.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall Source: c:\winnt\system32\msvcrt.dll; DestDir: {sys}\; DestName: msvcrt.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall @@ -214,7 +214,7 @@ ; DO NOT DELETE THEM or you may be unable to reload the script ;[ScriptSetup] -;VerNum=2.01 +;VerNum=2.02 ;InnoVer=1.3 ;AddVerTo=AppVerName ;SetupFilename=setup.exe diff --git a/host/tools/configtool/standalone/wxwin/setup/innobott.txt b/host/tools/configtool/standalone/wxwin/setup/innobott.txt --- a/host/tools/configtool/standalone/wxwin/setup/innobott.txt +++ b/host/tools/configtool/standalone/wxwin/setup/innobott.txt @@ -1,4 +1,4 @@ - Source: c:\winnt\system32\tcl82.dll; DestDir: {sys}\; DestName: tcl82.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall + Source: c:\winnt\system32\tcl84.dll; DestDir: {sys}\; DestName: tcl84.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall Source: c:\winnt\system32\msvcirt.dll; DestDir: {sys}\; DestName: msvcirt.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall Source: c:\winnt\system32\msvcp60.dll; DestDir: {sys}\; DestName: msvcp60.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall Source: c:\winnt\system32\msvcrt.dll; DestDir: {sys}\; DestName: msvcrt.dll; CopyMode: onlyifdoesntexist; Flags: uninsneveruninstall 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.3 2001/06/11 14:36:05 julians Exp $ +// Version: $Id: symbols.h,v 1.4 2001/06/18 14:41:13 julians Exp $ // Purpose: // Description: Some important symbols, such as the version // Requires: @@ -43,5 +43,5 @@ // //=========================================================================== -#define ecCONFIGURATION_TOOL_VERSION 2.01 +#define ecCONFIGURATION_TOOL_VERSION 2.02 #define ecCONFIGURATION_TOOL_VERSION_STRING "2.01" diff --git a/packages/ChangeLog b/packages/ChangeLog --- a/packages/ChangeLog +++ b/packages/ChangeLog @@ -1,3 +1,16 @@ +2001-06-22 Hugo Tyson + + * ecos.db: Add entry for generic SMSC lan91cxx ethernet controller. + +2001-06-21 Jonathan Larmour + + * pkgconf/rules.mak: Use sed to process dependency files in a way + that will work with both new and old format gcc dependency files. + + * ecos.db: Include CYGPKG_DEVS_ETH_CF and CYGPKG_DEVS_ETH_NS_DP83902A + packages in those targets which can use them. + Make CYGPKG_DEVS_ETH_CF have hardware attribute. + 2001-06-08 Jonathan Larmour * ecos.db: PC target uses generic 16x5x serial driver now. diff --git a/packages/devs/eth/arm/edb7xxx/current/ChangeLog b/packages/devs/eth/arm/edb7xxx/current/ChangeLog --- a/packages/devs/eth/arm/edb7xxx/current/ChangeLog +++ b/packages/devs/eth/arm/edb7xxx/current/ChangeLog @@ -1,3 +1,8 @@ +2001-06-19 Jonathan Larmour + + * src/if_edb7xxx.c (edb7xxx_cs8900_init): Don't retrieve ESA if + it's been set in the config. + 2001-01-30 Gary Thomas * src/if_edb7xxx.c: New RedBoot config data layout. diff --git a/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c b/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c --- a/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c +++ b/packages/devs/eth/arm/edb7xxx/current/src/if_edb7xxx.c @@ -205,7 +205,7 @@ edb7xxx_cs8900_init(struct cyg_netdevtab defined(CYGSEM_REDBOOT_FLASH_CONFIG) && \ !defined(CYGSEM_ARM_EDB7XXX_SET_ESA) flash_get_config("edb7xxx_esa", enaddr, CONFIG_ESA); -#else +#elif !defined(CYGSEM_ARM_EDB7XXX_SET_ESA) for (i = 0; i < ETHER_ADDR_LEN; i += 2) { unsigned short esa_reg = get_reg(PP_IA+i); enaddr[i] = esa_reg & 0xFF; diff --git a/packages/devs/eth/cf/current/ChangeLog b/packages/devs/eth/cf/current/ChangeLog --- a/packages/devs/eth/cf/current/ChangeLog +++ b/packages/devs/eth/cf/current/ChangeLog @@ -1,3 +1,18 @@ +2001-06-16 Jesper Skov + + * src/if_sc_lpe.c: Use generic DP83902A driver, only redefining + the init function to handle card details (which incidently do not + appear to be fully working). + + * include/devs_eth_cf.inl: Device details moved here so the + generic driver can access them. + + * cdl/cf_eth_drivers.cdl: Changes to use generic driver. Allow ESA + to be configured. + Require DP83902A package. + + * src/dp8390.h: Deleted. + 2001-04-13 Gary Thomas * src/if_sc_lpe.c (sc_lpe_card_handler): Work around broken card(s) diff --git a/packages/devs/eth/cf/current/cdl/cf_eth_drivers.cdl b/packages/devs/eth/cf/current/cdl/cf_eth_drivers.cdl --- a/packages/devs/eth/cf/current/cdl/cf_eth_drivers.cdl +++ b/packages/devs/eth/cf/current/cdl/cf_eth_drivers.cdl @@ -24,7 +24,7 @@ # # The Initial Developer of the Original Code is Red Hat. # Portions created by Red Hat are -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +# Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. # All Rights Reserved. # ------------------------------------------- # @@ -33,8 +33,7 @@ ######DESCRIPTIONBEGIN#### # # Author(s): gthomas -# Original data: gthomas -# Contributors: +# Contributors: gthomas, jskov # Date: 2000-07-07 # #####DESCRIPTIONEND#### @@ -47,16 +46,64 @@ cdl_package CYGPKG_DEVS_ETH_CF { parent CYGPKG_IO_ETH_DRIVERS active_if CYGPKG_IO_ETH_DRIVERS active_if CYGPKG_IO_PCMCIA + requires CYGPKG_DEVS_ETH_NS_DP83902A implements CYGHWR_NET_DRIVERS implements CYGHWR_NET_DRIVER_ETH0 - include_dir . - include_files ; # none _exported_ whatsoever + include_dir cyg/io description "Ethernet driver for various PCMCIA (Compact Flash) boards." compile -library=libextras.a if_sc_lpe.c + # FIXME: This really belongs in the NS DP83902A package + cdl_interface CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED { + display "NS DP83902A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_CF_ETH0 { + display "CF ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for a + CF card." + + implements CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_CF_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_CF_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + default_value 0 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware does + not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_CF_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } + cdl_component CYGPKG_DEVS_ETH_CF_OPTIONS { - display "Cirrus Logic ethernet driver build options" + display "PCMCIA ethernet driver build options" flavor none no_define @@ -67,7 +114,7 @@ cdl_package CYGPKG_DEVS_ETH_CF { default_value { "-D_KERNEL -D__ECOS" } description " This option modifies the set of compiler flags for - building the Cirrus Logic ethernet driver package. + building the PCMCIA ethernet driver package. These flags are used in addition to the set of global flags." } diff --git a/packages/devs/eth/cf/current/include/devs_eth_cf.inl b/packages/devs/eth/cf/current/include/devs_eth_cf.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/cf/current/include/devs_eth_cf.inl @@ -0,0 +1,95 @@ +//========================================================================== +// +// devs_eth_cf.inl +// +// CF (PCMCIA) ethernet I/O definitions. +// +//========================================================================== +//####COPYRIGHTBEGIN#### +// +// ------------------------------------------- +// The contents of this file are subject to the Red Hat eCos Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.redhat.com/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations under +// the License. +// +// The Original Code is eCos - Embedded Configurable Operating System, +// released September 30, 1998. +// +// The Initial Developer of the Original Code is Red Hat. +// Portions created by Red Hat are +// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. +// All Rights Reserved. +// ------------------------------------------- +// +//####COPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-15 +// Purpose: PCMCIA ethernet defintions +// +//####DESCRIPTIONEND#### +//========================================================================== + +#include // CYGNUM_HAL_INTERRUPT_ETHR +#include +#include +#include + +#ifdef __WANT_CONFIG + +#undef CYGHWR_NS_DP83902A_PLF_INT_CLEAR +#define CYGHWR_NS_DP83902A_PLF_INT_CLEAR(_dp_) \ + CYG_MACRO_START \ + struct cf_slot* slot = (struct cf_slot*) (_dp_)->plf_priv; \ + cf_clear_interrupt(slot); \ + CYG_MACRO_END + +#endif // __WANT_CONFIG + +#ifdef __WANT_DEVS + +externC int cyg_sc_lpe_int_vector(struct eth_drv_sc *sc); +externC bool cyg_sc_lpe_init(struct cyg_netdevtab_entry *tab); + +#ifdef CYGPKG_DEVS_ETH_CF_ETH0 + +static dp83902a_priv_data_t dp83902a_eth0_priv_data = { +#ifdef CYGSEM_DEVS_ETH_CF_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_CF_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +#endif +}; + +ETH_DRV_SC(dp83902a_sc, + &dp83902a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_CF_ETH0_NAME, + dp83902a_start, + dp83902a_stop, + dp83902a_control, + dp83902a_can_send, + dp83902a_send, + dp83902a_recv, + dp83902a_deliver, // "pseudoDSR" called from fast net thread + dp83902a_poll, // poll function, encapsulates ISR and DSR + cyg_sc_lpe_int_vector); + +NETDEVTAB_ENTRY(dp83902a_netdev, + "dp83902a_" CYGDAT_DEVS_ETH_CF_ETH0_NAME, + cyg_sc_lpe_init, + &dp83902a_sc); +#endif // CYGPKG_DEVS_ETH_CF_ETH0 + +#endif // __WANT_DEVS + +// EOF devs_eth_cf.inl diff --git a/packages/devs/eth/cf/current/src/dp8390.h b/packages/devs/eth/cf/current/src/dp8390.h deleted file mode 100644 --- a/packages/devs/eth/cf/current/src/dp8390.h +++ /dev/null @@ -1,243 +0,0 @@ -//========================================================================== -// -// dev/dp8390.h -// -// National Semiconductor ethernet chip -// -//========================================================================== -//####COPYRIGHTBEGIN#### -// -// ------------------------------------------- -// The contents of this file are subject to the Red Hat eCos Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License at -// http://www.redhat.com/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the -// License for the specific language governing rights and limitations under -// the License. -// -// The Original Code is eCos - Embedded Configurable Operating System, -// released September 30, 1998. -// -// The Initial Developer of the Original Code is Red Hat. -// Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. -// All Rights Reserved. -// ------------------------------------------- -// -//####COPYRIGHTEND#### -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-07-07 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -typedef volatile union { - union { - struct { - unsigned char cr; - unsigned char clda0; - unsigned char clda1; - unsigned char bndry; - unsigned char tsr; - unsigned char ncr; - unsigned char fifo; - unsigned char isr; - unsigned char crda0; - unsigned char crda1; - unsigned char _reserved[2]; - unsigned char rsr; - unsigned char fer; - unsigned char cer; - unsigned char missed; - unsigned char data; - unsigned char _reserved2[14]; - unsigned char reset; - } page0; - struct { - unsigned char cr; - unsigned char par[6]; - unsigned char curp; - unsigned char mar[8]; - } page1; - struct { - unsigned char cr; - unsigned char pstart; - unsigned char pstop; - unsigned char rnpp; - unsigned char tpsr; - unsigned char lnpp; - unsigned char ach; - unsigned char acl; - unsigned char _reserved[4]; - unsigned char rcr; - unsigned char tcr; - unsigned char dcr; - unsigned char imr; - } page2; - unsigned char data; - } r; // Read registers - union { - struct { - unsigned char cr; - unsigned char pstart; - unsigned char pstop; - unsigned char bndry; - unsigned char tpsr; - unsigned char tbcl; - unsigned char tbch; - unsigned char isr; - unsigned char rsal; - unsigned char rsah; - unsigned char rbcl; - unsigned char rbch; - unsigned char rcr; - unsigned char tcr; - unsigned char dcr; - unsigned char imr; - unsigned char data; - unsigned char _reserved[14]; - unsigned char reset; - } page0; - struct { - unsigned char cr; - unsigned char par[6]; - unsigned char curp; - unsigned char mar[8]; - } page1; - struct { - unsigned char cr; - unsigned char clda0; - unsigned char clda1; - unsigned char rnpp; - unsigned char tpsr; - unsigned char lnpp; - unsigned char ach; - unsigned char acl; - unsigned char _reserved[8]; - } page2; - } w; // Write registers -} dp8390_regs; // __attribute__ ((aligned(1), packed)); - -// Command register - common to all pages - -#define DP8390_CR_STOP 0x01 // Stop: software reset -#define DP8390_CR_START 0x02 // Start: initialize device -#define DP8390_CR_TXPKT 0x04 // Transmit packet -#define DP8390_CR_RDMA 0x08 // Read DMA (recv data from device) -#define DP8390_CR_WDMA 0x10 // Write DMA (send data to device) -#define DP8390_CR_SEND 0x18 // Send packet -#define DP8390_CR_NODMA 0x20 // Remote (or no) DMA -#define DP8390_CR_PAGE0 0x00 // Page select -#define DP8390_CR_PAGE1 0x40 -#define DP8390_CR_PAGE2 0x80 -#define DP8390_CR_PAGEMSK 0x3F // Used to mask out page bits - -// Data configuration register - -#define DP8390_DCR_WTS 0x01 // 1=16 bit word transfers -#define DP8390_DCR_BOS 0x02 // 1=Little Endian -#define DP8390_DCR_LAS 0x04 // 1=Single 32 bit DMA mode -#define DP8390_DCR_LS 0x08 // 1=normal mode, 0=loopback -#define DP8390_DCR_ARM 0x10 // 0=no send command (program I/O) -#define DP8390_DCR_FIFO_1 0x00 // FIFO threshold -#define DP8390_DCR_FIFO_2 0x20 -#define DP8390_DCR_FIFO_4 0x40 -#define DP8390_DCR_FIFO_6 0x60 - -#define DP8390_DCR_INIT (DP8390_DCR_LS|DP8390_DCR_FIFO_4) - -// Interrupt status register - -#define DP8390_ISR_RxP 0x01 // Packet received -#define DP8390_ISR_TxP 0x02 // Packet transmitted -#define DP8390_ISR_RxE 0x04 // Receive error -#define DP8390_ISR_TxE 0x08 // Transmit error -#define DP8390_ISR_OFLW 0x10 // Receive overflow -#define DP8390_ISR_CNT 0x20 // Tally counters need emptying -#define DP8390_ISR_RDC 0x40 // Remote DMA complete -#define DP8390_ISR_RESET 0x80 // Device has reset (shutdown, error) - -// Interrupt mask register - -#define DP8390_IMR_RxP 0x01 // Packet received -#define DP8390_IMR_TxP 0x02 // Packet transmitted -#define DP8390_IMR_RxE 0x04 // Receive error -#define DP8390_IMR_TxE 0x08 // Transmit error -#define DP8390_IMR_OFLW 0x10 // Receive overflow -#define DP8390_IMR_CNT 0x20 // Tall counters need emptying -#define DP8390_IMR_RDC 0x40 // Remote DMA complete - -#define DP8390_IMR_All 0x3F // Everything but remote DMA - -// Receiver control register - -#define DP8390_RCR_SEP 0x01 // Save bad(error) packets -#define DP8390_RCR_AR 0x02 // Accept runt packets -#define DP8390_RCR_AB 0x04 // Accept broadcast packets -#define DP8390_RCR_AM 0x08 // Accept multicast packets -#define DP8390_RCR_PROM 0x10 // Promiscuous mode -#define DP8390_RCR_MON 0x20 // Monitor mode - 1=accept no packets - -// Receiver status register - -#define DP8390_RSR_RxP 0x01 // Packet received -#define DP8390_RSR_CRC 0x02 // CRC error -#define DP8390_RSR_FRAME 0x04 // Framing error -#define DP8390_RSR_FO 0x08 // FIFO overrun -#define DP8390_RSR_MISS 0x10 // Missed packet -#define DP8390_RSR_PHY 0x20 // 0=pad match, 1=mad match -#define DP8390_RSR_DIS 0x40 // Receiver disabled -#define DP8390_RSR_DFR 0x80 // Receiver processing deferred - -// Transmitter control register - -#define DP8390_TCR_NOCRC 0x01 // 1=inhibit CRC -#define DP8390_TCR_NORMAL 0x00 // Normal transmitter operation -#define DP8390_TCR_LOCAL 0x02 // Internal NIC loopback -#define DP8390_TCR_INLOOP 0x04 // Full internal loopback -#define DP8390_TCR_OUTLOOP 0x08 // External loopback -#define DP8390_TCR_ATD 0x10 // Auto transmit disable -#define DP8390_TCR_OFFSET 0x20 // Collision offset adjust - -// Transmit status register - -#define DP8390_TSR_TxP 0x01 // Packet transmitted -#define DP8390_TSR_COL 0x04 // Collision (at least one) -#define DP8390_TSR_ABT 0x08 // Aborted because of too many collisions -#define DP8390_TSR_CRS 0x10 // Lost carrier -#define DP8390_TSR_FU 0x20 // FIFO underrun -#define DP8390_TSR_CDH 0x40 // Collision Detect Heartbeat -#define DP8390_TSR_OWC 0x80 // Collision outside normal window - -// Page (buffer) allocation -#define DP8390_TX_BUF1 0x40 -#define DP8390_TX_BUF2 0x48 -#define DP8390_RX_START 0x50 -#define DP8390_RX_STOP 0x80 - -#define IEEE_8023_MAX_FRAME 1518 // Largest possible ethernet frame -#define IEEE_8023_MIN_FRAME 64 // Smallest possible ethernet frame - -#define SC_LPE_MANUF 0x0104 - diff --git a/packages/devs/eth/cf/current/src/if_sc_lpe.c b/packages/devs/eth/cf/current/src/if_sc_lpe.c --- a/packages/devs/eth/cf/current/src/if_sc_lpe.c +++ b/packages/devs/eth/cf/current/src/if_sc_lpe.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. // ------------------------------------------- // @@ -42,7 +42,7 @@ //#####DESCRIPTIONBEGIN#### // // Author(s): gthomas -// Contributors: gthomas +// Contributors: gthomas, jskov // Date: 2000-07-07 // Purpose: // Description: hardware driver for LPCF+ ethernet @@ -68,44 +68,14 @@ #define diag_printf printf #endif -#include "dp8390.h" - -struct sc_lpe_priv_data { - struct cf_slot *slot; - dp8390_regs *regs; - int tx_next; // First free Tx page - int tx_int; // Expecting interrupt from this buffer - int rx_next; // First free Rx page - int tx1, tx2; // Page numbers for Tx buffers - unsigned long tx1_key, tx2_key; // Used to ack when packet sent - int tx1_len, tx2_len; - bool tx_started, running; - struct cyg_netdevtab_entry *tab; -} _sc_lpe_priv_data; +#include -ETH_DRV_SC(sc_lpe_sc, - &_sc_lpe_priv_data, // Driver specific data - "eth0", // Name for this interface - sc_lpe_start, - sc_lpe_stop, - sc_lpe_control, - sc_lpe_can_send, - sc_lpe_send, - sc_lpe_recv, - sc_lpe_int, // deliver function, called from fast net thread - sc_lpe_int, - sc_lpe_int_vector - ); +#define DP_DATA 0x10 +#define DP_CARD_RESET 0x1f -NETDEVTAB_ENTRY(sc_lpe_netdev, - "sc_lpe", - sc_lpe_init, - &sc_lpe_sc); +#define SC_LPE_MANUF 0x0104 -// Updated to actual address when card is inserted -static unsigned char enaddr[] = { 0x00, 0xC0, 0x1B, 0x04, 0x31, 0xEE}; -static void sc_lpe_int(struct eth_drv_sc *sc); #ifdef CYGPKG_NET #define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL @@ -137,20 +107,20 @@ static int sc_lpe_card_handler(cyg_addrword_t param) { struct eth_drv_sc *sc = (struct eth_drv_sc *)param; - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; + dp83902a_priv_data_t *dp = (dp83902a_priv_data_t*)sc->driver_private; struct cf_slot *slot; struct cf_cftable cftable; struct cf_config config; int i, len, ptr, cor = 0; unsigned char buf[256], *cp; - dp8390_regs *regs; + cyg_uint8* base; unsigned char *vers_product, *vers_manuf, *vers_revision, *vers_date; #ifndef CYGPKG_NET int tries = 0; #endif bool first = true; - slot = dp->slot; + slot = (struct cf_slot*)dp->plf_priv; cyg_drv_dsr_lock(); while (true) { cyg_drv_dsr_unlock(); // Give DSRs a chance to run (card insertion) @@ -206,22 +176,39 @@ sc_lpe_card_handler(cyg_addrword_t param // Fetch hardware address from card - terrible, but not well defined // Note: at least one card has been known to not have a valid ESA anywhere - if (slot->attr[0x1C0] != (unsigned char)0xFF) { - for (i = 0; i < ETHER_ADDR_LEN; i++) { - enaddr[i] = slot->attr[0x1C0+(i*2)]; + if (!dp->hardwired_esa) { + if (slot->attr[0x1C0] != (unsigned char)0xFF) { + for (i = 0; i < ETHER_ADDR_LEN; i++) + dp->esa[i] = slot->attr[0x1C0+(i*2)]; + } else { + diag_printf("No valid ESA found in CIS! Hardwiring to 08:88:87:65:43:21\n"); + dp->esa[0] = 0x08; + dp->esa[1] = 0x88; + dp->esa[2] = 0x87; + dp->esa[3] = 0x65; + dp->esa[4] = 0x43; + dp->esa[5] = 0x21; } } ptr = 0; if (cf_get_CIS(slot, CF_CISTPL_CFTABLE_ENTRY, buf, &len, &ptr)) { if (cf_parse_cftable(buf, len, &cftable)) { - dp->regs = regs = (dp8390_regs *)&dp->slot->io[cftable.io_space.base[0]]; + cyg_uint8 tmp; + // Initialize dp83902a IO details + dp->base = base = (cyg_uint8*)&slot->io[cftable.io_space.base[0]]; + dp->data = base + DP_DATA; + dp->interrupt = slot->int_num; cf_set_COR(slot, cor, cftable.cor); - // Reset card (read issues RESET, write clears it) - regs->w.page0.reset = regs->r.page0.reset; - while ((regs->r.page0.isr & DP8390_ISR_RESET) == 0) ; // Wait for card + // Reset card (read issues RESET, write clears it) + HAL_READ_UINT8(base+DP_CARD_RESET, tmp); + HAL_WRITE_UINT8(base+DP_CARD_RESET, tmp); + // Wait for card + do { + DP_IN(base, DP_ISR, tmp); + } while (0 == (tmp & DP_ISR_RESET)); // Initialize upper level driver - (sc->funs->eth_drv->init)(sc, enaddr); + (sc->funs->eth_drv->init)(sc, dp->esa); // Tell system card is ready to talk dp->tab->status = CYG_NETDEVTAB_STATUS_AVAIL; #ifndef CYGPKG_NET @@ -255,14 +242,15 @@ sc_lpe_card_handler(cyg_addrword_t param } } -static bool -sc_lpe_init(struct cyg_netdevtab_entry *tab) +bool +cyg_sc_lpe_init(struct cyg_netdevtab_entry *tab) { struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance; - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; + dp83902a_priv_data_t *dp = (dp83902a_priv_data_t *)sc->driver_private; + struct cf_slot* slot; cf_init(); // Make sure Compact Flash subsystem is initialized - dp->slot = cf_get_slot(0); + slot = dp->plf_priv = (void*)cf_get_slot(0); dp->tab = tab; #ifdef CYGPKG_NET @@ -280,7 +268,7 @@ sc_lpe_init(struct cyg_netdevtab_entry * // Initialize environment, setup interrupt handler // eth_drv_dsr is used to tell the fast net thread to run the deliver funcion. - cf_register_handler(dp->slot, eth_drv_dsr, sc); + cf_register_handler(slot, eth_drv_dsr, sc); return false; // Device is not ready until inserted, powered up, etc. #else @@ -289,324 +277,11 @@ sc_lpe_init(struct cyg_netdevtab_entry * #endif } -static void -sc_lpe_stop(struct eth_drv_sc *sc) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - - regs->w.page0.cr = DP8390_CR_PAGE0 | DP8390_CR_NODMA | DP8390_CR_STOP; // Brutal - regs->w.page0.isr = 0xFF; // Clear any pending interrupts - regs->w.page0.imr = 0x00; // Disable all interrupts - dp->running = false; -} - -// -// This function is called to "start up" the interface. It may be called -// multiple times, even when the hardware is already running. It will be -// called whenever something "hardware oriented" changes and should leave -// the hardware ready to send/receive packets. -// -static void -sc_lpe_start(struct eth_drv_sc *sc, unsigned char *enaddr, int flags) +int +cyg_sc_lpe_int_vector(struct eth_drv_sc *sc) { - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - int i; - - regs->w.page0.cr = DP8390_CR_PAGE0 | DP8390_CR_NODMA | DP8390_CR_STOP; // Brutal - regs->w.page0.dcr = DP8390_DCR_INIT; - regs->w.page0.rbch = 0; // Remote byte count - regs->w.page0.rbcl = 0; - regs->w.page0.rcr = DP8390_RCR_MON; // Accept no packets - regs->w.page0.tcr = DP8390_TCR_LOCAL; // Transmitter [virtually] off - regs->w.page0.tpsr = DP8390_TX_BUF1; // Transmitter start page - dp->tx1 = dp->tx2 = 0; - dp->tx_next = DP8390_TX_BUF1; - dp->tx_started = false; - regs->w.page0.pstart = DP8390_RX_START; // Receive ring start page - regs->w.page0.bndry = DP8390_RX_STOP-1; // Receive ring boundary - regs->w.page0.pstop = DP8390_RX_STOP; // Receive ring end page - dp->rx_next = DP8390_RX_START-1; - regs->w.page0.isr = 0xFF; // Clear any pending interrupts - regs->w.page0.imr = DP8390_IMR_All; // Enable all interrupts - regs->w.page0.cr = DP8390_CR_NODMA | DP8390_CR_PAGE1; // Select page 1 - regs->w.page1.curp = DP8390_RX_START; // Current page - next free page for Rx - for (i = 0; i < ETHER_ADDR_LEN; i++) { - regs->w.page1.par[i] = enaddr[i]; - } - // Enable and start device - regs->w.page0.cr = DP8390_CR_NODMA | DP8390_CR_START; - regs->w.page0.tcr = DP8390_TCR_NORMAL; // Normal transmit operations - regs->w.page0.rcr = DP8390_RCR_AB; // Accept broadcast, no errors, no multicast - dp->running = true; -} - -// -// This routine is called to perform special "control" opertions -// -static int -sc_lpe_control(struct eth_drv_sc *sc, unsigned long key, - void *data, int data_len) -{ - switch (key) { - case ETH_DRV_SET_MAC_ADDRESS: - return 0; - break; - default: - return 1; - break; - } -} - -// -// This routine is called to see if it is possible to send another packet. -// It will return non-zero if a transmit is possible, zero otherwise. -// -static int -sc_lpe_can_send(struct eth_drv_sc *sc) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - return ((dp->tx1 == 0) || (dp->tx2 == 0)); -} - -// -// This routine is called to start the transmitter. It is split out from the -// data handling routine so it may be called either when data becomes first -// available or when an Tx interrupt occurs -// - -static void -sc_lpe_start_xmit(struct eth_drv_sc *sc, int start_page, int len) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - - regs->w.page0.cr = DP8390_CR_PAGE0 | DP8390_CR_NODMA | DP8390_CR_START; - regs->w.page0.tbcl = len & 0xFF; - regs->w.page0.tbch = len >> 8; - regs->w.page0.tpsr = start_page; - regs->w.page0.cr = DP8390_CR_NODMA | DP8390_CR_TXPKT | DP8390_CR_START; - dp->tx_started = true; -} - -// -// This routine is called to send data to the hardware. It is known a-priori -// that there is free buffer space (dp->tx_next). -// -static void -sc_lpe_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len, - int total_len, unsigned long key) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - int i, len, start_page, pkt_len; - unsigned char *data; + dp83902a_priv_data_t *dp = (dp83902a_priv_data_t *)sc->driver_private; + struct cf_slot* slot = (struct cf_slot*)dp->plf_priv; - pkt_len = total_len; - if (pkt_len < IEEE_8023_MIN_FRAME) pkt_len = IEEE_8023_MIN_FRAME; - start_page = dp->tx_next; - if (dp->tx_next == DP8390_TX_BUF1) { - dp->tx1 = start_page; - dp->tx1_len = pkt_len; - dp->tx1_key = key; - dp->tx_next = DP8390_TX_BUF2; - } else { - dp->tx2 = start_page; - dp->tx2_len = pkt_len; - dp->tx2_key = key; - dp->tx_next = DP8390_TX_BUF1; - } - // Send data to device buffer(s) - regs->w.page0.cr = DP8390_CR_PAGE0 | DP8390_CR_NODMA | DP8390_CR_START; - regs->w.page0.rbcl = pkt_len & 0xFF; - regs->w.page0.rbch = pkt_len >> 8; - regs->w.page0.rsal = 0; - regs->w.page0.rsah = start_page; - regs->w.page0.isr = DP8390_ISR_RDC; // Clear end of DMA - regs->w.page0.cr = DP8390_CR_WDMA | DP8390_CR_START; - // Put data into buffer - for (i = 0; i < sg_len; i++) { - data = (unsigned char *)sg_list[i].buf; - len = sg_list[i].len; - while (len-- > 0) { - regs->w.page0.data = *data++; - } - } - if (total_len < pkt_len) { - // Padding to 802.3 length was required - for (i = total_len; i < pkt_len; i++) { - regs->w.page0.data = 0; - } - } - // Wait for DMA to complete - while ((regs->r.page0.isr & DP8390_ISR_RDC) == 0) ; - // Start transmit if not already going - if (!dp->tx_started) { - if (start_page == dp->tx1) { - dp->tx_int = 1; // Expecting interrupt from BUF1 - } else { - dp->tx_int = 2; // Expecting interrupt from BUF2 - } - sc_lpe_start_xmit(sc, start_page, pkt_len); - } -} - -// -// This function is called when a packet has been received. It's job is -// to prepare to unload the packet from the hardware. Once the length of -// the packet is known, the upper layer of the driver can be told. When -// the upper layer is ready to unload the packet, the internal function -// 'sc_lpe_recv' will be called to actually fetch it from the hardware. -// -static void -sc_lpe_RxEvent(struct eth_drv_sc *sc, int stat) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - unsigned char rsr; - unsigned char rcv_hdr[4]; - int i, len, pkt, cur; - - rsr = regs->r.page0.rsr; - while (true) { - // Read incoming packet header - regs->w.page0.cr = DP8390_CR_PAGE1 | DP8390_CR_NODMA | DP8390_CR_START; - cur = regs->r.page1.curp; - regs->w.page0.cr = DP8390_CR_PAGE0 | DP8390_CR_NODMA | DP8390_CR_START; - pkt = regs->r.page0.bndry + 1; - if (pkt == cur) break; - if (pkt == DP8390_RX_STOP) pkt = DP8390_RX_START; - regs->w.page0.rbcl = sizeof(rcv_hdr); - regs->w.page0.rbch = 0; - regs->w.page0.rsal = 0; - regs->w.page0.rsah = pkt; - if (dp->rx_next == pkt) { -// printf("sc_lpe - receiver confused, stat: %x, , rsr: %x\n", stat, rsr); - regs->w.page0.bndry = cur-1; // Update pointer - return; - } - dp->rx_next = pkt; - regs->w.page0.isr = DP8390_ISR_RDC; // Clear end of DMA - regs->w.page0.cr = DP8390_CR_RDMA | DP8390_CR_START; - for (i = 0; i < sizeof(rcv_hdr); i++) { - rcv_hdr[i] = regs->r.page0.data; - } - len = ((rcv_hdr[3] << 8) | rcv_hdr[2]) - sizeof(rcv_hdr); - (sc->funs->eth_drv->recv)(sc, len); - regs->w.page0.bndry = rcv_hdr[1]-1; // Update pointer - } + return slot->int_num; } - -// -// This function is called as a result of the "eth_drv_recv()" call above. -// It's job is to actually fetch data for a packet from the hardware once -// memory buffers have been allocated for the packet. Note that the buffers -// may come in pieces, using a scatter-gather list. This allows for more -// efficient processing in the upper layers of the stack. -// -static void -sc_lpe_recv(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - int i, mlen, len; - unsigned char *data; - - // Compute total packet length - len = 0; - for (i = 0; i < sg_len; i++) { - len += sg_list[i].len; - } - // Read incoming packet data - regs->w.page0.cr = DP8390_CR_PAGE0 | DP8390_CR_NODMA | DP8390_CR_START; - regs->w.page0.rbcl = len & 0xFF; - regs->w.page0.rbch = len >> 8; - regs->w.page0.rsal = 4; // Past header - regs->w.page0.rsah = dp->rx_next; - regs->w.page0.isr = DP8390_ISR_RDC; // Clear end of DMA - regs->w.page0.cr = DP8390_CR_RDMA | DP8390_CR_START; - for (i = 0; i < sg_len; i++) { - data = (unsigned char *)sg_list[i].buf; - if (data) { - mlen = sg_list[i].len; - while (mlen >= sizeof(*data)) { - *data++ = regs->r.page0.data; - mlen -= sizeof(*data); - } - } - } -} - -static void -sc_lpe_TxEvent(struct eth_drv_sc *sc, int stat) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - unsigned char tsr; - unsigned long key; - - tsr = regs->r.page0.tsr; - if (dp->tx_int == 1) { - key = dp->tx1_key; - dp->tx1 = 0; - } else { - key = dp->tx2_key; - dp->tx2 = 0; - } - // Start next packet if one is ready - dp->tx_started = false; - if (dp->tx1) { - sc_lpe_start_xmit(sc, dp->tx1, dp->tx1_len); - dp->tx_int = 1; - } else if (dp->tx2) { - sc_lpe_start_xmit(sc, dp->tx2, dp->tx2_len); - dp->tx_int = 2; - } else { - dp->tx_int = 0; - } - // Tell higher level we sent this packet - (sc->funs->eth_drv->tx_done)(sc, key, 0); -} - -static void -sc_lpe_BufEvent(struct eth_drv_sc *sc, int stat) -{ - // What to do if the receive buffers overflow? - if (stat & DP8390_ISR_OFLW) { - // Note: [so far] it seems safe to just ignore this condition - // The Linux driver goes through extraordinary pains to handle - // it, including totally shutting down the chip and restarting. - } -} - -static void -sc_lpe_int(struct eth_drv_sc *sc) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - dp8390_regs *regs = dp->regs; - unsigned char isr; - - regs->w.page0.cr = DP8390_CR_NODMA | DP8390_CR_PAGE0 | DP8390_CR_START; - while ((isr = regs->r.page0.isr) != 0) { - regs->w.page0.isr = isr; // Clear set bits - if (!dp->running) break; // Is this necessary? - if (isr & (DP8390_ISR_TxP|DP8390_ISR_TxE)) { - sc_lpe_TxEvent(sc, isr); - } - if (isr & (DP8390_ISR_RxP|DP8390_ISR_RxE)) { - sc_lpe_RxEvent(sc, isr); - } - if (isr & (DP8390_ISR_OFLW|DP8390_ISR_CNT)) { - sc_lpe_BufEvent(sc, isr); - } - } - cf_clear_interrupt(dp->slot); -} - -static int -sc_lpe_int_vector(struct eth_drv_sc *sc) -{ - struct sc_lpe_priv_data *dp = (struct sc_lpe_priv_data *)sc->driver_private; - return dp->slot->int_num; -} diff --git a/packages/devs/eth/intel/i82559/current/ChangeLog b/packages/devs/eth/intel/i82559/current/ChangeLog --- a/packages/devs/eth/intel/i82559/current/ChangeLog +++ b/packages/devs/eth/intel/i82559/current/ChangeLog @@ -1,3 +1,7 @@ +2001-06-22 Jesper Skov + + * src/if_i82559.c (i82559_init): Handle EEPROMS without CRC. + 2001-05-16 Jonathan Larmour * src/if_i82559.c (udelay): Use virtual vector rather than assuming diff --git a/packages/devs/eth/intel/i82559/current/src/if_i82559.c b/packages/devs/eth/intel/i82559/current/src/if_i82559.c --- a/packages/devs/eth/intel/i82559/current/src/if_i82559.c +++ b/packages/devs/eth/intel/i82559/current/src/if_i82559.c @@ -1416,6 +1416,7 @@ i82559_init(struct cyg_netdevtab_entry * } } +#ifndef CYGHWR_DEVS_ETH_INTEL_I82559_HAS_ONE_EEPROM_WITHOUT_CRC // If the EEPROM checksum is wrong, the MAC address read // from the EEPROM is probably wrong as well. In that // case, we don't set mac_addr_ok, but continue the @@ -1430,7 +1431,9 @@ i82559_init(struct cyg_netdevtab_entry * os_printf("Warning: Invalid EEPROM checksum %04X for device %d\n", checksum, p_i82559->index); #endif - } else { + } else // trailing block +#endif + { p_i82559->mac_addr_ok = 1; #ifdef DEBUG_EE os_printf("Valid EEPROM checksum\n"); diff --git a/packages/devs/eth/mips/ocelot/current/ChangeLog b/packages/devs/eth/mips/ocelot/current/ChangeLog --- a/packages/devs/eth/mips/ocelot/current/ChangeLog +++ b/packages/devs/eth/mips/ocelot/current/ChangeLog @@ -1,3 +1,11 @@ +2001-06-22 Jesper Skov + + * cdl/mips_rm7000_ocelot_eth_drivers.cdl: Default to getting ESA + from EEPROM. + + * include/devs_eth_mips_rm7000_ocelot.inl: Tell driver to expect + EEPROM without CRC. + 2001-03-02 Jesper Skov * include/devs_eth_mips_rm7000_ocelot.inl: Define controller PCI diff --git a/packages/devs/eth/mips/ocelot/current/cdl/mips_rm7000_ocelot_eth_drivers.cdl b/packages/devs/eth/mips/ocelot/current/cdl/mips_rm7000_ocelot_eth_drivers.cdl --- a/packages/devs/eth/mips/ocelot/current/cdl/mips_rm7000_ocelot_eth_drivers.cdl +++ b/packages/devs/eth/mips/ocelot/current/cdl/mips_rm7000_ocelot_eth_drivers.cdl @@ -87,7 +87,7 @@ cdl_package CYGPKG_DEVS_ETH_MIPS_RM7000_ cdl_component CYGSEM_DEVS_ETH_MIPS_RM7000_OCELOT_ETH0_SET_ESA { display "Set the ethernet station address" flavor bool - calculated 1 + default_value 0 description "Enabling this option will allow the ethernet station address to be forced to the value set by the configuration. This may be required if the hardware does diff --git a/packages/devs/eth/mips/ocelot/current/include/devs_eth_mips_rm7000_ocelot.inl b/packages/devs/eth/mips/ocelot/current/include/devs_eth_mips_rm7000_ocelot.inl --- a/packages/devs/eth/mips/ocelot/current/include/devs_eth_mips_rm7000_ocelot.inl +++ b/packages/devs/eth/mips/ocelot/current/include/devs_eth_mips_rm7000_ocelot.inl @@ -42,6 +42,11 @@ #ifdef CYGPKG_DEVS_ETH_MIPS_RM7000_OCELOT_ETH0 +#ifndef CYGSEM_DEVS_ETH_MIPS_RM7000_OCELOT_ETH0_SET_ESA +# define CYGHWR_DEVS_ETH_INTEL_I82559_HAS_ONE_EEPROM 0 +# define CYGHWR_DEVS_ETH_INTEL_I82559_HAS_ONE_EEPROM_WITHOUT_CRC +#endif + #define CYGHWR_INTEL_I82559_PCI_MEM_MAP_BASE (CYGARC_UNCACHED_ADDRESS(0x0ff00000)) #define CYGHWR_INTEL_I82559_PCI_MEM_MAP_SIZE 0x00100000 diff --git a/packages/devs/flash/intel/28fxxx/current/ChangeLog b/packages/devs/flash/intel/28fxxx/current/ChangeLog --- a/packages/devs/flash/intel/28fxxx/current/ChangeLog +++ b/packages/devs/flash/intel/28fxxx/current/ChangeLog @@ -1,3 +1,8 @@ +2001-06-20 Jesper Skov + + * include/flash_28fxxx.inl (flash_hwr_init): Fix bad size + calculations. + 2001-05-23 Jesper Skov * cdl/flash_intel_28fxxx.cdl: Links flash functions to RAM. IO diff --git a/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx.inl b/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx.inl --- a/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx.inl +++ b/packages/devs/flash/intel/28fxxx/current/include/flash_28fxxx.inl @@ -139,10 +139,10 @@ flash_hwr_init(void) return FLASH_ERR_DRV_WRONG_PART; // Hard wired for now - flash_info.block_size = FLASH_BLOCK_SIZE * CYGNUM_FLASH_INTERLEAVE; + flash_info.block_size = FLASH_BLOCK_SIZE; flash_info.blocks = FLASH_NUM_REGIONS; flash_info.start = (void *)CYGNUM_FLASH_BASE; - flash_info.end = (void *)(CYGNUM_FLASH_BASE+ (FLASH_NUM_REGIONS * FLASH_BLOCK_SIZE * CYGNUM_FLASH_INTERLEAVE * CYGNUM_FLASH_SERIES)); + flash_info.end = (void *)(CYGNUM_FLASH_BASE+ (FLASH_NUM_REGIONS * FLASH_BLOCK_SIZE * CYGNUM_FLASH_SERIES)); flash_info.buffer_size = FLASH_BUFFER_SIZE; return FLASH_ERR_OK; 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,29 @@ +2001-06-22 Hugo Tyson + + * src/strata.c (flash_hwr_init): Need to refer to the query code + as extern char flash_query[], flash_query_end[]; (with the []) or + MIPS code gen assumes these are short offsets and linking fails. + The generic flash code in io/flash already uses this idiom. + +2001-06-22 Hugo Tyson + + * src/strata.c (flash_hwr_init): Warnings reduced. No arithmetic + on void *. + +2001-06-21 Hugo Tyson + + * src/flash_program_buf.c (flash_program_buf): The buffered write + code didn't jump out if there was a write error, nor verify the + data by reading back. This isn't consistent with the slow case, + and made it take an age if the device is unhappy, and then report + a bizarre error code. Both issues fixed. + +2001-06-21 Hugo Tyson + + * src/strata.c (flash_hwr_init): If shrinking to fit, must also + adjust the flash_info.blocks field, else unlock crashes trying to + get status of all those extra blocks that we cannot actually see. + 2001-06-11 Gary Thomas * src/strata.c: Remove dependency on printf() via user functions. 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 @@ -96,7 +96,7 @@ flash_program_buf(volatile flash_t *addr } *BA = FLASHWORD(wc-1); // Count is 0..N-1 for (i = 0; i < wc; i++) { - *addr++ = *data++; + *(addr+i) = *(data+i); } *BA = FLASH_Confirm; @@ -107,6 +107,18 @@ flash_program_buf(volatile flash_t *addr goto bad; } } + // Jump out if there was an error + if (stat & FLASH_ErrorMask) { + goto bad; + } + // And verify the data - also increments the pointers. + *BA = FLASH_Reset; + for (i = 0; i < wc; i++) { + if ( *addr++ != *data++ ) { + stat = FLASH_ErrorNotVerified; + goto bad; + } + } } #endif diff --git a/packages/devs/flash/intel/strata/current/src/strata.c b/packages/devs/flash/intel/strata/current/src/strata.c --- a/packages/devs/flash/intel/strata/current/src/strata.c +++ b/packages/devs/flash/intel/strata/current/src/strata.c @@ -56,12 +56,13 @@ extern void diag_dump_buf(void *buf, CYG_ADDRWORD len); extern int strncmp(const char *s1, const char *s2, int len); +extern void *memcpy( void *, const void *, size_t ); int flash_hwr_init(void) { struct FLASH_query data, *qp; - extern char flash_query, flash_query_end; + extern char flash_query[], flash_query_end[]; typedef int code_fun(unsigned char *); code_fun *_flash_query; int code_len, stat, num_regions, region_size, buffer_size; @@ -148,6 +149,10 @@ flash_hwr_init(void) (*flash_info.pf)("\nFLASH: Oversized device! End addr %p changed to %p\n", flash_info.end, (void *)x ); flash_info.end = (void *)x; + // Also adjust the block count else unlock crashes! + x = ((cyg_uint8 *)flash_info.end - (cyg_uint8 *)flash_info.start) + / flash_info.block_size; + flash_info.blocks = x; } } #endif // CYGNUM_FLASH_BASE_MASK diff --git a/packages/devs/serial/generic/16x5x/current/ChangeLog b/packages/devs/serial/generic/16x5x/current/ChangeLog --- a/packages/devs/serial/generic/16x5x/current/ChangeLog +++ b/packages/devs/serial/generic/16x5x/current/ChangeLog @@ -1,3 +1,16 @@ +2001-06-19 Jesper Skov + + * cdl/ser_generic_16x5x.cdl: Only define + CYGDAT_IO_SERIAL_DEVICE_HEADER when necessary. + +2001-06-18 Jonathan Larmour + + * src/ser_16x5x.c (pc_serial_set_config): Fix length check typo + +2001-06-18 Jesper Skov + + * src/ser_16x5x.c (LCR_PE): Set correct bits (from Boris V. Guzhov) + 2001-06-08 Jonathan Larmour * src/ser_16x5x.c: Support FIFOs better by detecting what we've got, diff --git a/packages/devs/serial/generic/16x5x/current/cdl/ser_generic_16x5x.cdl b/packages/devs/serial/generic/16x5x/current/cdl/ser_generic_16x5x.cdl --- a/packages/devs/serial/generic/16x5x/current/cdl/ser_generic_16x5x.cdl +++ b/packages/devs/serial/generic/16x5x/current/cdl/ser_generic_16x5x.cdl @@ -61,7 +61,9 @@ cdl_package CYGPKG_IO_SERIAL_GENERIC_16X define_proc { puts $::cdl_system_header "/***** serial driver proc output start *****/" + puts $::cdl_system_header "#ifndef CYGDAT_IO_SERIAL_DEVICE_HEADER" puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_DEVICE_HEADER " + puts $::cdl_system_header "#endif" puts $::cdl_system_header "/***** serial driver proc output end *****/" puts $::cdl_header "#include "; puts $::cdl_header "#include CYGDAT_IO_SERIAL_GENERIC_16X5X_CFG"; diff --git a/packages/devs/serial/generic/16x5x/current/src/ser_16x5x.c b/packages/devs/serial/generic/16x5x/current/src/ser_16x5x.c --- a/packages/devs/serial/generic/16x5x/current/src/ser_16x5x.c +++ b/packages/devs/serial/generic/16x5x/current/src/ser_16x5x.c @@ -93,7 +93,7 @@ #define LCR_SB1_5 0x04 // 1.5 -> only valid with 5 bit words #define LCR_SB2 0x04 #define LCR_PN 0x00 // Parity mode - none -#define LCR_PE 0x0C // Parity mode - even +#define LCR_PE 0x18 // Parity mode - even #define LCR_PO 0x08 // Parity mode - odd #define LCR_PM 0x28 // Forced "mark" parity #define LCR_PS 0x38 // Forced "space" parity @@ -416,7 +416,7 @@ pc_serial_set_config(serial_channel *cha cyg_addrword_t base = ser_chan->base; cyg_uint8 *f = (cyg_uint8 *)xbuf; unsigned char mask=0; - if ( *len < *f ) + if ( *len < sizeof(*f) ) return -EINVAL; if ( chan->config.flags & CYGNUM_SERIAL_FLOW_RTSCTS_RX ) diff --git a/packages/ecos.db b/packages/ecos.db --- a/packages/ecos.db +++ b/packages/ecos.db @@ -703,6 +703,7 @@ package CYGPKG_DEVS_ETH_CF { alias { "PCMCIA (Compact Flash) ethernet drivers" cf_eth_drivers } directory devs/eth/cf script cf_eth_drivers.cdl + hardware description "Ethernet drivers for PCMCIA (Compact Flash) cardss." } package CYGPKG_IO_PCI { @@ -1091,6 +1092,14 @@ package CYGPKG_HAL_ARM_SA11X0_IPAQ { eCos on a Intel StrongARM SA1110 pocket PC (Compaq iPAQ)." } +package CYGPKG_DEVS_ETH_SMSC_LAN91CXX { + alias { "SMSC LAN91CXX ethernet driver" lan91cxx_eth_driver lan9000_eth_driver } + hardware + directory devs/eth/smsc/lan91cxx + script smsc_lan91cxx_eth_drivers.cdl + description "Ethernet driver for SMSC LAN91CXX (LAN9000) controller." +} + package CYGPKG_HAL_ARM_SA11X0_NANO { alias { "Intel SA1110 nanoEngine eval board" hal_arm_sa11x0_nano } @@ -1766,6 +1775,8 @@ target assabet { CYGPKG_IO_USB_SLAVE CYGPKG_DEVS_USB_SA11X0 CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 + CYGPKG_DEVS_ETH_CF + CYGPKG_DEVS_ETH_NS_DP83902A } description " The assabet target provides the packages needed to run @@ -1784,6 +1795,8 @@ target ipaq { CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 CYGPKG_DEVS_TOUCH_IPAQ CYGPKG_DEVS_KBD_IPAQ + CYGPKG_DEVS_ETH_CF + CYGPKG_DEVS_ETH_NS_DP83902A } description " The IPAQ target provides the packages needed to run 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,8 @@ +2001-06-22 Gary Thomas + + * include/arm_stub.h (NUMREGBYTES): Define - this tells GDB how + large it's communications buffers need to be. + 2001-06-05 Gary Thomas 2001-06-05 Thomas Fähnle diff --git a/packages/hal/arm/arch/current/include/arm_stub.h b/packages/hal/arm/arch/current/include/arm_stub.h --- a/packages/hal/arm/arch/current/include/arm_stub.h +++ b/packages/hal/arm/arch/current/include/arm_stub.h @@ -53,6 +53,8 @@ extern "C" { #define REGSIZE( _x_ ) (((_x_) < F0 || (_x_) >= FPS) ? 4 : 12) +#define NUMREGBYTES ((16*4)+(8*12)+(2*4)) + #ifndef TARGET_REGISTER_T_DEFINED #define TARGET_REGISTER_T_DEFINED typedef unsigned long target_register_t; diff --git a/packages/hal/arm/ebsa285/current/ChangeLog b/packages/hal/arm/ebsa285/current/ChangeLog --- a/packages/hal/arm/ebsa285/current/ChangeLog +++ b/packages/hal/arm/ebsa285/current/ChangeLog @@ -1,3 +1,8 @@ +2001-06-21 Jonathan Larmour + + * images/*: Remove. Don't bloat repository with things already on + the web. + 2001-04-26 Hugo Tyson * misc/redboot_ROM.ecm: diff --git a/packages/hal/arm/ebsa285/current/images/redboot_RAM.bin b/packages/hal/arm/ebsa285/current/images/redboot_RAM.bin deleted file mode 100644 index 45431cdef7c71aec371cf33a76faa75f523f10a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + * images/*: Remove. Don't bloat repository with things already on + the web. + 2001-04-30 Gary Thomas * include/hal_platform_setup.h: Remove #undef CYG_HAL_ROM_RESET_USES_JUMP diff --git a/packages/hal/arm/iq80310/current/images/redboot_RAM.bin b/packages/hal/arm/iq80310/current/images/redboot_RAM.bin deleted file mode 100644 index b943871c6021787d592835eb763e8d2f5baee1e0..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + * images/redboot*: Remove. Don't bloat repository with things already + on the web. + 2001-04-27 Jonathan Larmour * cdl/hal_arm_sa11x0_assabet.cdl: Remove redundant -Wl,-N from link diff --git a/packages/hal/arm/sa11x0/assabet/current/images/redboot_RAM.bin b/packages/hal/arm/sa11x0/assabet/current/images/redboot_RAM.bin deleted file mode 100644 index e6b3dc48dbce6f23a45358fa10674e6d4f78e541..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + * misc/redboot_WinCE.ecm: + * misc/redboot_ROM.ecm: + * misc/redboot_RAM.ecm: Force stack size to 6K. + +2001-06-21 Jonathan Larmour + + * images/*: Remove. Don't bloat repository with things already on + the web. + 2001-06-08 Gary Thomas * include/pkgconf/mlt_arm_sa11x0_ipaq_rom.mlt: diff --git a/packages/hal/arm/sa11x0/ipaq/current/images/MD5SUMS b/packages/hal/arm/sa11x0/ipaq/current/images/MD5SUMS deleted file mode 100644 --- a/packages/hal/arm/sa11x0/ipaq/current/images/MD5SUMS +++ /dev/null @@ -1,13 +0,0 @@ -4b36faf83910e115b7abfb31811bd880 OSloader -35c584d189f5c2fad2a1188e50558138 redboot_Compaq.elf -8dfc76586574ffd92acf3af4eb757513 redboot_RAM.elf -2c90a1c5d3445447461c44923bea156c redboot_ROM.elf -36a3b851497e21a8ca2c5d853b06ae37 redboot_WinCE.elf -d7b2c2a60fd10b2511d191da139a205d redboot_Compaq.bin -f528f043d26a7b03509603416cc7773a redboot_RAM.bin -3a135dfd032188ca41638d3779dc77b9 redboot_ROM.bin -c56b54ccc82343bbdacbc4b159a4a2b6 redboot_WinCE.bin -f633ac4f2ca87d10a2455e460408990a redboot_Compaq.srec -a3f6b6d734ceb50d367ca1cb4c8b897e redboot_RAM.srec -427a5872fba348b30a40d5e5128f0539 redboot_ROM.srec -ebe45b05fe1d8c3e6ea91190a2011264 redboot_WinCE.srec diff --git a/packages/hal/arm/sa11x0/ipaq/current/images/OSloader b/packages/hal/arm/sa11x0/ipaq/current/images/OSloader deleted file mode 100644 index 2acb39341a16aed043d84787a0e24275759221dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + * src/generic-stub.c (BUFMAX): Define as platform specific, thus + reducing memory requirements. + (__process_packet): Eliminate program arguments support until eCos + makes use of them (more memory savings). + +2001-06-22 Mark Salter + + * src/hal_stub.c (__do_copy_mem): Add goto statement to prevent + compiler from moving instructions across 'err' label. + 2001-06-14 Jonathan Larmour * src/generic-stub.c (__process_packet): Don't reset the board diff --git a/packages/hal/common/current/src/generic-stub.c b/packages/hal/common/current/src/generic-stub.c --- a/packages/hal/common/current/src/generic-stub.c +++ b/packages/hal/common/current/src/generic-stub.c @@ -143,7 +143,15 @@ memset(void* s, int c, int size) /************************************************************************/ /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ /* at least NUMREGBYTES*2 are needed for register packets */ +#ifdef __ECOS__ +#ifdef NUMREGBYTES +#define BUFMAX (32 + (NUMREGBYTES*2)) +#else #define BUFMAX 2048 +#endif +#else +#define BUFMAX 2048 +#endif static int initialized = 0; /* !0 means we've been initialized */ @@ -1162,6 +1170,7 @@ int case 'A': /* set program arguments */ { +#ifdef CYGSEM_ECOS_SUPPORTS_PROGRAM_ARGS if (packet[1] == '\0') { __free_program_args (); @@ -1202,6 +1211,9 @@ int else strcpy (remcomOutBuffer, "E01"); } +#else + strcpy (remcomOutBuffer, "E01"); +#endif } break; diff --git a/packages/hal/common/current/src/hal_stub.c b/packages/hal/common/current/src/hal_stub.c --- a/packages/hal/common/current/src/hal_stub.c +++ b/packages/hal/common/current/src/hal_stub.c @@ -721,6 +721,10 @@ static void unsigned short *short_dst; unsigned short *short_src; + // Zero memCount is not really an error, but the goto is necessary to + // keep some compilers from reordering stuff across the 'err' label. + if (memCount == 0) goto err; + __mem_fault = 1; /* Defaults to 'fail'. Is cleared */ /* when the copy loop completes. */ __mem_fault_handler = &&err; @@ -798,6 +802,10 @@ static void unsigned short *short_dst; unsigned short *short_src; + // Zero memCount is not really an error, but the goto is necessary to + // keep some compilers from reordering stuff across the 'err' label. + if (memCount == 0) goto err; + __mem_fault = 1; /* Defaults to 'fail'. Is cleared */ /* when the copy loop completes. */ __mem_fault_handler = &&err; @@ -848,6 +856,10 @@ static void unsigned short *short_dst; unsigned short *short_src; + // Zero memCount is not really an error, but the goto is necessary to + // keep some compilers from reordering stuff across the 'err' label. + if (memCount == 0) goto err; + __mem_fault = 1; /* Defaults to 'fail'. Is cleared */ /* when the copy loop completes. */ __mem_fault_handler = &&err; 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,9 @@ +2001-06-19 Mark Salter + + * include/hal_arch.h: Support saving/restoring CP0 registers for GDB. + + * include/mips-stub.h (NUMREGS): Use different value for mips32. + 2001-06-08 Jesper Skov * include/mips.inc (FUNC_START): Added .noreorder. diff --git a/packages/hal/mips/arch/current/include/hal_arch.h b/packages/hal/mips/arch/current/include/hal_arch.h --- a/packages/hal/mips/arch/current/include/hal_arch.h +++ b/packages/hal/mips/arch/current/include/hal_arch.h @@ -26,7 +26,7 @@ // // The Initial Developer of the Original Code is Red Hat. // Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. // All Rights Reserved. // ------------------------------------------- // @@ -247,6 +247,72 @@ CYG_MACRO_END #define HAL_SET_GDB_FPU_REGISTERS( _regs_ , _regval_ ) #endif +// Some variants support CP0 regs in GDB +#if defined(CYGPKG_HAL_MIPS_MIPS32) +#define HAL_GET_CP0_REGISTER( _regval_, _cp0_regno_, _cp0_regsel_ ) \ +{ \ + cyg_uint32 tmp; \ + asm volatile ("mfc0 %0,$%1,%2\nnop\n" \ + : "=r" (tmp) \ + : "i" (_cp0_regno_), "i" (_cp0_regsel_) ); \ + _regval_ = tmp; \ +} + +#define HAL_SET_CP0_REGISTER( _regval_, _cp0_regno_, _cp0_regsel_ ) \ +{ \ + cyg_uint32 tmp = _regval_; \ + asm volatile ("mtc0 %1,$%2,%3\nnop\n" \ + : "=r" (tmp) \ + : "r" (tmp), "i" (_cp0_regno_), "i" (_cp0_regsel_) ); \ +} + +#define HAL_GET_GDB_CP0_REGISTERS( _regval_ ) \ + HAL_GET_CP0_REGISTER( _regval_[74], 0, 0 ); /* index */ \ + HAL_GET_CP0_REGISTER( _regval_[75], 1, 0 ); /* random */ \ + HAL_GET_CP0_REGISTER( _regval_[76], 2, 0 ); /* EntryLo0 */ \ + HAL_GET_CP0_REGISTER( _regval_[77], 3, 0 ); /* EntryLo1 */ \ + HAL_GET_CP0_REGISTER( _regval_[78], 4, 0 ); /* context */ \ + HAL_GET_CP0_REGISTER( _regval_[79], 5, 0 ); /* PageMask */ \ + HAL_GET_CP0_REGISTER( _regval_[80], 6, 0 ); /* Wired */ \ + HAL_GET_CP0_REGISTER( _regval_[83], 9, 0 ); /* Count */ \ + HAL_GET_CP0_REGISTER( _regval_[84], 10, 0 ); /* EntryHi */ \ + HAL_GET_CP0_REGISTER( _regval_[85], 11, 0 ); /* Compare */ \ + HAL_GET_CP0_REGISTER( _regval_[88], 14, 0 ); /* EPC */ \ + HAL_GET_CP0_REGISTER( _regval_[89], 15, 0 ); /* PRId */ \ + HAL_GET_CP0_REGISTER( _regval_[90], 16, 0 ); /* Config */ \ + HAL_GET_CP0_REGISTER( _regval_[91], 17, 0 ); /* LLAddr */ \ + HAL_GET_CP0_REGISTER( _regval_[92], 18, 0 ); /* WatchLo */ \ + HAL_GET_CP0_REGISTER( _regval_[93], 19, 0 ); /* WatchHi */ \ + HAL_GET_CP0_REGISTER( _regval_[97], 23, 0 ); /* Debug */ \ + HAL_GET_CP0_REGISTER( _regval_[98], 24, 0 ); /* DEPC */ \ + HAL_GET_CP0_REGISTER( _regval_[102], 28, 0 ); /* TagLo */ \ + HAL_GET_CP0_REGISTER( _regval_[104], 30, 0 ); /* ErrorEPC */ \ + HAL_GET_CP0_REGISTER( _regval_[105], 31, 0 ); /* DESAVE */ \ + HAL_GET_CP0_REGISTER( _regval_[106], 16, 1 ); /* Config1 */ + +#define HAL_SET_GDB_CP0_REGISTERS( _regval_ ) \ + HAL_SET_CP0_REGISTER( _regval_[74], 0, 0 ); /* index */ \ + HAL_SET_CP0_REGISTER( _regval_[76], 2, 0 ); /* EntryLo0 */ \ + HAL_SET_CP0_REGISTER( _regval_[77], 3, 0 ); /* EntryLo1 */ \ + HAL_SET_CP0_REGISTER( _regval_[78], 4, 0 ); /* context */ \ + HAL_SET_CP0_REGISTER( _regval_[79], 5, 0 ); /* PageMask */ \ + HAL_SET_CP0_REGISTER( _regval_[80], 6, 0 ); /* Wired */ \ + HAL_SET_CP0_REGISTER( _regval_[83], 9, 0 ); /* Count */ \ + HAL_SET_CP0_REGISTER( _regval_[84], 10, 0 ); /* EntryHi */ \ + HAL_SET_CP0_REGISTER( _regval_[85], 11, 0 ); /* Compare */ \ + HAL_SET_CP0_REGISTER( _regval_[90], 16, 0 ); /* Config */ \ + HAL_SET_CP0_REGISTER( _regval_[92], 18, 0 ); /* WatchLo */ \ + HAL_SET_CP0_REGISTER( _regval_[93], 19, 0 ); /* WatchHi */ \ + HAL_SET_CP0_REGISTER( _regval_[97], 23, 0 ); /* Debug */ \ + HAL_SET_CP0_REGISTER( _regval_[98], 24, 0 ); /* DEPC */ \ + HAL_SET_CP0_REGISTER( _regval_[102], 28, 0 ); /* TagLo */ \ + HAL_SET_CP0_REGISTER( _regval_[105], 31, 0 ); /* DESAVE */ + +#else +#define HAL_GET_GDB_CP0_REGISTERS( _regval_ ) +#define HAL_SET_GDB_CP0_REGISTERS( _regval_ ) +#endif + // Copy a set of registers from a HAL_SavedRegisters structure into a // GDB ordered array. #define HAL_GET_GDB_REGISTERS( _aregval_ , _regs_ ) \ @@ -265,6 +331,8 @@ CYG_MACRO_END _regval_[35] = (_regs_)->badvr; \ _regval_[36] = (_regs_)->cause; \ _regval_[37] = (_regs_)->pc; \ + \ + HAL_GET_GDB_CP0_REGISTERS( _regval_ ); \ } // Copy a GDB ordered array into a HAL_SavedRegisters structure. @@ -284,6 +352,8 @@ CYG_MACRO_END (_regs_)->badvr = _regval_[35]; \ (_regs_)->cause = _regval_[36]; \ (_regs_)->pc = _regval_[37]; \ + \ + HAL_SET_GDB_CP0_REGISTERS( _regval_ ); \ } //-------------------------------------------------------------------------- diff --git a/packages/hal/mips/arch/current/include/mips-stub.h b/packages/hal/mips/arch/current/include/mips-stub.h --- a/packages/hal/mips/arch/current/include/mips-stub.h +++ b/packages/hal/mips/arch/current/include/mips-stub.h @@ -25,7 +25,7 @@ // // The Initial Developer of the Original Code is Red Hat. // Portions created by Red Hat are -// Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. // All Rights Reserved. // ------------------------------------------- // @@ -54,7 +54,11 @@ extern "C" { #endif +#if defined(CYGPKG_HAL_MIPS_MIPS32) +#define NUMREGS 107 +#else #define NUMREGS 90 +#endif #if defined(__mips64) // The simple case of 64-bit regs represented to GDB as 64-bit regs. diff --git a/packages/hal/mips/rm7000/ocelot/current/ChangeLog b/packages/hal/mips/rm7000/ocelot/current/ChangeLog --- a/packages/hal/mips/rm7000/ocelot/current/ChangeLog +++ b/packages/hal/mips/rm7000/ocelot/current/ChangeLog @@ -1,3 +1,8 @@ +2001-06-22 Jesper Skov + + * misc/redboot_RAM.ecm: Force 32k stack. + * misc/redboot_ROM.ecm: Same. + 2001-06-08 David Woodhouse * src/platform.S: Change CS bank 3 parameters to 8-bit. diff --git a/packages/hal/mips/rm7000/ocelot/current/misc/redboot_RAM.ecm b/packages/hal/mips/rm7000/ocelot/current/misc/redboot_RAM.ecm --- a/packages/hal/mips/rm7000/ocelot/current/misc/redboot_RAM.ecm +++ b/packages/hal/mips/rm7000/ocelot/current/misc/redboot_RAM.ecm @@ -19,6 +19,7 @@ cdl_configuration eCos { package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; + package -hardware CYGPKG_DEVS_ETH_MIPS_RM7000_OCELOT current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; @@ -30,6 +31,10 @@ cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 32768 +}; + cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { user_value 0 }; @@ -58,4 +63,8 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F040B { + inferred_value 1 +}; + diff --git a/packages/hal/mips/rm7000/ocelot/current/misc/redboot_ROM.ecm b/packages/hal/mips/rm7000/ocelot/current/misc/redboot_ROM.ecm --- a/packages/hal/mips/rm7000/ocelot/current/misc/redboot_ROM.ecm +++ b/packages/hal/mips/rm7000/ocelot/current/misc/redboot_ROM.ecm @@ -19,6 +19,7 @@ cdl_configuration eCos { package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ; package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; package -hardware CYGPKG_DEVS_ETH_INTEL_I82559 current ; + package -hardware CYGPKG_DEVS_ETH_MIPS_RM7000_OCELOT current ; package -template CYGPKG_HAL current ; package -template CYGPKG_INFRA current ; package -template CYGPKG_REDBOOT current ; @@ -30,6 +31,10 @@ cdl_option CYGBLD_BUILD_GDB_STUBS { user_value 0 }; +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 32768 +}; + cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { user_value 0 }; @@ -66,4 +71,8 @@ cdl_component CYGBLD_BUILD_REDBOOT { user_value 1 }; +cdl_option CYGHWR_DEVS_FLASH_AMD_AM29F040B { + inferred_value 1 +}; + diff --git a/packages/hal/powerpc/mbx/current/ChangeLog b/packages/hal/powerpc/mbx/current/ChangeLog --- a/packages/hal/powerpc/mbx/current/ChangeLog +++ b/packages/hal/powerpc/mbx/current/ChangeLog @@ -1,3 +1,8 @@ +2001-06-21 Jonathan Larmour + + * images/*: Remove. Don't bloat repository with things already on + the web. + 2001-05-07 Gary Thomas * cdl/hal_powerpc_mbx.cdl: diff --git a/packages/hal/powerpc/mbx/current/images/redboot_RAM.bin b/packages/hal/powerpc/mbx/current/images/redboot_RAM.bin deleted file mode 100644 index 075172f9ddba06746d779c76e5c666de303cef27..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + * images/*: Remove. Don't bloat repository with things already on + the web. + 2001-05-01 Gary Thomas * misc/redboot_RAM.ecm: diff --git a/packages/hal/powerpc/viper/current/images/redboot_RAM.bin b/packages/hal/powerpc/viper/current/images/redboot_RAM.bin deleted file mode 100644 index c282ec06fd8c2fce0f1f408fdd26b3451cf29d7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + * include/mod_regs_ubc.h: Allow MOD_UBC to be unset. + + * cdl/hal_sh_sh3.cdl: Added SH7709S support - incomplete due to + lack of documentation. + + * include/mod_7709s.h: Added. + 2001-05-29 Jesper Skov * include/var_io.h: Added. Includes plf_io.h diff --git a/packages/hal/sh/sh3/current/cdl/hal_sh_sh3.cdl b/packages/hal/sh/sh3/current/cdl/hal_sh_sh3.cdl --- a/packages/hal/sh/sh3/current/cdl/hal_sh_sh3.cdl +++ b/packages/hal/sh/sh3/current/cdl/hal_sh_sh3.cdl @@ -127,6 +127,28 @@ cdl_package CYGPKG_HAL_SH_SH3 { puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H " } } + + cdl_option CYGPKG_HAL_SH_7709S { + display "SH 7709S microprocessor" + parent CYGPKG_HAL_SH_CPU + implements CYGINT_HAL_SH_VARIANT + implements CYGINT_HAL_SH_CPG_T3 + implements CYGINT_HAL_SH_DMA_CHANNELS + implements CYGINT_HAL_SH_DMA_CHANNELS + implements CYGINT_HAL_SH_DMA_CHANNELS + implements CYGINT_HAL_SH_DMA_CHANNELS + default_value 0 + no_define + define -file=system.h CYGPKG_HAL_SH_7709S + description " + The SH3 7709S microprocessor. This is an embedded part that in + addition to the SH3 processor core has built in peripherals + such as memory controllers, DMA controllers, A/D and D/A + converters, serial ports and timers/counters." + define_proc { + puts $cdl_system_header "#define CYGBLD_HAL_CPU_MODULES_H " + } + } cdl_option CYGPKG_HAL_SH_7729 { display "SH 7729 microprocessor" diff --git a/packages/hal/sh/sh3/current/include/mod_7709s.h b/packages/hal/sh/sh3/current/include/mod_7709s.h new file mode 100644 --- /dev/null +++ b/packages/hal/sh/sh3/current/include/mod_7709s.h @@ -0,0 +1,85 @@ +#ifndef CYGONCE_HAL_MOD_77xx_H +#define CYGONCE_HAL_MOD_77xx_H + +//============================================================================= +// +// mod_7709.h +// +// List modules available on CPU +// +//============================================================================= +//####COPYRIGHTBEGIN#### +// +// ------------------------------------------- +// The contents of this file are subject to the Red Hat eCos Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.redhat.com/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations under +// the License. +// +// The Original Code is eCos - Embedded Configurable Operating System, +// released September 30, 1998. +// +// The Initial Developer of the Original Code is Red Hat. +// Portions created by Red Hat are +// Copyright (C) 1998, 1999, 2000, 2001 Red Hat, Inc. +// All Rights Reserved. +// ------------------------------------------- +// +//####COPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 2001-06-19 +// Purpose: Define modules (and versions) available on this CPU. +// Usage: Included from +// +// FIXME: Probably has a UBC as well, but not 7709a style. Need docs +// to get that working. +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Modules provided by the CPU + +#define CYGARC_SH_MOD_BCN 2 +#define CYGARC_SH_MOD_CPG 3 +#define CYGARC_SH_MOD_DMAC 1 +#define CYGARC_SH_MOD_INTC 2 +#define CYGARC_SH_MOD_IRDA 1 +#define CYGARC_SH_MOD_PFC 1 +#define CYGARC_SH_MOD_SCI 1 +#define CYGARC_SH_MOD_SCIF 1 + +//----------------------------------------------------------------------------- +// Extra details for Cache Module (CAC) + +// Cache dimenions - one unified cache +#define CYGARC_SH_MOD_CAC_SIZE 16384 // Size of cache in bytes +#define CYGARC_SH_MOD_CAC_LINE_SIZE 16 // Size of a cache line +#define CYGARC_SH_MOD_CAC_WAYS 4 // Associativity of the cache + +// Cache addressing information +// way: bits 13 - 12 +// entry: bits 11 - 4 +#define CYGARC_SH_MOD_CAC_ADDRESS_BASE 0xf0000000 +#define CYGARC_SH_MOD_CAC_ADDRESS_TOP 0xf0004000 +#define CYGARC_SH_MOD_CAC_ADDRESS_STEP 0x00000010 +// U : bit 1 +// V : bit 0 +// Writing zero to both forces a flush of the line if it is dirty. +#define CYGARC_SH_MOD_CAC_ADDRESS_FLUSH 0x00000000 + +//----------------------------------------------------------------------------- +// Extra details for interrupt handling +#define CYGARC_SH_SOFTWARE_IP_UPDATE + +#endif // CYGONCE_HAL_MOD_77xx_H diff --git a/packages/hal/sh/sh3/current/include/mod_regs_ubc.h b/packages/hal/sh/sh3/current/include/mod_regs_ubc.h --- a/packages/hal/sh/sh3/current/include/mod_regs_ubc.h +++ b/packages/hal/sh/sh3/current/include/mod_regs_ubc.h @@ -34,7 +34,7 @@ // Author(s): jskov // Contributors:jskov // Date: 2000-10-30 -// +// //####DESCRIPTIONEND#### // //============================================================================= @@ -63,7 +63,7 @@ #define CYGARC_REG_BRCR_PCBB 0x0040 // post execute channel B #define CYGARC_REG_BRCR_SEQ 0x0008 // sequence condition select -#if (CYGARC_SH_MOD_UBC == 1) +#if defined(CYGARC_SH_MOD_UBC) && (CYGARC_SH_MOD_UBC == 1) #define CYGARC_REG_BAMRA_BASMA 0x04 // BASRA masked #define CYGARC_REG_BAMRA_BARA_UNMASKED 0x00 // BARA not masked #define CYGARC_REG_BAMRA_BARA_10BIT 0x01 // Lowest 10 bit masked @@ -85,7 +85,7 @@ //---------------------------------------------------------------------------- // Other types -#if (CYGARC_SH_MOD_UBC >= 3) +#if defined(CYGARC_SH_MOD_UBC) && (CYGARC_SH_MOD_UBC >= 3) #define CYGARC_REG_BETR 0xffffff9c // 16 bit #define CYGARC_REG_BRSR 0xffffffac // 32 bit #define CYGARC_REG_BRDR 0xffffffbc // 32 bit diff --git a/packages/hal/v85x/ceb_v850/current/ChangeLog b/packages/hal/v85x/ceb_v850/current/ChangeLog --- a/packages/hal/v85x/ceb_v850/current/ChangeLog +++ b/packages/hal/v85x/ceb_v850/current/ChangeLog @@ -1,3 +1,26 @@ +2001-06-18 Jonathan Larmour + + * cdl/hal_v85x_ceb_v850.cdl (CYGHWR_MEMORY_LAYOUT_H): Fix name for + flash startup. + + * include/pkgconf/mlt_v85x_v850_ceb_flash.h: + * include/pkgconf/mlt_v85x_v850_ceb_flash.ldi: + * include/pkgconf/mlt_v85x_v850_ceb_flash.mlt: + * include/pkgconf/mlt_v85x_v850_ceb_flashromram.h: + * include/pkgconf/mlt_v85x_v850_ceb_flashromram.ldi: + * include/pkgconf/mlt_v85x_v850_ceb_flashromram.mlt: + * include/pkgconf/mlt_v85x_v850_ceb_ram.h: + * include/pkgconf/mlt_v85x_v850_ceb_ram.ldi: + * include/pkgconf/mlt_v85x_v850_ceb_ram.mlt: + * include/pkgconf/mlt_v85x_v850_ceb_rom.h: + * include/pkgconf/mlt_v85x_v850_ceb_rom.ldi: + * include/pkgconf/mlt_v85x_v850_ceb_rom.mlt: + * include/pkgconf/mlt_v85x_v850_ceb_romram.h: + * include/pkgconf/mlt_v85x_v850_ceb_romram.ldi: + * include/pkgconf/mlt_v85x_v850_ceb_romram.mlt: + Resize RAM to 0x3c000 long (i.e. top of RAM is 0xffc000). + This avoids problems with variable sizes of internal RAM. + 2001-05-21 Jonathan Larmour * cdl/hal_v85x_ceb_v850.cdl: Change tools back to v850-elf now. diff --git a/packages/hal/v85x/ceb_v850/current/cdl/hal_v85x_ceb_v850.cdl b/packages/hal/v85x/ceb_v850/current/cdl/hal_v85x_ceb_v850.cdl --- a/packages/hal/v85x/ceb_v850/current/cdl/hal_v85x_ceb_v850.cdl +++ b/packages/hal/v85x/ceb_v850/current/cdl/hal_v85x_ceb_v850.cdl @@ -312,7 +312,7 @@ cdl_package CYGPKG_HAL_V85X_V850_CEB { define -file system.h CYGHWR_MEMORY_LAYOUT_H calculated { CYG_HAL_STARTUP == "RAM" ? "" : \ CYG_HAL_STARTUP == "ROM" ? \ - CYG_HAL_V85X_STARTUP_FLASH == 0 ? "" : "" : \ + CYG_HAL_V85X_STARTUP_FLASH == 0 ? "" : "" : \ CYG_HAL_V85X_STARTUP_FLASH == 0 ? "" : "" } } } diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.h b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.h --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.h +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.h @@ -11,10 +11,10 @@ #define CYGMEM_REGION_rom_SIZE (0x80000) #define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) #define CYGMEM_REGION_ram (0xfc0000) -#define CYGMEM_REGION_ram_SIZE (0x3f000) +#define CYGMEM_REGION_ram_SIZE (0x3c000) #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) #ifndef __ASSEMBLER__ extern char CYG_LABEL_NAME (__heap1) []; #endif #define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) -#define CYGMEM_SECTION_heap1_SIZE (0xfff000 - (size_t) CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xffc000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.ldi b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.ldi --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.ldi +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.ldi @@ -7,7 +7,7 @@ MEMORY { rom : ORIGIN = 0, LENGTH = 0x80000 - ram : ORIGIN = 0xfc0000, LENGTH = 0x3f000 + ram : ORIGIN = 0xfc0000, LENGTH = 0x3c000 } SECTIONS diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.mlt b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.mlt --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.mlt +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flash.mlt @@ -1,6 +1,6 @@ version 0 region rom 0 80000 1 ! -region ram fc0000 3f000 0 ! +region ram fc0000 3c000 0 ! section rom_vectors 0 1 0 1 1 1 1 1 0 0 text text ! section text 0 4 0 1 0 1 0 1 fini fini ! section fini 0 4 0 1 0 1 0 1 rodata rodata ! diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.h b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.h --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.h +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.h @@ -11,10 +11,10 @@ #define CYGMEM_REGION_rom_SIZE (0x80000) #define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) #define CYGMEM_REGION_ram (0xfc0000) -#define CYGMEM_REGION_ram_SIZE (0x3f000) +#define CYGMEM_REGION_ram_SIZE (0x3c000) #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) #ifndef __ASSEMBLER__ extern char CYG_LABEL_NAME (__heap1) []; #endif #define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) -#define CYGMEM_SECTION_heap1_SIZE (0xfff000 - (size_t) CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xffc000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.ldi b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.ldi --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.ldi +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.ldi @@ -7,7 +7,7 @@ MEMORY { rom : ORIGIN = 0, LENGTH = 0x80000 - ram : ORIGIN = 0xfc0000, LENGTH = 0x3f000 + ram : ORIGIN = 0xfc0000, LENGTH = 0x3c000 } SECTIONS diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.mlt b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.mlt --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.mlt +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_flashromram.mlt @@ -1,6 +1,6 @@ version 0 region rom 0 80000 1 ! -region ram fc0000 3f000 0 ! +region ram fc0000 3c000 0 ! section rom_vectors 0 1 1 1 1 1 1 1 fc0000 0 ram_vectors ram_vectors ! section ram_vectors 0 4 1 1 0 1 0 1 text text ! section text 0 4 1 1 0 1 0 1 fini fini ! diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.h b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.h --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.h +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.h @@ -8,7 +8,7 @@ #endif #define CYGMEM_REGION_ram (0xfc0000) -#define CYGMEM_REGION_ram_SIZE (0x3f000) +#define CYGMEM_REGION_ram_SIZE (0x3c000) #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) #ifndef __ASSEMBLER__ extern char CYG_LABEL_NAME (__reserved) []; @@ -19,4 +19,4 @@ extern char CYG_LABEL_NAME (__reserved) extern char CYG_LABEL_NAME (__heap1) []; #endif #define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) -#define CYGMEM_SECTION_heap1_SIZE (0xfff000 - (size_t) CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xffc000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.ldi b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.ldi --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.ldi +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.ldi @@ -6,7 +6,7 @@ MEMORY { - ram : ORIGIN = 0xfc0000, LENGTH = 0x3f000 + ram : ORIGIN = 0xfc0000, LENGTH = 0x3c000 } SECTIONS diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.mlt b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.mlt --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.mlt +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_ram.mlt @@ -1,5 +1,5 @@ version 0 -region ram fc0000 3f000 0 ! +region ram fc0000 3c000 0 ! section reserved 4000 1 0 0 1 1 1 1 fc0000 fc0000 text text ! section text 0 4 0 1 0 1 0 1 fini fini ! section fini 0 4 0 1 0 1 0 1 rodata rodata ! diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.h b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.h --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.h +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.h @@ -11,10 +11,10 @@ #define CYGMEM_REGION_rom_SIZE (0x80000) #define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) #define CYGMEM_REGION_ram (0xfc0000) -#define CYGMEM_REGION_ram_SIZE (0x3f000) +#define CYGMEM_REGION_ram_SIZE (0x3c000) #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) #ifndef __ASSEMBLER__ extern char CYG_LABEL_NAME (__heap1) []; #endif #define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) -#define CYGMEM_SECTION_heap1_SIZE (0xfff000 - (size_t) CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xffc000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.ldi b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.ldi --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.ldi +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.ldi @@ -7,7 +7,7 @@ MEMORY { rom : ORIGIN = 0x100000, LENGTH = 0x80000 - ram : ORIGIN = 0xfc0000, LENGTH = 0x3f000 + ram : ORIGIN = 0xfc0000, LENGTH = 0x3c000 } SECTIONS diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.mlt b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.mlt --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.mlt +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_rom.mlt @@ -1,6 +1,6 @@ version 0 region rom 100000 80000 1 ! -region ram fc0000 3f000 0 ! +region ram fc0000 3c000 0 ! section rom_vectors 0 1 0 1 1 1 1 1 100000 100000 text text ! section text 0 4 0 1 0 1 0 1 fini fini ! section fini 0 4 0 1 0 1 0 1 rodata rodata ! diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.h b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.h --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.h +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.h @@ -11,10 +11,10 @@ #define CYGMEM_REGION_rom_SIZE (0x80000) #define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) #define CYGMEM_REGION_ram (0xfc0000) -#define CYGMEM_REGION_ram_SIZE (0x3f000) +#define CYGMEM_REGION_ram_SIZE (0x3c000) #define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) #ifndef __ASSEMBLER__ extern char CYG_LABEL_NAME (__heap1) []; #endif #define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) -#define CYGMEM_SECTION_heap1_SIZE (0xfff000 - (size_t) CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (0xffc000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.ldi b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.ldi --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.ldi +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.ldi @@ -7,7 +7,7 @@ MEMORY { rom : ORIGIN = 0x100000, LENGTH = 0x80000 - ram : ORIGIN = 0xfc0000, LENGTH = 0x3f000 + ram : ORIGIN = 0xfc0000, LENGTH = 0x3c000 } SECTIONS diff --git a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.mlt b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.mlt --- a/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.mlt +++ b/packages/hal/v85x/ceb_v850/current/include/pkgconf/mlt_v85x_v850_ceb_romram.mlt @@ -1,6 +1,6 @@ version 0 region rom 100000 80000 1 ! -region ram fc0000 3f000 0 ! +region ram fc0000 3c000 0 ! section rom_vectors 0 1 1 1 1 1 1 1 fc0000 100000 ram_vectors ram_vectors ! section ram_vectors 0 4 1 1 0 1 0 1 text text ! section text 0 4 1 1 0 1 0 1 fini fini ! diff --git a/packages/hal/v85x/v850/current/ChangeLog b/packages/hal/v85x/v850/current/ChangeLog --- a/packages/hal/v85x/v850/current/ChangeLog +++ b/packages/hal/v85x/v850/current/ChangeLog @@ -1,3 +1,7 @@ +2001-06-21 Jonathan Larmour + + * include/v850_common.h: Add register defns for other V850/SA1 models. + 2001-04-24 Jonathan Larmour * cdl/hal_v85x_v850.cdl: Separate v850_ice.cxx into separate file diff --git a/packages/hal/v85x/v850/current/include/v850_common.h b/packages/hal/v85x/v850/current/include/v850_common.h --- a/packages/hal/v85x/v850/current/include/v850_common.h +++ b/packages/hal/v85x/v850/current/include/v850_common.h @@ -171,6 +171,7 @@ #define V850_REG_TMC0 0xFFFFF208 #define V850_REG_CRC0 0xFFFFF20A #define V850_REG_TOC0 0xFFFFF20C +#define V850_REG_PRM01 0xFFFFF20E #define V850_REG_TM1 0xFFFFF210 #define V850_REG_CR10 0xFFFFF212 @@ -180,6 +181,7 @@ #define V850_REG_TMC1 0xFFFFF218 #define V850_REG_CRC1 0xFFFFF21A #define V850_REG_TOC1 0xFFFFF21C +#define V850_REG_PRM11 0xFFFFF21E #define V850_REG_TM2 0xFFFFF240 #define V850_REG_CR20 0xFFFFF242 @@ -187,11 +189,13 @@ #define V850_REG_TMC2 0xFFFFF246 #define V850_REG_TM23 0xFFFFF24A #define V850_REG_CR23 0xFFFFF24C +#define V850_REG_TCL21 0xFFFFF24E #define V850_REG_TM3 0xFFFFF250 #define V850_REG_CR30 0xFFFFF252 #define V850_REG_TCL3 0xFFFFF254 #define V850_REG_TMC3 0xFFFFF256 +#define V850_REG_TCL31 0xFFFFF25E #define V850_REG_TM4 0xFFFFF260 #define V850_REG_CR40 0xFFFFF262 @@ -199,11 +203,13 @@ #define V850_REG_TMC4 0xFFFFF266 #define V850_REG_TM45 0xFFFFF26A #define V850_REG_CR45 0xFFFFF26C +#define V850_REG_TCL41 0xFFFFF26E #define V850_REG_TM5 0xFFFFF270 #define V850_REG_CR50 0xFFFFF272 #define V850_REG_TCL5 0xFFFFF274 #define V850_REG_TMC5 0xFFFFF276 +#define V850_REG_TCL51 0xFFFFF27E #define V850_REG_SIO0 0xFFFFF2A0 #define V850_REG_CSIM0 0xFFFFF2A2 @@ -232,12 +238,14 @@ #define V850_REG_RXB1 0xFFFFF318 #define V850_REG_BRGMC1 0xFFFFF31E #define V850_REG_BRGMC10 0xFFFFF31E +#define V850_REG_BRGMC01 0xFFFFF320 #define V850_REG_IICC0 0xFFFFF340 #define V850_REG_IICS0 0xFFFFF342 #define V850_REG_IICCL0 0xFFFFF344 #define V850_REG_SVA0 0xFFFFF346 #define V850_REG_IIC0 0xFFFFF348 +#define V850_REG_IICX0 0xFFFFF34A #define V850_REG_WTM 0xFFFFF360 #define V850_REG_OSTS 0xFFFFF380 diff --git a/packages/io/eth/current/ChangeLog b/packages/io/eth/current/ChangeLog --- a/packages/io/eth/current/ChangeLog +++ b/packages/io/eth/current/ChangeLog @@ -1,3 +1,9 @@ +2001-06-21 David Woodhouse + + * src/stand_alone/eth_drv.c: Timeout when waiting for Ethernet + driver to finish sending packet. + * src/stand_alone/eth_drv.c: Don't delay if it's ready immediately. + 2001-06-11 Gary Thomas * cdl/eth_drivers.cdl: Make debug default for RedBoot. diff --git a/packages/io/eth/current/src/stand_alone/eth_drv.c b/packages/io/eth/current/src/stand_alone/eth_drv.c --- a/packages/io/eth/current/src/stand_alone/eth_drv.c +++ b/packages/io/eth/current/src/stand_alone/eth_drv.c @@ -250,8 +250,16 @@ eth_drv_write(char *eth_hdr, char *buf, #endif (sc->funs->send)(sc, sg_list, sg_len, len+14, (CYG_ADDRWORD)&packet_sent); - while (!packet_sent) { + wait_time = 500; + while (1) { (sc->funs->poll)(sc); + + if(packet_sent) + break; + + CYGACC_CALL_IF_DELAY_US(2*1000); + if (--wait_time <= 0) + goto reset_and_out; // Give up on sending packet } reset_and_out: if (dbg) { diff --git a/packages/io/flash/current/ChangeLog b/packages/io/flash/current/ChangeLog --- a/packages/io/flash/current/ChangeLog +++ b/packages/io/flash/current/ChangeLog @@ -1,3 +1,12 @@ +2001-06-19 Hugo Tyson + + * src/flash.c (flash_program): Only verify program with memcmp if + the status code suggests the programming went OK so far. + Otherwise all errors become verify errors. + + (flash_init): Fix bug in removal of dependency of printf(). The + pointer was not initialized until after the call into the driver. + 2001-06-11 Gary Thomas * src/flash.c: diff --git a/packages/io/flash/current/src/flash.c b/packages/io/flash/current/src/flash.c --- a/packages/io/flash/current/src/flash.c +++ b/packages/io/flash/current/src/flash.c @@ -68,6 +68,7 @@ flash_init(void *work_space, int work_sp int err; if (flash_info.init) return FLASH_ERR_OK; + flash_info.pf = pf; // Do this before calling into the driver flash_info.work_space = work_space; flash_info.work_space_size = work_space_size; if ((err = flash_hwr_init()) != FLASH_ERR_OK) { @@ -75,7 +76,6 @@ flash_init(void *work_space, int work_sp } flash_info.block_mask = ~(flash_info.block_size-1); flash_info.init = 1; - flash_info.pf = pf; return FLASH_ERR_OK; } @@ -255,10 +255,11 @@ flash_program(void *_addr, void *_data, flash_info.block_mask, flash_info.buffer_size); stat = flash_hwr_map_error(stat); #ifdef CYGSEM_IO_FLASH_VERIFY_PROGRAM - if (memcmp(addr, data, size) != 0) { - stat = 0x0BAD; - (*flash_info.pf)("V"); - } + if (0 == stat) // Claims to be OK + if (memcmp(addr, data, size) != 0) { + stat = 0x0BAD; + (*flash_info.pf)("V"); + } #endif if (stat) { *err_addr = (void *)addr; diff --git a/packages/io/wallclock/current/ChangeLog b/packages/io/wallclock/current/ChangeLog --- a/packages/io/wallclock/current/ChangeLog +++ b/packages/io/wallclock/current/ChangeLog @@ -1,3 +1,8 @@ +2001-06-21 Jonathan Larmour + + * tests/wallclock2.cxx: No need to check for CYGINT_LIBC_STARTUP_CONTEXT + as it is required by CYGPKG_LIBC_STARTUP. + 2001-04-06 Jonathan Larmour * include/wallclock/wallclock.inl (_simple_mkdate): Fix small diff --git a/packages/io/wallclock/current/tests/wallclock2.cxx b/packages/io/wallclock/current/tests/wallclock2.cxx --- a/packages/io/wallclock/current/tests/wallclock2.cxx +++ b/packages/io/wallclock/current/tests/wallclock2.cxx @@ -56,8 +56,6 @@ # define NA_MSG "Requires libc time functions" #elif !defined(CYGPKG_LIBC_STARTUP) # define NA_MSG "Requires libc startup package" -#elif !defined(CYGINT_LIBC_STARTUP_CONTEXT) -# define NA_MSG "Requires main to be invoked" #endif #ifndef NA_MSG 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-06-21 Jonathan Larmour + + * src/common/thread.cxx (Cyg_Thread::Cyg_Thread): Initialize + wakeup_count + 2001-06-06 Hugo Tyson * tests/clocktruth.cxx: New file. A test to get a sanity check on diff --git a/packages/kernel/current/src/common/thread.cxx b/packages/kernel/current/src/common/thread.cxx --- a/packages/kernel/current/src/common/thread.cxx +++ b/packages/kernel/current/src/common/thread.cxx @@ -193,6 +193,7 @@ Cyg_Thread::Cyg_Thread( // Start the thread in suspended state. state = SUSPENDED; suspend_count = 1; + wakeup_count = 0; // Initialize sleep_reason which is used by kill, release sleep_reason = NONE; 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,13 @@ +2001-06-18 Jonathan Larmour + + * src/input/fread.cxx (fread): Fix compilation problem with below + change. + +2001-06-15 Rob Jansen + + * src/input/fread.cxx (fread): Changed to read the requested amount + of data items instead of stopping on CYG_LIBC_STDIO_BUFSIZE boundaries. + 2001-06-08 Jeff Johnston * src/input/vfscanf.cxx (vfscanf)[CYGINT_LIBC_I18N_MB_REQUIRED]: Added diff --git a/packages/language/c/libc/stdio/current/src/input/fread.cxx b/packages/language/c/libc/stdio/current/src/input/fread.cxx --- a/packages/language/c/libc/stdio/current/src/input/fread.cxx +++ b/packages/language/c/libc/stdio/current/src/input/fread.cxx @@ -63,7 +63,10 @@ fread( void *ptr, size_t object_size, si { Cyg_StdioStream *real_stream = (Cyg_StdioStream *)stream; cyg_ucount32 bytes_read; + cyg_ucount32 bytes_to_read; + cyg_ucount32 total_read; Cyg_ErrNo err; + cyg_uint8 *ptrc = (cyg_uint8 *)ptr; CYG_REPORT_FUNCNAMETYPE( "fread", "read %d objects" ); @@ -71,20 +74,30 @@ fread( void *ptr, size_t object_size, si "stream=%08x", ptr, object_size, num_objects, stream ); - if ( (object_size==0) || (num_objects==0) ) { + bytes_to_read = object_size*num_objects; + total_read = 0; + + if ( !bytes_to_read ) { CYG_REPORT_RETVAL(0); return 0; } // if - err = real_stream->read( (cyg_uint8 *)ptr, object_size*num_objects, + err = real_stream->read( (cyg_uint8 *)ptr, bytes_to_read, &bytes_read ); + bytes_to_read -= bytes_read; + total_read += bytes_read; + ptrc += bytes_read; - if (!err && !bytes_read) { // if no err, but nothing to read, try again + while (!err && bytes_to_read) { // if no err, but not finished - get next err = real_stream->refill_read_buffer(); - if ( !err ) - err = real_stream->read( (cyg_uint8 *)ptr, object_size*num_objects, + if ( !err ) { + err = real_stream->read( (cyg_uint8 *)ptr, bytes_to_read, &bytes_read ); - } // if + bytes_to_read -= bytes_read; + total_read += bytes_read; + ptrc += bytes_read; + } // if + } // while if (err) { real_stream->set_error( err ); @@ -94,7 +107,7 @@ fread( void *ptr, size_t object_size, si // we return the number of _objects_ read. Simple division is // sufficient as this returns the quotient rather than rounding CYG_REPORT_RETVAL( bytes_read/object_size ); - return bytes_read/object_size; + return total_read/object_size; } // fread() diff --git a/packages/language/c/libc/stdlib/current/ChangeLog b/packages/language/c/libc/stdlib/current/ChangeLog --- a/packages/language/c/libc/stdlib/current/ChangeLog +++ b/packages/language/c/libc/stdlib/current/ChangeLog @@ -1,3 +1,7 @@ +2001-06-18 Jonathan Larmour + + * cdl/stdlib.cdl: requires string functions, so say so. + 2001-02-14 Jonathan Larmour * src/rand.cxx: Fix typo diff --git a/packages/language/c/libc/stdlib/current/cdl/stdlib.cdl b/packages/language/c/libc/stdlib/current/cdl/stdlib.cdl --- a/packages/language/c/libc/stdlib/current/cdl/stdlib.cdl +++ b/packages/language/c/libc/stdlib/current/cdl/stdlib.cdl @@ -56,6 +56,7 @@ cdl_package CYGPKG_LIBC_STDLIB { implements CYGINT_ISO_ABS implements CYGINT_ISO_DIV requires CYGINT_ISO_CTYPE + requires CYGINT_ISO_STRING_STRFUNCS compile abs.cxx atox.cxx bsearch.cxx \ div.cxx getenv.cxx qsort.cxx \ diff --git a/packages/language/c/libc/time/current/ChangeLog b/packages/language/c/libc/time/current/ChangeLog --- a/packages/language/c/libc/time/current/ChangeLog +++ b/packages/language/c/libc/time/current/ChangeLog @@ -1,3 +1,9 @@ +2001-06-22 Jesper Skov + + * cdl/time.cdl (CYGFUN_LIBC_TIME_SUS_EXTNS): Added. + * src/strftime.cxx (do_format): Added some Single UNIX + extensions. + 2001-04-25 Bart Veer * tests/time.c (MAX_TIMEOUT): diff --git a/packages/language/c/libc/time/current/cdl/time.cdl b/packages/language/c/libc/time/current/cdl/time.cdl --- a/packages/language/c/libc/time/current/cdl/time.cdl +++ b/packages/language/c/libc/time/current/cdl/time.cdl @@ -111,7 +111,16 @@ cdl_package CYGPKG_LIBC_TIME { asctime_r(), ctime_r(), gmtime_r(), and localtime_r()." } - + + cdl_option CYGFUN_LIBC_TIME_SUS_EXTNS { + display "Single UNIX extensions" + default_value 0 + description " + Enabling this option allows the use of + certain additional conversion specifiers + in the strftime function." + } + cdl_component CYGPKG_LIBC_TIME_ZONES { display "Time zone offsets" flavor none diff --git a/packages/language/c/libc/time/current/src/strftime.cxx b/packages/language/c/libc/time/current/src/strftime.cxx --- a/packages/language/c/libc/time/current/src/strftime.cxx +++ b/packages/language/c/libc/time/current/src/strftime.cxx @@ -88,6 +88,10 @@ do_format(cyg_uint8 fmtchar, cyg_ucount3 for (i=0; itm_wday]; ++i) buf[i] = cyg_libc_time_day_name[timeptr->tm_wday][i]; return i; +#ifdef CYGFUN_LIBC_TIME_SUS_EXTNS + case 'h': + // ** fall through ** +#endif case 'b': if (sizeleft<3) return -1; @@ -117,6 +121,15 @@ do_format(cyg_uint8 fmtchar, cyg_ucount3 buf[0] = (timeptr->tm_mday / 10) + '0'; buf[1] = (timeptr->tm_mday % 10) + '0'; return 2; +#ifdef CYGFUN_LIBC_TIME_SUS_EXTNS + case 'e': + if (sizeleft < 2) + return -1; + i = (timeptr->tm_mday / 10); + buf[0] = (0 == i) ? ' ' : i + '0'; + buf[1] = (timeptr->tm_mday % 10) + '0'; + return 2; +#endif case 'H': if (sizeleft < 2) return -1; @@ -160,6 +173,18 @@ do_format(cyg_uint8 fmtchar, cyg_ucount3 buf[0] = (timeptr->tm_sec / 10) + '0'; buf[1] = (timeptr->tm_sec % 10) + '0'; return 2; +#ifdef CYGFUN_LIBC_TIME_SUS_EXTNS + case 'T': + if (sizeleft < 8) + return -1; + + // Recurse! Note that we know that we will have left room for the + // trailing NULL in the strftime body + + i = strftime( buf, sizeleft+1, "%H:%M:%S", timeptr); + + return ((0==i) ? -1 : i); +#endif case 'U': if (sizeleft < 2) return -1; diff --git a/packages/net/tcpip/current/ChangeLog b/packages/net/tcpip/current/ChangeLog --- a/packages/net/tcpip/current/ChangeLog +++ b/packages/net/tcpip/current/ChangeLog @@ -1,3 +1,20 @@ +2001-06-20 Grant Edwards +2001-06-20 Hugo Tyson + + * src/lib/dhcp_prot.c (alarm_function): Change the lease state + before re-enabling the alarm so that if it somehow gets times of + zero (ie. right now) it quickly completes the state machine rather + than recursing to its doom. + (new_lease): Test the retcode of get_bootp_option() and use + obvious defaults if the T1 and T2 times are not provided - this is + RFC compliant! - and use "infinite lease" if the lease time is not + provided at all. + +2001-06-19 Trenton D. Adams + + * tests/server_test.c (server_test): Null terminate read string + at right place. + 2001-06-13 Jonathan Larmour * cdl/net.cdl: Make debug output an option. Include DHCP. diff --git a/packages/net/tcpip/current/src/lib/dhcp_prot.c b/packages/net/tcpip/current/src/lib/dhcp_prot.c --- a/packages/net/tcpip/current/src/lib/dhcp_prot.c +++ b/packages/net/tcpip/current/src/lib/dhcp_prot.c @@ -277,14 +277,14 @@ static void alarm_function(cyg_handle_t cyg_alarm_disable( alarm ); } else if ( lease->next & DHCP_LEASE_T2 ) { + lease->next = DHCP_LEASE_EX; cyg_alarm_initialize( lease->alarm, lease->expiry, 0 ); cyg_alarm_enable( lease->alarm ); - lease->next = DHCP_LEASE_EX; } else if ( lease->next & DHCP_LEASE_T1 ) { + lease->next = DHCP_LEASE_T2; cyg_alarm_initialize( lease->alarm, lease->t2, 0 ); cyg_alarm_enable( lease->alarm ); - lease->next = DHCP_LEASE_T2; } } @@ -303,6 +303,7 @@ static inline void new_lease( struct boo cyg_tick_count_t now = cyg_current_time(); cyg_tick_count_t then; cyg_uint32 tag = 0; + cyg_uint32 expiry_then; cyg_resolution_t resolution = cyg_clock_get_resolution(cyg_real_time_clock()); cyg_handle_t h; @@ -315,7 +316,8 @@ static inline void new_lease( struct boo &lease->alarm, &lease->alarm_obj ); // extract the lease time and scale it &c to now. - get_bootp_option( bootp, TAG_DHCP_LEASE_TIME, &tag ); + if(!get_bootp_option( bootp, TAG_DHCP_LEASE_TIME, &tag )) + tag = 0xffffffff; if ( 0xffffffff == tag ) { lease->expiry = 0xffffffffffffffff; @@ -325,19 +327,24 @@ static inline void new_lease( struct boo } then = (cyg_uint64)(ntohl(tag)); + expiry_then = then; then *= 1000000000; // into nS - we know there is room in a tick_count_t then = (then / resolution.dividend) * resolution.divisor; // into system ticks lease->expiry = now + then; - get_bootp_option( bootp, TAG_DHCP_REBIND_TIME, &tag ); - then = (cyg_uint64)(ntohl(tag)); + if (get_bootp_option( bootp, TAG_DHCP_REBIND_TIME, &tag )) + then = (cyg_uint64)(ntohl(tag)); + else + then = expiry_then - expiry_then/4; then *= 1000000000; // into nS - we know there is room in a tick_count_t then = (then / resolution.dividend) * resolution.divisor; // into system ticks lease->t2 = now + then; - get_bootp_option( bootp, TAG_DHCP_RENEWAL_TIME, &tag ); - then = (cyg_uint64)(ntohl(tag)); + if (get_bootp_option( bootp, TAG_DHCP_RENEWAL_TIME, &tag )) + then = (cyg_uint64)(ntohl(tag)); + else + then = expiry_then/2; then *= 1000000000; // into nS - we know there is room in a tick_count_t then = (then / resolution.dividend) * resolution.divisor; // into system ticks lease->t1 = now + then; @@ -348,6 +355,13 @@ static inline void new_lease( struct boo lease->t1 = now + 2500; #endif +#ifdef CYGDBG_NET_DHCP_CHATTER + diag_printf("new_lease:\n"); + diag_printf(" expiry = %d\n",lease->expiry); + diag_printf(" t1 = %d\n",lease->t1); + diag_printf(" t2 = %d\n",lease->t2); +#endif + lease->next = DHCP_LEASE_T1; cyg_alarm_initialize( lease->alarm, lease->t1, 0 ); diff --git a/packages/net/tcpip/current/tests/server_test.c b/packages/net/tcpip/current/tests/server_test.c --- a/packages/net/tcpip/current/tests/server_test.c +++ b/packages/net/tcpip/current/tests/server_test.c @@ -131,8 +131,8 @@ server_test(struct bootp *bp) FD_SET(client, &in_fds); num = select(client+1, &in_fds, 0, 0, &tv); if (num > 0) { - len = read(client, buf, sizeof(buf)); - buf[len-1] = '\0'; + len = read(client, buf, sizeof(buf)-1); + buf[len] = '\0'; diag_printf("buf = '%s'\n", buf); } else { perror("select"); diff --git a/packages/pkgconf/fixhtml.tcl b/packages/pkgconf/fixhtml.tcl --- a/packages/pkgconf/fixhtml.tcl +++ b/packages/pkgconf/fixhtml.tcl @@ -60,13 +60,13 @@ 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 diff --git a/packages/pkgconf/rules.mak b/packages/pkgconf/rules.mak --- a/packages/pkgconf/rules.mak +++ b/packages/pkgconf/rules.mak @@ -53,25 +53,19 @@ endif %.o.d : %.c @mkdir -p $(dir $@) $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $< - @echo $@ ':' $< '\' > $@ - @tail +2 $(@:.o.d=.tmp) >> $@ - @echo >> $@ + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.o.d=.tmp) %.o.d : %.cxx @mkdir -p $(dir $@) $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $< - @echo $@ ':' $< '\' > $@ - @tail +2 $(@:.o.d=.tmp) >> $@ - @echo >> $@ + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.o.d=.tmp) %.o.d : %.S @mkdir -p $(dir $@) $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $< - @echo $@ ':' $< '\' > $@ - @tail +2 $(@:.o.d=.tmp) >> $@ - @echo >> $@ + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.o.d=.tmp) # pattern matching rules to generate a test object from source code @@ -80,25 +74,19 @@ endif %.d : %.c @mkdir -p $(dir $@) $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $< - @echo $@ ':' $< '\' > $@ - @tail +2 $(@:.d=.tmp) >> $@ - @echo >> $@ + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.d=.tmp) %.d : %.cxx @mkdir -p $(dir $@) $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $< - @echo $@ ':' $< '\' > $@ - @tail +2 $(@:.d=.tmp) >> $@ - @echo >> $@ + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.d=.tmp) %.d : %.S @mkdir -p $(dir $@) $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $< - @echo $@ ':' $< '\' > $@ - @tail +2 $(@:.d=.tmp) >> $@ - @echo >> $@ + @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@ @rm $(@:.d=.tmp) # rule to generate a test executable from object code 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,8 @@ +2001-06-22 Gary Thomas + + * src/load.c (do_load): Move [static] data used by decompression + code into this routine where it is used - no longer static. + 2001-06-14 Gary Thomas * src/xyzModem.c (xyzModem_get_hdr): More resilient header scan, 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 @@ -46,11 +46,6 @@ #include #include -#ifdef CYGPKG_COMPRESS_ZLIB -static unsigned char _buffer[CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER]; -static _pipe_t load_pipe; -#endif - // Buffer used by redboot_getc getc_info_t getc_info; @@ -395,7 +390,10 @@ do_load(int argc, char *argv[]) if (raw) { #ifdef CYGPKG_COMPRESS_ZLIB if (decompress) { + _pipe_t load_pipe; _pipe_t* p = &load_pipe; + unsigned char _buffer[CYGNUM_REDBOOT_LOAD_ZLIB_BUFFER]; + p->out_buf = (unsigned char*) base; p->out_size = 0; p->in_buf = _buffer; 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,26 @@ +2001-06-20 Jonathan Larmour + + * include/mvarimpl.inl (get_status): Correct calculation of maxfree + by taking into account metadata. + +2001-06-18 Jonathan Larmour + + * cdl/memalloc.cdl: Add heaptest test. + + * tests/heaptest.c: New test to do a memory check of all of heap. + + * src/dlmalloc.cxx (get_status): Correct maxfree and totalfree + by accounting for block headers. + + * tests/realloc.c (cyg_start): Remove warning from declaration. + * tests/malloc1.c (cyg_start): Ditto. + * tests/malloc2.c (cyg_start): Ditto. + * tests/malloc3.c (cyg_start): Ditto. + * tests/malloc4.cxx (cyg_start): Ditto. Also add DEBUGTEST define + and fix comment. + + * tests/testaux.hxx (STACKSIZE): Double. + 2001-05-02 Hugo Tyson * src/dlmalloc.cxx (Cyg_Mempool_dlmalloc_Implementation): Fix diff --git a/packages/services/memalloc/common/current/cdl/memalloc.cdl b/packages/services/memalloc/common/current/cdl/memalloc.cdl --- a/packages/services/memalloc/common/current/cdl/memalloc.cdl +++ b/packages/services/memalloc/common/current/cdl/memalloc.cdl @@ -343,7 +343,7 @@ cdl_package CYGPKG_MEMALLOC { display "Tests" flavor data no_define - calculated { "tests/dlmalloc1 tests/dlmalloc2 tests/kmemfix1 tests/kmemvar1 tests/malloc1 tests/malloc2 tests/malloc3 tests/malloc4 tests/memfix1 tests/memfix2 tests/memvar1 tests/memvar2 tests/realloc" } + calculated { "tests/dlmalloc1 tests/dlmalloc2 tests/heaptest tests/kmemfix1 tests/kmemvar1 tests/malloc1 tests/malloc2 tests/malloc3 tests/malloc4 tests/memfix1 tests/memfix2 tests/memvar1 tests/memvar2 tests/realloc" } description " This option specifies the set of tests for this package." } diff --git a/packages/services/memalloc/common/current/include/mvarimpl.inl b/packages/services/memalloc/common/current/include/mvarimpl.inl --- a/packages/services/memalloc/common/current/include/mvarimpl.inl +++ b/packages/services/memalloc/common/current/include/mvarimpl.inl @@ -424,7 +424,7 @@ Cyg_Mempool_Variable_Implementation::get if(dq->size > mf) mf = dq->size; } while(1); - status.maxfree = mf; + status.maxfree = mf - sizeof(struct memdq); } // as quick or quicker to just set it, rather than test flag first status.origbase = obase; 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 @@ -1619,9 +1619,9 @@ 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; + status.totalfree = avail - (2*SIZE_SZ) - MINSIZE; status.freeblocks = navail; - status.maxfree = maxfree; + status.maxfree = maxfree - (2*SIZE_SZ) - MINSIZE; } // if // as quick or quicker to just set most of these, rather than diff --git a/packages/services/memalloc/common/current/tests/heaptest.c b/packages/services/memalloc/common/current/tests/heaptest.c new file mode 100644 --- /dev/null +++ b/packages/services/memalloc/common/current/tests/heaptest.c @@ -0,0 +1,221 @@ +//================================================================= +// +// heaptest.cxx +// +// Test all the memory used by heaps to check it's all valid +// +//================================================================= +//####COPYRIGHTBEGIN#### +// +// ------------------------------------------- +// The contents of this file are subject to the Red Hat eCos Public License +// Version 1.1 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://www.redhat.com/ +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations under +// the License. +// +// The Original Code is eCos - Embedded Configurable Operating System, +// released September 30, 1998. +// +// The Initial Developer of the 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): jlarmour +// Contributors: +// Date: 2001-07-17 +// Description: Tests all memory allocated for use by heaps. +// +// +//####DESCRIPTIONEND#### + +// INCLUDES + +#include +#include +#include // config header +#ifdef CYGPKG_ISOINFRA +# include +# include +#endif +#include + +#if !defined(CYGPKG_ISOINFRA) +# define NA_MSG "Requires isoinfra package" +#elif !CYGINT_ISO_MALLOC +# define NA_MSG "Requires malloc" +#elif !CYGINT_ISO_MALLINFO +# define NA_MSG "Requires mallinfo" +#endif + +#ifdef NA_MSG + +externC void +cyg_start(void) +{ + CYG_TEST_INIT(); + CYG_TEST_NA( NA_MSG ); + CYG_TEST_FINISH("Done"); +} +#else + +#include + +#define ERRORTHRESHOLD 10 +#define ITERS (cyg_test_is_simulator ? 1 : 10) +#define INTALIGNED(_x_) (!((unsigned long)(_x_) & (sizeof(int)-1))) + +int +test_pat(unsigned char *buf, int size, + unsigned int pat, cyg_bool addrpat, + const char *testname) +{ + unsigned char *bufptr=buf; + register unsigned int *ibufptr; + unsigned char *endptr=buf+size; + register unsigned int *endptra; // int aligned + int errors=0; + unsigned char bpat = pat & 0xFF; + + endptra = (int *)((unsigned long)endptr & ~(sizeof(int)-1)); + + // Set to the pattern + while (!INTALIGNED(bufptr)) { + if (addrpat) + bpat = ((int)bufptr)&0xFF; + *bufptr++ = bpat; + } + + ibufptr = (unsigned int *)bufptr; + + while ( ibufptr < endptra ) { + if (addrpat) + pat = (unsigned int)ibufptr; + *ibufptr++ = pat; + } + + bufptr = (unsigned char *)ibufptr; + while ( bufptr < endptr ) { + if (addrpat) + bpat = ((int)bufptr)&0xFF; + *bufptr++ = bpat; + } + + // Now compare to the pattern + bufptr = buf; + while ( !INTALIGNED(bufptr) ) { + if (addrpat) + bpat = ((int)bufptr)&0xFF; + if ( *bufptr != bpat ) { + diag_printf( "Failed to compare at 0x%08x\n", bufptr ); + if ( errors++ == ERRORTHRESHOLD ) + CYG_TEST_FAIL_FINISH( testname ); + } + bufptr++; + } + + ibufptr = (unsigned int *)bufptr; + + while ( ibufptr < endptra ) { + if (addrpat) + pat = (unsigned int)ibufptr; + if ( *ibufptr != pat ) { + diag_printf( "Failed to compare at 0x%08x\n", bufptr ); + if ( errors++ == ERRORTHRESHOLD ) + CYG_TEST_FAIL_FINISH( testname ); + } + ibufptr++; + } + + bufptr = (unsigned char *)ibufptr; + while ( bufptr < endptr ) { + if (addrpat) + bpat = ((int)bufptr)&0xFF; + if ( *bufptr != bpat ) { + diag_printf( "Failed to compare at 0x%08x\n", bufptr ); + if ( errors++ == ERRORTHRESHOLD ) + CYG_TEST_FAIL_FINISH( testname ); + } + bufptr++; + } + if (errors) + CYG_TEST_FAIL( testname ); + else + CYG_TEST_PASS( testname ); + return errors; +} // test_pat() + +externC void +cyg_start(void) +{ + unsigned int allonesint=0, checkerboardint1=0, checkerboardint2=0; + int i; + int errors=0; + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + cyg_hal_invoke_constructors(); +#endif + CYG_TEST_INIT(); + CYG_TEST_INFO("Starting heaptest"); + + for (i=0; i\n", + buf, info.maxfree ); + for (i=0; i