zoukankan      html  css  js  c++  java
  • 关于Xil_Assert断言产生的死循环,导致程序未执行的问题

    XGpioPs_SetDirection(Gpio,0x7,0x01);

    I am designed to write XGpioPs_SetDirectionPin(Gpio,0x07,0x01) but make a mistake !

    The driver api will check the validity of parameters:

    Xil_AssertVoid(InstancePtr != NULL);

        Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

        Xil_AssertVoid(Pin < XGPIOPS_DEVICE_MAX_PIN_NUM);

        Xil_AssertVoid((Direction == 0) || (Direction == 1));

    Go into sentence: Xil_AssertVoid(Pin < XGPIOPS_DEVICE_MAX_PIN_NUM);

    if (Expression) { \

    Xil_AssertStatus = XIL_ASSERT_NONE; \

    } else { \

    Xil_Assert(__FILE__, __LINE__); \

    Xil_AssertStatus = XIL_ASSERT_OCCURRED; \

    return; \

    }

    Once the parameters occur false and the following 2 sentences will be executed:

    Xil_Assert(__FILE__, __LINE__);

    Xil_AssertStatus = XIL_ASSERT_OCCURRED;

    It just set the Xil_AssertStatus flag and transform the error location information to the specified routes.

    void Xil_Assert(const char *File, int Line)

    {

        /* if the callback has been set then invoke it */

        if (Xil_AssertCallbackRoutine != 0) {

            (*Xil_AssertCallbackRoutine)(File, Line);

        }

     

        /* if specified, wait indefinitely such that the assert will show up

         * in testing

         */

        while (Xil_AssertWait) {

        }

    }

    Once the routes equal 0, that's no route being set, just run endless loop.

    So if you application seems go away but no error message has been output or the specified flow has not been executed, just to think about the

    ASSERT loop.

     

     

     

     

     

     

     

     

  • 相关阅读:
    编程术语英汉对照
    asp.net常用函数
    好的博客地址
    读取项目中的txt文件内容
    Web Service的定义
    ADO.NET在开发中的部分使用方法和技巧
    如何实现文本框焦点自动跳转及通过回车键提交表单
    15位和18位身份证JS校验实例
    PL/SQL 操作数据库常见脚本
    android 隐藏标题栏
  • 原文地址:https://www.cnblogs.com/dragen/p/3134101.html
Copyright © 2011-2022 走看看