码迷,mamicode.com
首页 > 其他好文 > 详细

关闭中断

时间:2018-01-23 18:20:30      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:int   bic   关闭   back   lob   dog   ref   详细   cps   

看芯片官方手册

找到中断这一章节

里面有详细的如何屏蔽中断

下面给出210的代码

.text
.global _start
_start:
    b reset
    ldr pc, _undefined_instruction
    ldr pc, _software_interrupt
    ldr pc, _prefetch_abort
    ldr pc, _data_abort
    ldr pc, _not_used
    ldr pc, _irq
    ldr pc, _fiq

_undefined_instruction: .word undefined_instruction
_software_interrupt:.word software_interrupt
_prefetch_abort:.word prefetch_abort
_data_abort:.word data_abort
_not_used:.word not_used
_irq:.word irq
_fiq:.word fiq

undefined_instruction:
    nop
    
software_interrupt:
    nop

prefetch_abort:
    nop
    
data_abort:
    nop
    
not_used:
    nop
    
irq:
    nop
    
fiq:
    nop

reset:
    bl set_svc
    bl disable_watchdog    
    bl diasble_interrupt
    
set_svc:
    mrs r0, cpsr
    bic r0, r0, #0x1f
    orr r0, r0, #0xd3
    msr cpsr, r0

#define pwTCON 0x53000000
disable_watchdog:
    ldr r0, =pwTCON
    mov r1, #0x0
    str r1, [r0]

disable_interrupt
    mvn r1, #0x0
    ldr r0, =0xf2000014
    str r1, [r0]

    ldr r0, =0xf2100014
    str r1, [r0]    

    ldr r0, =0xf2200014
    str r1, [r0]    

    ldr r0, =0xf2300014
    str r1, [r0]

2440

.text
.global _start
_start:
    b reset
    ldr pc, _undefined_instruction
    ldr pc, _software_interrupt
    ldr pc, _prefetch_abort
    ldr pc, _data_abort
    ldr pc, _not_used
    ldr pc, _irq
    ldr pc, _fiq

_undefined_instruction: .word undefined_instruction
_software_interrupt:.word software_interrupt
_prefetch_abort:.word prefetch_abort
_data_abort:.word data_abort
_not_used:.word not_used
_irq:.word irq
_fiq:.word fiq

undefined_instruction:
    nop
    
software_interrupt:
    nop

prefetch_abort:
    nop
    
data_abort:
    nop
    
not_used:
    nop
    
irq:
    nop
    
fiq:
    nop

reset:
    bl set_svc
    bl disable_watchdog    
    bl diasble_interrupt
    
set_svc:
    mrs r0, cpsr
    bic r0, r0, #0x1f
    orr r0, r0, #0xd3
    msr cpsr, r0

#define pwTCON 0x53000000
disable_watchdog:
    ldr r0, =pwTCON
    mov r1, #0x0
    str r1, [r0]

disable_interrupt
    mvn r1, #0x0
    ldr r0, =0x4a000008
    str r1,[r0]    

6410

.text
.global _start
_start:
    b reset
    ldr pc, _undefined_instruction
    ldr pc, _software_interrupt
    ldr pc, _prefetch_abort
    ldr pc, _data_abort
    ldr pc, _not_used
    ldr pc, _irq
    ldr pc, _fiq

_undefined_instruction: .word undefined_instruction
_software_interrupt:.word software_interrupt
_prefetch_abort:.word prefetch_abort
_data_abort:.word data_abort
_not_used:.word not_used
_irq:.word irq
_fiq:.word fiq

undefined_instruction:
    nop
    
software_interrupt:
    nop

prefetch_abort:
    nop
    
data_abort:
    nop
    
not_used:
    nop
    
irq:
    nop
    
fiq:
    nop

reset:
    bl set_svc
    bl disable_watchdog    
    bl diasble_interrupt
    
set_svc:
    mrs r0, cpsr
    bic r0, r0, #0x1f
    orr r0, r0, #0xd3
    msr cpsr, r0

#define pwTCON 0x53000000
disable_watchdog:
    ldr r0, =pwTCON
    mov r1, #0x0
    str r1, [r0]

disable_interrupt
    mvn r1, #0x0
    ldr r0, =0x71200014
    str r1, [r0]
    ldr r0, =0x71300014
    str r1, [r0]    

 

三者主要的不同就在屏蔽中断的代码不一样,2440只有一个寄存器管理中断的清除,6410有两个寄存器管理中断的清除,210有4个寄存器管理中断的清除。

关闭中断

标签:int   bic   关闭   back   lob   dog   ref   详细   cps   

原文地址:https://www.cnblogs.com/sanshijvshi/p/8336967.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!