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

📄 71x_init.s

📁 STR7系列32位ARM控制器的固件库
💻 S
📖 第 1 页 / 共 4 页
字号:
				BSPI0_ADDR:		.long	BSPI0IRQHandler
				BSPI1_Addr:		.long	BSPI1IRQHandler
				I2C0_Addr:		.long	I2C0IRQHandler
				I2C1_Addr:		.long	I2C1IRQHandler
				CAN_Addr:		.long	CANIRQHandler
				ADC12_Addr:		.long	ADC12IRQHandler
				T1TIMI_Addr:	.long	T1TIMIIRQHandler
				T2TIMI_Addr:	.long	T2TIMIIRQHandler
				T3TIMI_Addr:	.long	T3TIMIIRQHandler
									.long	0				/* reserved */
									.long	0				/* reserved */
									.long	0				/* reserved */
				HDLC_Addr:		.long	HDLCIRQHandler
				USBLP_Addr:		.long	USBLPIRQHandler
									.long	0				/* reserved */
									.long	0				/* reserved */
				T0TOI_Addr:		.long	T0TOIIRQHandler
				T0OC1_Addr:		.long	T0OC1IRQHandler
				T0OC2_Addr:		.long	T0OC2IRQHandler
.text
/********************************************************************************
* Function Name  : UndefinedHandler
* Description    : This function called when undefined instruction
                   exception is entered.
* Input          : none
* Output         : none
*********************************************************************************/
UndefinedHandler:
        SaveContext R0,r12  	/* Save the workspace plus the current*/
								      /* return address LR_ und AND spsr_und.*/
        LDR		R0,=Undefined_Handler
        LDR		LR,=Undefined_Handler_end
        BX		R0             /* Branch to Undefined_Handler*/
Undefined_Handler_end:
        RestoreContext R0,r12  /* Return to the instruction following...*/
                               /* ...the undefined instruction.*/
/********************************************************************************
* Function Name  : SWIHandler
* Description    : This function called when SWI instruction executed.
* Input          : none
* Output         : none
********************************************************************************/
SWIHandler:
        SaveContext R0,r12    /* Save the workspace plus the current*/
                              /* return address LR_ svc AND spsr_svc.*/
        LDR		R0,=SWI_Handler
        LDR		LR,=SWI_Handler_end
        BX		R0             /* Branch to SWI_Handler*/
SWI_Handler_end:
        RestoreContext R0,r12 /* Return to the instruction following...*/
                              /* ...the SWI instruction.*/
/********************************************************************************
* Function Name  : IRQHandler
* Description    : This function called when IRQ exception is entered.
* Input          : none
* Output         : none
********************************************************************************/
IRQHandler:
        SUB    LR,LR,#4		       /* Update the link register*/
        SaveContext R0,r12        /* Save the workspace plus the current*/
                                  /* return address LR_ irq AND spsr_irq.*/
        LDR    LR, =ReturnAddress /* Read the return address.*/
        LDR    R0, =EIC_BASE
        LDR    r1, =IVR_OFFSET
        ADD    pc,R0,r1           /* Branch to the IRQ handler.*/
