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

📄 isr_stub.s

📁 摩托罗拉 ColdFire 5206E 在UCOSII上的移植代码
💻 S
字号:
;************************************************************************************************
;                                
;                   (c) Copyright 2002, Northern Computers, Inc. 
;                                 All Rights Reserved
;  
; File        : isr_stub.s
; By          : Paul S. Carpenter
;               paul.carpenter@nciaccess.com
;               4/26/2002
;************************************************************************************************


;*************************************************************************************************
;                                   PUBLIC DECLARATIONS
;*************************************************************************************************


	    .global _genericISRstub


;**************************************************************************************************
;                                EXTERNAL DECLARATIONS
;**************************************************************************************************

		.extern _OSIntNesting
		.extern _OSTCBCur
		.extern _isrGeneric
		.extern _OSIntExitCF
		.extern _OSIntEnter
		.extern _OSIntExit

  	.text

	.align   4


;********************************************************************************
;                               GENERIC ISR stub
;
; Description : This function is the ISR used to handle whatever you'd like.  
;
; Arguments   : none
;
; Notes       : 1) You MUST increment 'OSIntNesting' and NOT call OSIntEnter().
;               2) You MUST save ALL the CPU registers as shown below.
;               3) You can EITHER jump (JMP) to OSIntExitCF() OR jump to subroutine
;                  (JSR) OSIntExit. The assembly language is slightly faster, but otherwise
;                  testing has not revealed problems with either method.
;
;  Procedure : uartISR					    
;								    
;  The procedure is installed as the generic ISR and called   
;  each time "something" happens, defined by user code!  This should be used for
;  user-defined ISR's since it handles the RTOS context switching interface.
;
;**********************************************************************/
_genericISRstub:
  move.w   #0x2700,sr 		; disable ALL irqs!!! MUST BE DONE !!!
  							; note that SR is saved on the stack by exception procesing 

  LEA      -60(A7),A7         ; Save processor registers onto stack
  MOVEM.L  D0-D7/A0-A6,(A7)
  
  MOVEQ.L  #0,D0              ; This use of D0 is absolutely necessary when
  MOVE.B   (_OSIntNesting),D0 ; using an optimizing compiler. Since ColdFire
  ADDQ.L   #1,D0              ; can only add Long, whereas OSIntNesting is defined
  MOVE.B   D0,(_OSIntNesting) ; as INT8U in C code.

  cmpi.l   #1, d0		      ; if OSIntNesting == 1, then continue
  bne 	   _NoInc 
  MOVE.L   (_OSTCBCur), A1    ; Save stack pointer onto current task's stack
  MOVE.L   A7,(A1)
 
 _NoInc:

   jsr _isrGeneric			  ; perform ISR processing

  JMP      _OSIntExitCF       ; language, either method seems to work
  

⌨️ 快捷键说明

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