⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsp_check.cpp

📁 epson usb2.0 控制芯片 S1R72V05 固件程序。
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    if(*_kernel_tmax_cycid < 1)
        return true;

    DT_RELTIM maxreltim = container->getVariableInfo("TMAX_RELTIM").value;
    TargetVariable<DT_UINT> cycatr("_kernel_cycinib_table", "cyclic_handler_initialization_block::cycatr");
    TargetVariable<DT_RELTIM> cyctim("_kernel_cycinib_table", "cyclic_handler_initialization_block::cyctim");
    TargetVariable<DT_RELTIM> cycphs("_kernel_cycinib_table", "cyclic_handler_initialization_block::cycphs");

    VerboseMessage("% object : % items\n","%僆僽僕僃僋僩 : % 屄\n") << object << *_kernel_tmax_cycid;
    for(id = 1; id <= *_kernel_tmax_cycid; id++)
    {
        set_banner(parameter, object, CYCLICHANDLER, id);

            //attribute validation check
        if((*cycatr & ~0x7) != 0)
            notify(STANDARD,
                Message("Illegal attribute value [0x%]","偍偐偟側懏惈抣 [0x%]") << (*cycatr & ~0x1));

        if((*cycatr & 0x4) != 0)
            notify(TOPPERS,     //旕埶懚晹側偺偱RESTRICTED偵偟側偄
                Message("TA_PHS is not supported in this kernel.","TA_PHS偼僒億乕僩奜"));

            // 懏惈抣偵 TA_ASM 偑娷傑傟偰偄傞
        if((*cycatr & 0x1) != 0)
            notify( RESTRICTED,
                Message("TOPPERS/JSP Kernel never minds the flag 'TA_ASM'.",
                        "TOPPERS/JSP僇乕僱儖偺慡偰偺婡庬埶懚晹偱TA_ASM傪僒億乕僩偡傞偲偼尷傜側偄"));

            //RELTIM偱偺昞尰斖埻撪偵偁傞偐偳偆偐偺僠僃僢僋
        if(*cyctim > maxreltim)
            notify(STANDARD,
                Message("The cyclic object has a period (%) that exceeds the maximum period (%)",
                        "婲摦廃婜(%)偑昞尰壜擻側憡懳帪娫偺斖埻(%)傪挻偊偰偄傑偡") << *cyctim << maxreltim);

            //婲摦廃婜偑0偱側偄偙偲偺僠僃僢僋
        if(*cyctim == 0)
            notify(STANDARD,
                Message("The cyclic object has a ZERO period.",
                        "婲摦廃婜偑0偵側偭偰偄傑偡"));

        if(*cycphs > maxreltim)
            notify(STANDARD,
                Message("The cyclic object has a initial delay (%) that exceeds the maximum period (%)",
                        "婲摦埵憡(%)偑昞尰壜擻側憡懳帪娫偺斖埻(%)傪挻偊偰偄傑偡") << *cycphs << maxreltim);

        ++ cycatr, ++ cyctim, ++ cycphs;
    }

    return old_error_count == error_count;
}

bool ConfigurationChecker::check_interrupt_handlerblock(Directory & parameter, FileContainer * container)
{
    unsigned int id;
    unsigned int old_error_count = error_count;

    Message object("Interrupt handler","妱崬傒僴儞僪儔");

    TargetVariable<DT_UINT> _kernel_tnum_inhno("_kernel_tnum_inhno");
    if(*_kernel_tnum_inhno == 0)
        return true;

    TargetVariable<DT_UINT> inhatr("_kernel_inhinib_table", "interrupt_handler_initialization_block::inhatr");
    TargetVariable<DT_FP>   inthdr("_kernel_inhinib_table", "interrupt_handler_initialization_block::inthdr");

    VerboseMessage("% object : % items\n","%僆僽僕僃僋僩 : % 屄\n") << object << *_kernel_tnum_inhno;
    for(id = 0; id < *_kernel_tnum_inhno; id++)
    {
        set_banner(parameter, object, INTERRUPTHANDLER, id);

            //attribute validation check
        if((*inhatr & 0x1) != 0)
            notify(STANDARD,
                Message("The attribute can take only TA_HLNG|TA_ASM",
                        "TA_HLNG|TA_ASM埲奜偺懏惈偼愝掕偱偒傑偣傫"));

            // 懏惈抣偵 TA_ASM 偑娷傑傟偰偄傞
        if((*inhatr & 0x1) != 0)
            notify(RESTRICTED,
                Message("TOPPERS/JSP Kernel never minds the flag 'TA_ASM'.",
                        "TA_ASM偑巊梡偝傟偰偄傞"));

            // 婲摦斣抧僠僃僢僋
        if(*inthdr == 0)
            notify(RESTRICTED,
                Message("NULL pointer is specified as an inthdr address.",
                        "妱崬傒僴儞僪儔偺斣抧偑NULL偱偡"));

        ++ inhatr, ++ inthdr;
    }

    return old_error_count == error_count;
}

