⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 str73x_vect.s

📁 基于STR730的WUT程序
💻 S
📖 第 1 页 / 共 4 页
字号:
;******************** (C) COPYRIGHT 2005 STMicroelectronics ********************
;* File Name          : 73x_vect.s
;* Author             : MCD Application Team
;* Date First Issued  : 09/27/2005 :  V1.0
;* Description        : This File used to initialize the exception and IRQ
;*                      vectors, and to enter/return to/from exceptions handlers.
;*********************************************************************************
; History:
; 09/27/2005 :  V1.0
;*********************************************************************************
; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
; CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
; OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
; OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
; CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
;********************************************************************************/
        AREA Undef, CODE, READONLY 
        ARM

        PRESERVE8
        ALIGN
        IMPORT  Undefined_Handler
        EXPORT  UndefHandler

UndefHandler
        STMFD   SP!, {R0-R12, LR}       ; Save Workspace & LR to Stack
        MRS     R0, SPSR                ; Copy SPSR to R0
        STMFD   SP!, {R0, R1}           ; Save SPSR to Stack (8-byte)
        BL      Undefined_Handler       ; Branch to Undefined Handler
        LDMFD   SP!, {R0, R1}           ; Restore SPSR to R0
        MSR     SPSR_cxsf, R0           ; Restore SPSR
        LDMFD   SP!, {R0-R12, PC}^      ; Return to program after
                                        ; Undefined Instruction         

        END

        AREA SWI, CODE, READONLY 
        ARM

        PRESERVE8
        ALIGN
        IMPORT  SWI_Handler
        EXPORT  SWIHandler

SWIHandler
        STMFD   SP!, {R0-R12, LR}       ; Save Workspace & LR to Stack
        MRS     R0, SPSR                ; Copy SPSR to R0
        STMFD   SP!, {R0, R1}           ; Save SPSR to Stack (8-byte)
        BL      SWI_Handler             ; Branch to SWI Handler
        LDMFD   SP!, {R0, R1}           ; Restore SPSR to R0
        MSR     SPSR_cxsf, R0           ; Restore SPSR
        LDMFD   SP!, {R0-R12, PC}^      ; Return to program after
                                        ; SWI Instruction

        END

        AREA PAbt, CODE, READONLY 
        ARM

        PRESERVE8
        ALIGN
        IMPORT  Prefetch_Handler
        EXPORT  PAbtHandler

PAbtHandler
        SUB     LR, LR, #4              ; Update Link Register
        STMFD   SP!, {R0-R12, LR}       ; Save Workspace & LR to Stack
        MRS     R0, SPSR                ; Copy SPSR to R0
        STMFD   SP!, {R0, R1}           ; Save SPSR to Stack (8-byte)
        BL      Prefetch_Handler        ; Branch to Prefetch Abort Handler
        LDMFD   SP!, {R0, R1}           ; Restore SPSR to R0
        MSR     SPSR_cxsf, R0           ; Restore SPSR
        LDMFD   SP!, {R0-R12, PC}^      ; Return to program after
                                        ; Prefetch Abort Instruction

        END

        AREA DAbt, CODE, READONLY 
        ARM

        PRESERVE8
        ALIGN
        IMPORT  Abort_Handler
        EXPORT  DAbtHandler

DAbtHandler
        SUB     LR, LR, #8              ; Update Link Register
        STMFD   SP!, {R0-R12, LR}       ; Save Workspace & LR to Stack
        MRS     R0, SPSR                ; Copy SPSR to R0
        STMFD   SP!, {R0, R1}           ; Save SPSR to Stack (8-byte)
        BL      Abort_Handler           ; Branch to Data Abort Handler
        LDMFD   SP!, {R0, R1}           ; Restore SPSR to R0
        MSR     SPSR_cxsf, R0           ; Restore SPSR
        LDMFD   SP!, {R0-R12, PC}^      ; Return to program after
                                        ; Data Abort Instruction

        END


	

