Cortex-M3 Core之指令

来源:互联网 发布:台湾海关数据 编辑:程序博客网 时间:2024/06/02 12:35

1. __DSB()指令:

Data Synchronization Barrier, This function acts as a special kind of Data Memory Barrier.  It completes when all explicit memory accesses before this instruction complete.

实例(Timer的时钟源频率低于MCU主频):

void TIMER0_IRQHandler(void)
{
     /* Clear interrupt source */
     timer->IFC = TIMER_IFC_OF;
     /* Flushing instructions to make sure that the interrupt is not re-triggered*/
     /* This may be required when the peripheral clock is slower than the core */
     __DSB(); //需要等待RAM访问完成,防止重复触发中断。

     /* Stopping timer */
     timer->CMD = TIMER_CMD_STOP;

}