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

📄 swi_handler.s

📁 基于FREERtos和LPC2468的程序。里面实现了串口通信
💻 S
字号:
@/*****************************************************************************
@*   swi_handler.s: SWI handler file for NXP LPC230x Family Microprocessors
@*
@*   Copyright(C) 2006, NXP Semiconductor
@*   All rights reserved.
@*
@*   History
@*   2006.09.01  ver 1.00    Prelimnary version, first Release
@*
@*****************************************************************************/

@ modified by Martin Thomas (There is some kind of deja vu
@ in the "original" NXP code...)
@ I did not test this so far. I should work but only
@ when asserting an SWI from ARM-code

// PRESERVE8

.equ SWI_IRQ_DIS,  0
.equ SWI_IRQ_EN,   1
.equ SWI_FIQ_DIS,  2
.equ SWI_FIQ_EN,   3

.equ I_Bit,        0x80
.equ F_Bit,        0x40

@The exported labels and functions
	.global SoftwareInterrupt    
	.global IntEnable
	.global IntDisable

.arm
.section .SWI_HANDLER, "ax"

@********************************************************************
@*  SWI interrupt handler											*
@*  Function : SoftwareInterrupt(SWI_Number)						*
@*  The SWI_Number is 0 through 3									*
@*  See below "SwiFunction" table below								*
@*  Parameters:    None												*
@*  input  :       SWI_Number										* 
@*  output :       None												*
@********************************************************************
SoftwareInterrupt:
	CMP		R0, #4
	LDRLO	PC, [PC, R0, LSL #2]
	MOVS	PC, LR
	
SwiFunction:
.word IRQDisable
.word IRQEnable
.word FIQDisable
.word FIQEnable

IRQDisable:
	MRS		R0, SPSR
	ORR		R0, R0, #I_Bit
	MSR		SPSR_c, R0
	MOVS	PC, LR

IRQEnable:
	MRS		R0, SPSR
	BIC		R0, R0, #I_Bit
	MSR		SPSR_c, R0
	MOVS	PC, LR

FIQDisable:
	MRS		R0, SPSR
	ORR		R0, R0, #F_Bit
	MSR		SPSR_c, R0
	MOVS	PC, LR

FIQEnable:
	MRS		R0, SPSR
	BIC		R0, R0, #F_Bit
	MSR		SPSR_c, R0
	MOVS	PC, LR

@**********************************************************************
@*  Call SWI to enable IRQ                                            *
@*  Function : void IntEnable(void)                                   *
@*  Parameters:      None                                             *
@*  input  :         None                                             * 
@*  output :         None                                             *
@**********************************************************************
IntEnable:
	SWI     SWI_IRQ_EN
	BX      lr
@ end of IntEnable

@**********************************************************************
@*  Call SWI to disable IRQ                                           *
@*  Function : void IntDisable(void)  void IntEnable(void)                                *
@*  Parameters     : None                                             *
@*  input          : None                                             * 
@*  output         : None                                             *
@**********************************************************************
IntDisable:
	SWI     SWI_IRQ_DIS
	BX      lr
@ end of IntDisable

.end
@/*************************************************************************
@**                            End Of File
@**************************************************************************/

⌨️ 快捷键说明

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