ReturnAddress:				          /* Clear pending bit in EIC (using the proper IPRx)*/
        LDR    R0, =EIC_BASE
        LDR    r2, [R0, #CICR_OFFSET] /* Get the IRQ channel number*/
        MOV    r3,#1
        MOV    r3,r3,LSL r2
        STR    r3,[R0, #IPR_OFFSET]   
							              /* Clear the corresponding IPR bit.*/
        RestoreContext R0,r12      /*  Restore the context AND return to the...*/
                                   /*  ...program execution. */						
/********************************************************************************
* Function Name  :PrefetchHandler
* Description    : This function called when Prefetch Abort
                   exception is entered.
* Input          : none
* Output         : none
*********************************************************************************/
PrefetchHandler:
        SUB		LR,LR,#4          /* Update the link register.*/
        SaveContext R0,r12       /* Save the workspace plus the current*/
                                 /* return address LR_abt AND spsr_abt.*/
        LDR		R0,=Prefetch_Handler
        LDR		LR,=Prefetch_Handler_end
        BX		R0                /* Branch to Prefetch_Handler.*/
Prefetch_Handler_end:
        RestoreContext R0,r12 /* Return to the instruction following that...*/
                              /* ...has generated the prefetch abort exception.*/						  
/********************************************************************************
* Function Name  : AbortHandler
* Description    : This function is called when Data Abort
                   exception is entered.
* Input          : none
* Output         : none
********************************************************************************/
AbortHandler:
        SUB		LR,LR,#8       /* Update the link register.*/
        SaveContext R0,r12    /* Save the workspace plus the current*/
                              /* return address LR_ abt AND spsr_abt.*/
        LDR		R0,=Abort_Handler
        LDR		LR,=Abort_Handler_end
        BX		R0             /* Branch to Abort_Handler.*/
Abort_Handler_end:
        RestoreContext R0,r12 /* Return to the instruction following that...*/
                              /* ...has generated the data abort exception.*/	
/*******************************************************************************
* Function Name  : FIQHandler
* Description    : This function is called when FIQ
*                      exception is entered.
* Input          : none
* Output         : none
*******************************************************************************/
FIQHandler:
		SUB		LR,LR,#4		/* Update the link register.*/
		STMFD	sp!,{R0-r7,LR}	/* Save The workSPace plus the current return*/
									/* address LR_fiq into the FIQ stack.*/
		LDR		R0,=FIQ_Handler
		LDR		LR,=FIQ_Handler_end
		BX		R0						/*Branch to FIQ_Handler.*/
FIQ_Handler_end:
		LDMFD	sp!,{R0-r7,PC}^	/* Return to the instruction following...*/
										/* the exception interrupt.*/

/********************************************************************************
* 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
        STMFD  sp!,{LR}
       .endm
/********************************************************************************
* 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!,{LR}       /* Restore the link register. */
        MSR    cpsr_c,#0xD2  /* Switch to IRQ mode.*/
        MOV    pc,LR         /* Return to IRQHandler routine to clear the*/
                             /* pending bit.*/
       .endm
/********************************************************************************
* Function Name  : T0TIMIIRQHandler
* Description    : This function used to switch to SYS mode before entering
                   the T0TIMI_IRQHandler function located in 71x_it.c.
                   Then to return to IRQ mode after the
                   T0TIMI_IRQHandler function termination.
* Input          : none.
* Output         : none.
********************************************************************************/
T0TIMIIRQHandler:
        IRQ_to_SYS
        LDR		R0,=T0TIMI_IRQHandler
        LDR		LR,=T0TIMI_IRQHandler_end
        BX		R0
T0TIMI_IRQHandler_end:
        SYS_to_IRQ	   
/********************************************************************************
* Function Name  : FLASHIRQHandler
* Description    : This function used to switch to SYS mode before entering
                   the FLASH_IRQHandler function located in 71x_it.c.
                   Then to return to IRQ mode after the
                   FLASH_IRQHandler function termination.
* Input          : none
* Output         : none
********************************************************************************/
FLASHIRQHandler:
        IRQ_to_SYS
        LDR		R0,=FLASH_IRQHandler
        LDR		LR,=FLASH_IRQHandler_end
        BX		R0
FLASH_IRQHandler_end:
        SYS_to_IRQ		
/********************************************************************************
* Function Name  : RCCUIRQHandler
* Description    : This function used to switch to SYS mode before entering
                   the RCCU_IRQHandler function located in 71x_it.c.
                   Then to return to IRQ mode after the
                   RCCU_IRQHandler function termination.
* Input          : none
* Output         : none
*******************************************************************************/
RCCUIRQHandler:
        IRQ_to_SYS
        LDR		R0,=RCCU_IRQHandler
        LDR		LR,=RCCU_IRQHandler_end
        BX		R0
RCCU_IRQHandler_end:
        SYS_to_IRQ
/********************************************************************************
* Function Name  : RTCIRQHandler
* Description    : This function used to switch to SYS mode before entering
                   the RTC_IRQHandler function located in 71x_it.c.
                   Then to return to IRQ mode after the
                   RTC_IRQHandler function termination.
* Input          : none
* Output         : none
*******************************************************************************/
RTCIRQHandler:
        IRQ_to_SYS
        LDR		R0,=RTC_IRQHandler
        LDR		LR,=RTC_IRQHandler_end
        BX		R0
RTC_IRQHandler_end:
        SYS_to_IRQ
/********************************************************************************
* Function Name  : WDGIRQHandler
* Description    : This function used to switch to SYS mode before entering
                   the WDG_IRQHandler function located in 71x_it.c.
                   Then to return to IRQ mode after the
                   WDG_IRQHandler function termination.
* Input          : none
* Output         : none
/********************************************************************************/
WDGIRQHandler:
        IRQ_to_SYS
        LDR		R0,=WDG_IRQHandler
        LDR		LR,=WDG_IRQHandler_end
        BX 		R0
WDG_IRQHandler_end:
        SYS_to_IRQ
/******************************************************************************** /
* Function Name  : XTIIRQHandler
* Description    : This function used to switch to SYS mode before entering
                   the XTI_IRQHandler function located in 71x_it.c.
                   Then to return to IRQ mode after the
                   XTI_IRQHandler function termination.
* Input          : none
* Output         : none 
**************************************************************************************/
XTIIRQHandler:
        IRQ_to_SYS
        LDR		R0,=XTI_IRQHandler
        LDR		LR,=XTI_IRQHandler_end
        BX		R0
XTI_IRQHandler_end:
        SYS_to_IRQ
/********************************************************************************
* Function Name  : USBHPIRQHandler
* Description    : This function used to switch to SYS mode before entering
                   the USBHP_IRQHandler function located in 71x_it.c.
                   Then to return to IRQ mode after the
                   USBHP_IRQHandler function termination.
* Input          : none
* Output         : none
*******************************************************************************/
USBHPIRQHandler:
        IRQ_to_SYS
        LDR		R0,=USBHP_IRQHandler
        LDR		LR,=USBHP_IRQHandler_end
        BX		R0
USBHP_IRQHandler_end:
        SYS_to_IRQ
/********************************************************************************
* Function Name  : I2C0ITERRIRQHandler
* Description    : This function used to switch to SYS mode before entering

⌨️ 快捷键说明

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