LPC23XX---VIC_Control.s疑问?不清楚怎么设置的VICVectAddr{n}的值
软件系统ucosii 开发环境ads1.2 系统在OSStart();进入优先级最高的任务,该任务首先做的是TargetInit();TargetInit(); //ARM初始化 该函数里面有个子函数VICInit(); 子函数VICInit就是设置IRQ中断,外设中断优先级,使能外设中断等作用
void VICInit(void)
{
SetVICIRQ(4,0,(uint32)Timer0_Exception);
}
__inline uint32 SetVICIRQ(uint32 channel,uint32 PRI,uint32 ISRFuction)
{
return(OsSwiHandle1(0x100,channel,PRI,ISRFuction));
}
经过VICInit()---> __inline uint32 SetVICIRQ(uint32 channel,uint32 PRI,uint32 ISRFuction)--->(OsSwiHandle1(0x100,channel,PRI,ISRFuction))
R0=0x100,R1=4,R2=0;R3=Timer0_Exception;
最后将R0=R0-0x100进入了VIC_Control.s文件中
NoInt EQU 0x80
NoFIQ EQU 0x40
SVC32Mode EQU 0x13
SYS32Mode EQU 0x1f
VICVectAddr0EQU 0xfffff100
VICVectAddr EQU 0xffffff00
VICIntEnClr EQU 0xfffff014
VICIntSelectEQU 0xfffff00c
VICProtection EQU 0xFFFFF020
VICVectPri0 EQU 0xfffff200
VICIntEnableEQU 0xfffff010
IMPORTStackUsr
EXPORTRunFirst
EXPORTVICControl
CODE32
AREA |RUNFIRST|, CODE, READONLY
RunFirst
;---------------------------------------
;初始化VIC
;Initial VIC And Enable VIC Be Protected;
LDR R2, =VICIntEnClr
MVN R3, #0x00
STR R3,
LDR R2, =VICIntSelect
MOV R3, #0x00
STR R3,
LDR R0, =VICVectAddr0
MOV R1, #0
MOV R2, #0
MOV R3, #0
MOV R4, #0
MOV R5, #0
MOV R6, #0
MOV R7, #0
MOV R8, #0
STMIA R0!, {R1-R8}
STMIA R0!, {R1-R8}
STMIA R0!, {R1-R8}
STMIA R0!, {R1-R8}
LDR R0, =VICVectPri0
STMIA R0!, {R1-R8}
STMIA R0!, {R1-R8}
STMIA R0!, {R1-R8}
STMIA R0!, {R1-R8}
LDR R2, =VICVectAddr
STR R3,
LDR R2, =VICProtection
MOV R3, #0x01
STR R3,
; MOV PC, LR
BX LR
;-----------------------------------------------
VICControl
SUB R0, R0, #0x100
CMP R0, #7
LDRLO PC,
MOVS PC, LR
SwiFunctionAdd
DCD SetVICIRQFunction ;0
DCD FreeVICIRQFunction ;1
DCD ReEnableIRQ ;2
DCD DisableIRQ ;3
DCD GetIRQStatus ;4
DCD EnableVICFIQ ;5
DCD DisableVICFIQ ;6
EnableVICFIQ
MSR CPSR_c, #(NoFIQ :or: NoInt:or: SVC32Mode)
CMP R1, #32 ;if (通道号 >=32) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
LDR R0, =VICVectAddr0 ;if (IRQ已加载) return FALSE;
LDR R3,
CMP R3,#0
MOVNE R0, #0
MOVNESPC, LR
LDR R0, =VICIntSelect
LDR R3,
MOV R2, #1
MOV R2, R2, lsl R1
ORR R3, R3, R2
STR R3,
LDR R0, =VICIntEnable
STR R3,
MOV R0, #1
MOVS PC, LR
DisableVICFIQ
MSR CPSR_c, #(NoFIQ :or: NoInt:or:SVC32Mode)
CMP R1, #32 ;if (通道号 >=32) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
LDR R0, =VICIntSelect ;if(FIQ未使能)return FALSE
LDR R3,
MOV R2, #1
MOV R2, R2, LSL R1
ANDS R2, R3, R2
MOVEQ R0, #0
MOVEQSPC, LR
LDR R0, =VICIntEnClr
MOV R3, R2
STR R3, ;Disable FIQ
LDR R0, =VICIntSelect
LDR R3,
BIC R3, R3,R2
STR R3,
MOV R0, #1
MOVS PC, LR
ReEnableIRQ
CMP R1, #32 ;if (通道号 >=32) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
LDR R0, =VICVectAddr0 ;if (未加载) return FALSE;
LDR R3,
CMP R3, #0
MOVEQ R0, #0
MOVEQSPC, LR
LDR R0, =VICIntEnable
MOV R2, #1
MOV R3, R2, lsl R1
STR R3,
MOV R0, #1
MOVS PC, LR
DisableIRQ
CMP R1, #32 ;if (通道号 >=32) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
LDR R0, =VICVectAddr0 ;if (未加载) return FALSE;
LDR R3,
CMP R3, #0
MOVEQ R0, #0
MOVEQSPC, LR
LDR R0, =VICIntEnClr
MOV R2, #1
MOV R3, R2, lsl R1
STR R3,
MOV R0, #1
MOVS PC, LR
FreeVICIRQFunction
CMP R1, #32 ;if (通道号 >=32) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
LDR R0, =VICIntSelect ;if (FIQ) return FALSE;
MOV R3, #1
MOV R3, R3, LSL R1
LDR R2,
ANDS R2, R2, R3
MOVNE R0, #0
MOVNESPC, LR
LDR R0, =VICVectAddr0 ;if (IRQ was not Set) return FALSE;
LDR R2,
CMP R2,#0
MOVEQ R0, #0
MOVEQSPC, LR
LDR R0, =VICIntEnClr ;Disable IRQ
STR R3,
LDR R0, =VICVectAddr0 ;Clear VICVectAddr0
MOV R3, #0
STR R3,
MOV R0, #1
MOVS PC, LR
GetIRQStatus
CMP R1, #32 ;if (通道号 >=32) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
LDR R0, =VICVectAddr0 ;if (未加载) return FALSE;
LDR R3,
CMP R3, #0
MOVEQ R0, #0
MOVEQSPC, LR
STMIA R2!, {R1} ;通道号
LDR R0, =VICVectPri0
LDR R0,
STMIA R2!, {R0} ;优先级
STMIA R2!, {R3} ;处理函数地址
LDR R0, =VICIntEnable
MOV R3, #1
MOV R1, R3, lsl R1
LDR R3,
AND R3, R3, R1
CMP R3, #0
MOVHI R3, #1
STMIA R2!,{R3} ;IRQ使能与否的状态
MOV R0, #1
MOVS PC, LR
SetVICIRQFunction
CMP R1, #32 ;if (通道号 >=32) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
CMP R2, #16 ;if (优先级 >=16) return FALSE;
MOVCS R0, #0
MOVCSSPC, LR
CMP R3, #0 ;if (处理函数 ==0) return FALSE;
MOVEQ R0, #0
MOVEQSPC, LR
MSR CPSR_c, #(NoFIQ :or: NoInt :or: SYS32Mode)
STMFD SP!, {R2, R3}
MOV R2, #1 ;if (Enable) return FALSE;
MOV R3, R2, lsl R1
LDR R0, =VICIntEnable
LDR R2,
ANDS R2, R2, R3
BNE SetVICIRQFunction_j
LDR R0, =VICVectAddr0 ;if (IRQ已经使能) return FALSE;
LDR R3,
CMP R3, #0
SetVICIRQFunction_j
LDMFD SP!, {R2, R3}
MSR CPSR_c, #(NoFIQ :or: NoInt :or: SVC32Mode)
MOVNE R0, #0
MOVNESPC, LR
STR R3,
LDR R0, =VICVectPri0
STR R2,
LDR R0, =VICIntEnable
MOV R2, #1
MOV R3, R2, lsl R1
STR R3,
MOV R0, #1
MOVS PC, LR
END
我想问下 1. ANDS R2, R2, R3
BNE SetVICIRQFunction_j 这两句话的意思?
2.Timer0_Exception定时器0中断函数的服务地址,该地址是怎么赋值给VICVectAddr{n}的?
页:
[1]