; Enhanced Interrupt Controller (EIC) definitions
IMPORT EIC_BASE            ; EIC Base Address
IMPORT	CICR_OFS          ; Curr. Int. Channel R. Offset
IMPORT	IVR_OFS            ; Interrupt Vector Reg. Offset
IIMPORT		PR0_OFS          ; Interrupt Pending Reg. 0 Offset
IMPORT	IPR1_OFS            ; Interrupt Pending Reg. 1 Offset


        AREA IRQ, CODE, READONLY 
        ARM

        PRESERVE8
        ALIGN
        EXPORT  IRQHandler

IRQHandler
        SUB     LR, LR, #4              ; Update Link Register
        STMFD   SP!, {R0-R12, LR}       ; Save Workspace & LR to Stack
        MRS     R0, SPSR                ; Copy SPSR to R0
        STMFD   SP!, {R0, R1}           ; Save SPSR to Stack (8-byte)
        LDR     LR, =ReturnAddress      ; Read Return Address
        LDR     R0, =EIC_BASE
        LDR     R1, =IVR_OFS
        ADD     PC, R0, R1              ; Branch to IRQ Handler
ReturnAddress
        ; Clear pending bit in EIC (using the proper IPRx)
        LDR     R0, =EIC_BASE
        LDR     R2, [R0, #CICR_OFS]     ; Get the IRQ Channel Number
        CMP     R2, #31
        SUBHI   R2, R2, #32
        MOV     R3, #1
        MOV     R3, R3, LSL R2
        STRLS   R3, [R0, #IPR0_OFS]     ; Clear corresponding IPR0 bit
        STRHI   R3, [R0, #IPR1_OFS]     ; Clear corresponding IPR1 bit
        LDMFD   SP!, {R0, R1}           ; Restore SPSR to R0
        MSR     SPSR_cxsf, R0           ; Restore SPSR
        LDMFD   SP!, {R0-R12, PC}^      ; Return to program
         

;*******************************************************************************
;                   Import IRQ handlers from 73x_it.c
;*******************************************************************************

        IMPORT PRCCUCMU_IRQHandler
        IMPORT EXTIT01_IRQHandler
        IMPORT EXTIT02_IRQHandler
        IMPORT EXTIT03_IRQHandler
        IMPORT EXTIT04_IRQHandler
        IMPORT EXTIT05_IRQHandler
        IMPORT EXTIT06_IRQHandler
        IMPORT EXTIT07_IRQHandler
        IMPORT EXTIT08_IRQHandler
        IMPORT EXTIT09_IRQHandler
        IMPORT EXTIT10_IRQHandler
        IMPORT EXTIT11_IRQHandler
        IMPORT EXTIT12_IRQHandler
        IMPORT EXTIT13_IRQHandler
        IMPORT EXTIT14_IRQHandler
        IMPORT EXTIT15_IRQHandler
        IMPORT DMATRERR_IRQHandler
        IMPORT TIM1_IRQHandler
        IMPORT TIM2_IRQHandler
        IMPORT TIM3_IRQHandler
        IMPORT TIM4_IRQHandler
        IMPORT TB0_IRQHandler
        IMPORT TB1_IRQHandler
        IMPORT TB2_IRQHandler
        IMPORT TIM5_IRQHandler
        IMPORT TIM6_IRQHandler
        IMPORT TIM7_IRQHandler
        IMPORT TIM8_IRQHandler
        IMPORT TIM9_IRQHandler
        IMPORT UART2_IRQHandler
        IMPORT UART3_IRQHandler
        IMPORT FLASHEOP_IRQHandler
        IMPORT PWM0_IRQHandler
        IMPORT PWM1_IRQHandler
        IMPORT PWM2_IRQHandler
        IMPORT PWM3_IRQHandler
        IMPORT PWM4_IRQHandler
        IMPORT PWM5_IRQHandler
        IMPORT WIU_IRQHandler
        IMPORT WDGWUT_IRQHandler
        IMPORT BSPI0_IRQHandler
        IMPORT BSPI1_IRQHandler
        IMPORT BSPI2_IRQHandler
        IMPORT UART0_IRQHandler
        IMPORT UART1_IRQHandler
        IMPORT I2C0ITERR_IRQHandler
        IMPORT I2C1ITERR_IRQHandler
        IMPORT I2C0ITDDC_IRQHandler
        IMPORT I2C1ITDDC_IRQHandler
        IMPORT CAN0_IRQHandler
        IMPORT CAN1_IRQHandler
        IMPORT CAN2_IRQHandler
        IMPORT DMA0_IRQHandler
        IMPORT DMA1_IRQHandler
        IMPORT DMA2_IRQHandler
        IMPORT DMA3_IRQHandler
        IMPORT ADC_IRQHandler
        IMPORT RTC_IRQHandler


;*******************************************************************************
;* Macro Name     : IRQ_to_SYS
;* Description    : This macro used to switch form IRQ mode to SYS mode
;* Input          : none.
;* Output         : none
;*******************************************************************************
        MACRO
                IRQ_to_SYS
                MSR     CPSR_c, #0x1F   ; Switch to SYS Mode
                STMFD   SP!, {R0,LR}    ; Save Link Register (8-byte Stack)
        MEND
;*******************************************************************************
;* Macro Name     : SYS_to_IRQ
;* Description    : This macro used to switch from SYS mode to IRQ mode
;                   then to return to IRQHnadler routine.
;* Input          : none.
;* Output         : none.
;*******************************************************************************
        MACRO
                SYS_to_IRQ
                LDMFD   SP!, {R0,LR}    ; Restore Link Register (8-byte Stack)
                MSR     CPSR_c, #0xD2   ; Switch to IRQ Mode
                BX      LR              ; Return to IRQHandler routine to
                                        ; clear the pending bit
        MEND
;*******************************************************************************


;*******************************************************************************
;* Function Name  : PRCCUCMUIRQHandler
;* Description    : This function used to switch to SYS mode before entering
;                   the PRCCUCMUIRQHandler function located in 73x_it.c.
;                   Then to return to IRQ mode after the
;                   PRCCUCMUIRQHandler function termination.
;* Input          : none
;* Output         : none
;*******************************************************************************
        EXPORT PRCCUCMUIRQHandler 
PRCCUCMUIRQHandler
        IRQ_to_SYS
        BL     PRCCUCMU_IRQHandler
        SYS_to_IRQ

;*******************************************************************************
;* Function Name  : EXTIT01IRQHandler
;* Description    : This function used to switch to SYS mode before entering
;                   the EXTIT01IRQHandler function located in 73x_it.c.
;                   Then to return to IRQ mode after the
;                   EXTIT01IRQHandler function termination.
;* Input          : none
;* Output         : none
;*******************************************************************************
        EXPORT EXTIT01IRQHandler 
EXTIT01IRQHandler
        IRQ_to_SYS
        BL     EXTIT01_IRQHandler
        SYS_to_IRQ

;*******************************************************************************
;* Function Name  : EXTIT02IRQHandler
;* Description    : This function used to switch to SYS mode before entering
;                   the EXTIT02IRQHandler function located in 73x_it.c.
;                   Then to return to IRQ mode after the
;                   EXTIT02IRQHandler function termination.
;* Input          : none
;* Output         : none
;*******************************************************************************
        EXPORT EXTIT02IRQHandler 
EXTIT02IRQHandler
        IRQ_to_SYS
        BL     EXTIT02_IRQHandler
        SYS_to_IRQ

;*******************************************************************************
;* Function Name  : EXTIT03IRQHandler
;* Description    : This function used to switch to SYS mode before entering
;                   the EXTIT03IRQHandler function located in 73x_it.c.
;                   Then to return to IRQ mode after the
;                   EXTIT03IRQHandler function termination.
;* Input          : none
;* Output         : none

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -