os_viewa.s

来自「移植到freescale 9s12系列单片机的uCOSII」· S 代码 · 共 87 行

S
87
字号
;********************************************************************************************************
;                                               uC/OS-II
;                                         The Real-Time Kernel
;
;                         (c) Copyright 2002, Jean J. Labrosse, Weston, FL
;                                          All Rights Reserved
;
;
;                                       PAGED S12 Specific code
;                                            (METROWERKS)
;
; File         : OS_VIEW_A.S
; By           : Eric Shufro
;
; Notes        : THIS FILE *MUST* BE LINKED INTO NON_BANKED MEMORY!
;********************************************************************************************************

NON_BANKED:       section  

;********************************************************************************************************
;                                           I/O PORT ADDRESSES
;********************************************************************************************************

PPAGE:            equ    $0030         ; Addres of PPAGE register (assuming MC9S12 (non XGATE part)
SCI0SR1:					equ    $00cc

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

    xdef   OSView_RxTxISR   
    
;********************************************************************************************************
;                                         EXTERNAL DECLARATIONS
;********************************************************************************************************
   
    xref   OSIntExit
    xref   OSIntNesting  
    xref   OSTCBCur     
    xref   OSView_RxTxISRHandler 

		xref   OSView_IntSr
;********************************************************************************************************
;                                           OSView ISR
;
; Description : This routine is the ISR for OSView. It calls an ISR handler to perform most of the
;               the I/O operations from C. The ISR itself, like ALL other ISR's is coded in
;               assembly so that the OS related stack pointer manipulation can be performed
;               prior to calling the associated ISR Handler function.
;
; Arguments   : none
;
; Notes       : 1) All USER interrupts should be modeled EXACTLY like this where the only
;                  line to be modified is the call to your ISR_Handler and perhaps the call to
;                  the label name OSView_ISR1.
;********************************************************************************************************

OSView_RxTxISR:
;;;;;;;;;;;;;;;;
;		ldaa   SCI0SR1
;		staa   OSView_IntSr 

    ldaa   PPAGE                       ;  Get current value of PPAGE register                                
    psha                               ;  Push PPAGE register onto current task's stack

    inc    OSIntNesting                ;  Notify uC/OS-II about ISR

    ldab   OSIntNesting                ;  if (OSIntNesting == 1) {    
    cmpb   #$01                        ;  
    bne    OSView_RxTxISR1                 ;  

    ldy    OSTCBCur                    ;      OSTCBCur->OSTCBStkPtr = Stack Pointer     
    sts    0,y                         ;  }                                          

OSView_RxTxISR1:
    call   OSView_RxTxISRHandler   	   ;  Call the OS View ISR Handler

    cli                                ;  Enable interrupts to allow interrupt nesting
       
    call   OSIntExit                   ;  Notify uC/OS-II about end of ISR
    
    pula                               ;  Get value of PPAGE register
    staa   PPAGE                       ;  Store into CPU's PPAGE register                                
        
    rti                                ;  Return from interrupt, no higher priority tasks ready.
    

⌨️ 快捷键说明

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