找回密码
 注册
搜索
查看: 974|回复: 0

[讨论] GPT中断问题,达人进来

[复制链接]
发表于 2010-12-20 10:30:56 | 显示全部楼层 |阅读模式
void gpt_timeout_cb(void *parameter)
{
        IRQ_GPT_MASK;
        GPTI_StopItem(Idra_handle);
         Timeoutcnt++;
        IRQ_GPT_UNMASK;       

         if(Timeoutcnt>3000)
         {
           Valid = 1;
          GPTI_StopItem(Gpt_handle);
          }
         else
        GPTI_StartItem(Gpt_handle,                  
                       1,
                       gpt_timeout_cb
                       NULL);         
}

void foo_func()
{
         Valid=0;

         CTIRQ_GPT_MaskAll(&val);    //mask all IRQ but GPT   
        GPTI_StartItem(Gpt_handle,                  
                       1,
                       gpt_timeout_cb
                       NULL);

        while(!Valid){
           //方案一[/COLOR]
            __asm
           {
                nop                                                       
           }
           //方案二[/COLOR]
            NOP_NOP();

        }

        CTIRQ_GPT_Restore(&val);
         
         Trace_log("foo_func end\r\n");
}

void NOP_NOP(void)
{
            __asm
           {
                nop                               
                nop                               
                nop       
                nop                               
                nop                                               
           }
}

代码如上,GPT每单位62.5us,大家看看上述方案一、二运行结果有何不同?
为什么?
高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-10-6 20:28 , Processed in 0.060369 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表