搜索
bottom↓
回复: 4

Nucleus Plus移植疑惑?

[复制链接]

出0入0汤圆

发表于 2010-5-25 09:36:00 | 显示全部楼层 |阅读模式
看了Nucleus Plus有些移植代码觉得很多是可以用C实现的,不知为什么它选择用ASM不解,不知是我理解错误还是什么?
比如:
;VOID  TMT_Set_Clock(UNSIGNED new_value)
;{
        EXPORT  TMT_Set_Clock
TMT_Set_Clock
;
;    /* Set the system clock to the specified value.  */
;    TMD_System_Clock =  new_value;
;
        LDR     a2,[pc, #System_Clock-.-8]  ; Build address of system clock
        STR     a1,[a2,#0]                  ; Store new system clock value

        [ THUMB
        BX      lr                               ; Return to caller
        |
        MOV     pc,lr                       ; Return to caller
        ]
;}

个人觉得这个函数完全可以用C实现如下:
VOID  TMT_Set_Clock(UNSIGNED new_value)
{
    OS_CPU_SR();

    OS_DISABLE_INT();

    /* Set the system clock to the specified value.  */
   TMD_System_Clock =  new_value;

   OS_RESTORE_INT();
}
我觉得TMT.S中的函数都可以这样实现
请高手们指点一下,能说下它为什么不用C来实现吗?

阿莫论坛20周年了!感谢大家的支持与爱护!!

你熬了10碗粥,别人一桶水倒进去,淘走90碗,剩下10碗给你,你看似没亏,其实你那10碗已经没有之前的裹腹了,人家的一桶水换90碗,继续卖。说白了,通货膨胀就是,你的钱是挣来的,他的钱是印来的,掺和在一起,你的钱就贬值了。

出0入0汤圆

 楼主| 发表于 2010-5-25 10:01:30 | 显示全部楼层
STATUS  TCT_Activate_HISR(TC_HCB *hisr)
{
    INT priority;   
    OS_CPU_SR();
    /* Lockout interrupts.  */
    OS_DISABLE_INT();   
    /* Determine if the HISR is already active.  */
    if (hisr -> tc_activation_count) {
        /* Increment the activation count.  Make sure that it does not go
           to zero.  */
        hisr -> tc_activation_count++;
        if (hisr -> tc_activation_count == 0) {
            hisr -> tc_activation_count =  0xFFFFFFFFUL;
        }
    }
    else {
        /* Set the activation count to 1.  */
        hisr -> tc_activation_count =  1;
        /* Pickup the HISR's priority.  */
        priority =  hisr -> tc_priority;
        /* Determine if there is something in the given priority list.  */
        if (TCD_Active_HISR_Tails[priority]) {
            /* Something is already on this list.  Add after the tail.  */
            (TCD_Active_HISR_Tails[priority]) -> tc_active_next =  hisr;
            TCD_Active_HISR_Tails[priority] =  hisr;
        }
        else {
           /* Nothing is on this list.  */
           TCD_Active_HISR_Heads[priority] =  hisr;
           TCD_Active_HISR_Tails[priority] =  hisr;           
           /* Determine the highest priority HISR.  */
           if (TCD_Active_HISR_Heads[0]) {
               TCD_Execute_HISR =  TCD_Active_HISR_Heads[0];
           }
           else if (TCD_Active_HISR_Heads[1]) {
               TCD_Execute_HISR =  TCD_Active_HISR_Heads[1];
           }
           else {
               TCD_Execute_HISR =  TCD_Active_HISR_Heads[2];
           }
        }
    }
    OS_RESTORE_INT();   
    return(NU_SUCCESS);
}

出0入0汤圆

 楼主| 发表于 2010-5-25 12:06:18 | 显示全部楼层
自己顶起来,大侠们哪去了?

出0入0汤圆

 楼主| 发表于 2010-5-26 13:11:31 | 显示全部楼层
等啊!!!

出0入0汤圆

发表于 2013-8-28 14:52:13 | 显示全部楼层
请问 这个问题解决吗
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-10-3 03:22

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

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