|
看了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碗,继续卖。说白了,通货膨胀就是,你的钱是挣来的,他的钱是印来的,掺和在一起,你的钱就贬值了。
|