bool ConfigurationChecker::check_exception_handlerblock(Directory & parameter, FileContainer * container)
{
    unsigned int id;
    unsigned int old_error_count = error_count;

    Message object("Exception handler","椺奜僴儞僪儔");

    TargetVariable<DT_UINT> _kernel_tnum_excno("_kernel_tnum_excno");
    if(*_kernel_tnum_excno == 0)
        return true;

    TargetVariable<DT_UINT> excatr("_kernel_excinib_table", "cpu_exception_handler_initialization_block::excatr");
    TargetVariable<DT_FP>   exchdr("_kernel_excinib_table", "cpu_exception_handler_initialization_block::exchdr");

    VerboseMessage("% object : % items\n","%僆僽僕僃僋僩 : % 屄\n") << object << *_kernel_tnum_excno;
    for(id = 0; id < *_kernel_tnum_excno; id++)
    {
        set_banner(parameter, object, EXCEPTIONHANDLER, id);

            //attribute validation check
        if((*excatr & 0x1) != 0)
            notify(STANDARD,
                Message("The attribute can take only TA_HLNG|TA_ASM",
                        "TA_HLNG|TA_ASM埲奜偺懏惈偼愝掕偱偒傑偣傫"));

            // 懏惈抣偵 TA_ASM 偑娷傑傟偰偄傞
        if((*excatr & 0x1) != 0)
            notify(RESTRICTED,
                Message("TOPPERS/JSP Kernel never minds the flag 'TA_ASM'.",
                        "TOPPERS/JSP僇乕僱儖偺慡偰偺婡庬埶懚晹偱TA_ASM傪僒億乕僩偡傞偲偼尷傜側偄"));

            // 婲摦斣抧僠僃僢僋
        if(*exchdr == 0)
            notify(RESTRICTED,
                Message("NULL pointer is specified as an exchdr address.",
                        "椺奜僴儞僪儔偺斣抧偑NULL偱偡"));

        ++ excatr, ++ exchdr;
    }

    return old_error_count == error_count;
}

//------------------------------------------------------

