📄 vectors.s
字号:
#ifdef CYGSEM_HAL_COMMON_INTERRUPTS_ALLOW_NESTING # To allow nested interrupts, we set the IE bit. We do # not touch the IPL bits, so only higher priority interrupts # will be nested on top of us. Also, new interrupts will not # be delivered until the ISR calls # Cyg_Interrupt::acknowledge_interrupt(). At some future point # we may want to do the ack stuff here to allow immediate nesting. or 0x0800,psw #endif#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) # If we have Ctrl-C support enabled, save a pointer to the # saved CPU state here so we can plant a breakpoint there if # this is a ^C. .extern _hal_saved_interrupt_state mov a2,(_hal_saved_interrupt_state) #endif mov _hal_interrupt_handlers,a0 # a0 = isr table mov (d3,a0),a0 # a0 = isr mov _hal_interrupt_data,a1 # a1 = data table mov (d3,a1),d1 # d1 = isr data mov (0,a2),d0 # d0 = vector. (d3 is... # ...adjusted for table reads) add -16,sp # make space for return link calls (a0) # call isr # on return d0 bit 1 will indicate whether a DSR is # to be posted. Pass this together with a pointer to # the interrupt object we have just used to the # interrupt tidy up routine. # D3 is defined to be saved across procedure calls, and # should still contain the vector byte index. Similarly, # A2 should still point to the saved machine state.#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT # If interrupt was caused by GDB, the ISR call above # is skipped by jumping here.2:#endif#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK # If we are returning from the last nested interrupt, move back # to the thread stack. interrupt_end() must be called on the # thread stack since it potentially causes a context switch. add 16,sp # pop call frame from int stack movm (sp),[a3] # pop old sp mov a3,sp # put in SP add -16,sp # make call frame for call#endif #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT # We only need to call _interrupt_end() when there is a kernel # present to do any tidying up. # Using the vector offset in D3, get the interrupt object pointer # into D1. mov _hal_interrupt_objects,a0 # a0 = object table mov (d3,a0),d1 # d1 = object # Even when this is not the last nested interrupt, we must call # _interrupt_end() to post the DSR and decrement the scheduler # lock. mov a2,(12,sp) # arg3 = saved state. calls _interrupt_end # call interrupt end fn #endif add 16,sp # pop return link# show_interrupts hal_diag_restore hal_cpu_load_all add 4,sp rti # and return##-----------------------------------------------------------------------------## Execute pending DSRs on the interrupt stack with interrupts enabled.## Note: this can only be called from code running on a thread stack #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK .extern _cyg_interrupt_call_pending_DSRs .global _hal_interrupt_stack_call_pending_DSRs_hal_interrupt_stack_call_pending_DSRs: movm [d2,a2],(sp) # save some work regs mov __interrupt_stack,a0 # interrupt stack pointer mov sp,a2 # save current SP mov a0,sp # set SP to interrupt stack hal_cpu_get_psw d2 # save PSW hal_cpu_int_enable # enable interrupts # Call kernel code to invoke DSRs. calls _cyg_interrupt_call_pending_DSRs # On return the old SP in a2 and the old PSW in d2 will # have been preserved by the calling conventions. hal_cpu_int_merge d2 # Restore previous PSW mov a2,sp # restore old SP movm (sp),[d2,a2] # Retrieve old work regs ret [],0 # and return #endif ##-----------------------------------------------------------------------------## Default NMI VSR .globl _cyg_hal_exception_handler .text .globl __default_nmi_vsr__default_nmi_vsr: # We come here with all the registers saved # on the stack. hal_diag_excpt_start # Decode the cause of the NMI and cancel all the bits in all # the registers. We need to clear any bits set in the ISR and # then clear any bits set in the NMICR. Note that we can only # access the ISR if the DCR:DE bit is set. movhu (NMICR),d0 # D0 = NMI Control register movhu (DCR),d1 # D1 = Debug Control Register mov d1,d2 # D2 = copy of DCR movhu (ISR),d3 # D3 = Interrupt Status Register or DCR_DE,d1 # Set DE bit movhu d1,(DCR) movhu d3,(ISR) # clear ISR bits movhu d2,(DCR) # restore DCR to original value movhu d0,(NMICR) # clear NMI bits and 0x7,d0 # LS 3 bits only mov hal_lsbit_table,a0 movbu (d0,a0),d1 # D1 = NMI code ## 0 = NMI ## 1 = Watchdog ## 2 = System Error add 9,d1 # offset into exception number space hal_cpu_clear_nmid mov sp,a1 # a1 = saved state mov a1,d0 # d0 = arg1 = saved state add -16,sp # return link + args mov d1,(16,sp) # save initial vector in spare save slot mov d3,d1 # d1 = arg2 = ISR value calls _cyg_hal_exception_handler # call C code add 16,sp # pop args hal_cpu_load_all add 4,sp rti .globl hal_lsbit_tablehal_lsbit_table: .byte 0, 0, 1, 0 .byte 2, 0, 1, 0 .byte 3, 0, 1, 0 .byte 2, 0, 1, 0 ##-----------------------------------------------------------------------------## Default TRAP VSR .text .globl __default_trap_vsr__default_trap_vsr: # We come here with all the registers saved # on the stack. add -8,sp # return link + arg mov 3,d1 # 3 == TRAP trap mov d1,(0,sp) # save in spare save slot calls _cyg_hal_exception_handler # call C code add 8,sp # pop args hal_cpu_load_all add 4,sp rets##-----------------------------------------------------------------------------## VSR table. The VSRs pointed to by this table are called from the stubs## connected to the hardware.#ifndef CYG_HAL_MN10300_VSR_TABLE_DEFINED .data .globl _hal_vsr_table_hal_vsr_table: .long __default_interrupt_vsr .long __default_interrupt_vsr .long __default_interrupt_vsr .long __default_interrupt_vsr .long __default_interrupt_vsr .long __default_interrupt_vsr .long __default_interrupt_vsr .long __default_nmi_vsr .long __default_trap_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr .long __default_nmi_vsr#endif ##-----------------------------------------------------------------------------## Interrupt tables .data .extern _hal_default_isr .globl _hal_interrupt_handlers_hal_interrupt_handlers: .rept CYG_ISR_TABLE_SIZE .long _hal_default_isr .endr .globl _hal_interrupt_data_hal_interrupt_data: .rept CYG_ISR_TABLE_SIZE .long 0 .endr .globl _hal_interrupt_objects_hal_interrupt_objects: .rept CYG_ISR_TABLE_SIZE .long 0 .endr ##-----------------------------------------------------------------------------## Temporary interrupt stack .section ".bss" .balign 16 .global _cyg_interrupt_stack_base_cyg_interrupt_stack_base:__interrupt_stack_base: .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE .byte 0 .endr .balign 16 .global _cyg_interrupt_stack_cyg_interrupt_stack:__interrupt_stack: .long 0,0,0,0,0,0,0,0 ##----------------------------------------------------------------------------- .data hal_diag_data##-----------------------------------------------------------------------------## end of vectors.S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -