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

📄 port2_isr.asm

📁 基于430单片机的UC_OS-II-280
💻 ASM
字号:
;********************************************************************************************************
;                                               uC/OS-II
;                                         The Real-Time Kernel
;
;                              (c) Copyright 2002, Micrium, Inc., Weston, FL
;                                          All Rights Reserved
;
;                                               TI MSP430
;
;
; File         : OS_PORT1_ISR.S43
; By           Written By Liu Yongfu
;               
;********************************************************************************************************

#include   <msp430x16x.h>

;********************************************************************************************************
;                                           MACRO DEFINITIONS
;********************************************************************************************************
        EXTERN PORT2_INT   
        PUBLIC PORT2_ISR  
	EXTERN OSIntNesting     //用来看是否来至中断
	EXTERN OSTCBCur        //当前任务控制块
	EXTERN OSISRStkPtr     //
	EXTERN OSIntExit      //脱离中断服务函数
	EXTERN OSTCBHighRdy


PUSHALL     MACRO
            push     r4
            push     r5
            push     r6
            push     r7
            push     r8
            push     r9
            push     r10
            push     r11
            push     r12
            push     r13
            push     r14
            push     r15         
            ENDM

POPALL      MACRO
            pop      r15
            pop      r14
            pop      r13
            pop      r12
            pop      r11
            pop      r10
            pop      r9
            pop      r8
            pop      r7
            pop      r6
            pop      r5
            pop      r4          
            ENDM
            
;********************************************************************************************************
;                                  PUBLIC AND EXTERNAL DECLARATIONS
;********************************************************************************************************       
 
              RSEG    CODE                      ; Program code
PORT2_ISR     
              PUSHALL
	      DINT	                        ; general interrupt is not allowed
              cmp.b 	#0, &OSIntNesting	;if (OSIntNesting == 0)
	      jne       PORT2_ISR_1 
              mov.w     &OSTCBCur, R13         ;     save task stackMOV [.W] 源操作数移至目的操作数
              mov.w     SP, 0(R13)
              mov.w     &OSISRStkPtr, SP       ;     load interrupt stack  
PORT2_ISR_1 
              inc.b     &OSIntNesting          ; increase OSIntNesting
              call      #PORT2_INT
              EINT                            ; enable general interrupt to allow for interrupt nesting
              call      #OSIntExit             ; call ticks routine脱离中断服务函数
              cmp.b    #0, &OSIntNesting      ; if (OSIntNesting == 0) 
              jne      PORT2_ISR_2
              mov.w    &OSTCBHighRdy, R13     ;     restore task stack SP
              mov.w    @R13, SP          
PORT2_ISR_2   
               POPALL      
               reti                            ; return from interrupt                                     
              
              
              COMMON    INTVEC
              ORG       PORT2_VECTOR  
PORT2_VEC     DW        PORT2_ISR
              END

⌨️ 快捷键说明

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