void ConfigurationChecker::parseOption(Directory & parameter)
{
    string loadmodule;
    string work;

    if(findOption("h","help"))
    {
        cout << endl << Message(
            "Configuration checker - option\n"
            "  -m, --module=filename : Specify the load module (essential option)\n"
            "  -cs, --script=filename  : Specify the checker script file\n"
            "  -cl, --checklevel=level : Specify one of the check levels below \n"
            "    l(azy)       : Minimum check will be performed.\n"
            "    s(tandard)   : includes some ITRON Standard check items.\n"
            "    t(oppers)    : checks whether it meets TOPPERS/JSP restrictions\n"
            "    r(estricted) : All of check items will be performed.\n",
            "僐儞僼傿僊儏儗乕僔儑儞僠僃僢僇 - 僆僾僔儑儞\n"
            "  -m, --module=僼傽僀儖柤 : 儘乕僪儌僕儏乕儖柤傪巜掕偟傑偡 (昁恵崁栚)\n"
            "  -cs, --script=僼傽僀儖柤  : 僠僃僢僇僗僋儕僾僩傪巜掕偟傑偡\n"
            "  -cl, --checklevel=level : Specify one of the check levels below \n"
            "    l(azy)       : 嵟彫尷偺僠僃僢僋偺傒傪峴偄傑偡\n"
            "    s(tandard)   : ITRON巇條偺斖埻偱僠僃僢僋傪峴偄傑偡\n"
            "    t(oppers)    : TOPPERS/JSP僇乕僱儖偺惂尷傪枮偨偡偙偲傪妋擣偟傑偡\n"
            "    r(estricted) : 婡庬埶懚晹傪娷傔慡偰偺僠僃僢僋崁栚傪幚巤偟傑偡\n");
        cout << endl 
             << Message("Supported architecture : ", "懳墳傾乕僉僥僋僠儍 : ")
             << FileContainer::getInstance()->getArchitecture()
             << endl;
        return;
    }

    if(findOption("m","module",&loadmodule) || findOption(DEFAULT_PARAMETER,NULL,&loadmodule))
    {
        if(findOption("s","source"))
            ExceptionMessage("Configuration checker can not execute while Configurator executes","僐儞僼傿僊儏儗乕僞偲僠僃僢僇偼摨帪偵婲摦偱偒傑偣傫").throwException();

        parameter["/file/loadmodule"] = loadmodule;
        activateComponent();
    }

    if(!findOption("cs","script",&work))
        work = loadmodule.substr(0,loadmodule.find_last_of('.')) + ".chk";
    parameter["/file/checkerscript"] = work;

    work.erase();
    if(findOption("obj","load-object",&work))
    {
        if(work.empty())
            work.assign("kernel_obj.dat");

        fstream f(work.c_str(), ios::in|ios::binary);
        if(f.is_open())
        {
            parameter["/object"].Load(&f);
            f.close();
        }else
            ExceptionMessage(" Failed to open the file '%' for storing object definitions"," 僆僽僕僃僋僩忣曬傪奿擺偡傞偨傔偺僼傽僀儖(%)偑奐偗傑偣傫") << work << throwException;
    }

    if(findOption("cl","checklevel",&work))
    {
        current_level = UNKNOWN;

        if(work.compare("lazy") == 0 || work[0] == 'l')
            current_level = LAZY;
        if(work.compare("standard") == 0 || work[0] == 's')
            current_level = STANDARD;
        if(work.compare("toppers") == 0 || work[0] == 't')
            current_level = TOPPERS;
        if(work.compare("restricted") == 0 || work[0] == 'r')
            current_level = RESTRICTED;

        if(current_level == UNKNOWN)
            ExceptionMessage(" Unknown check level [%] specified"," 柍岠側僠僃僢僋儗儀儖巜掕 [%]") << work << throwException;
    }else
        current_level = NORMAL;

    checkOption("cpu", "cpu");
    checkOption("system", "system");
}

void ConfigurationChecker::body(Directory & parameter)
{
    FileContainer * container;
    bool result = true;

        /* 傛傝桪愭搙偺崅偄僄儔乕傕懳徾偵 */
    current_level = static_cast<enum tagCheckLevel>(static_cast<int>(current_level) * 2 - 1);

    container = FileContainer::getInstance();
    container->attachInfo(parameter["/file/checkerscript"].toString());
    container->attachModule(parameter["/file/loadmodule"].toString());

    if(VerboseMessage::getVerbose())
    {
        cout << Message("  Target architecture : ","  僞乕僎僢僩傾乕僉僥僋僠儍 : ")
             << container->getArchitecture() << endl;
    }

    error_count = 0;
    result &= check_taskblock(parameter,container);
    result &= check_semaphoreblock(parameter,container);
    result &= check_eventflagblock(parameter,container);
    result &= check_dataqueueblock(parameter,container);
    result &= check_mailboxblock(parameter,container);
    result &= check_fixed_memorypoolblock(parameter,container);
    result &= check_cyclic_handlerblock(parameter,container);
    result &= check_interrupt_handlerblock(parameter,container);
    result &= check_exception_handlerblock(parameter,container);

    if(!result)
        ExceptionMessage("Total % errors found in current configuration.\n","慡晹偱%屄偺僄儔乕偑専弌偝傟傑偟偨\n") << error_count << throwException;

    VerboseMessage("No error found in current configuration\n","峔惉偵堎忢偼偁傝傑偣傫偱偟偨\n");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -