?? irqmacros.inc
字號:
;--------------------------------------------------------------------------
;
; Filename: lpnoirq.inc
;
; Description: Include file which defines the macros for the LP radio
; driver.
;
;--------------------------------------------------------------------------
; WirelessUSB LP Radio Driver Version 1.0
; $Revision: 3 $
;--------------------------------------------------------------------------
;
; Copyright 2006, Cypress Semiconductor Corporation.
;
; This software is owned by Cypress Semiconductor Corporation (Cypress)
; and is protected by and subject to worldwide patent protection (United
; States and foreign), United States copyright laws and international
; treaty provisions. Cypress hereby grants to licensee a personal,
; non-exclusive, non-transferable license to copy, use, modify, create
; derivative works of, and compile the Cypress Source Code and derivative
; works for the sole purpose of creating custom software in support of
; licensee product to be used only in conjunction with a Cypress integrated
; circuit as specified in the applicable agreement. Any reproduction,
; modification, translation, compilation, or representation of this
; software except as specified above is prohibited without the express
; written permission of Cypress.
;
; Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
; WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
; Cypress reserves the right to make changes without further notice to the
; materials described herein. Cypress does not assume any liability arising
; out of the application or use of any product or circuit described herein.
; Cypress does not authorize its products for use as critical components in
; life-support systems where a malfunction or failure may reasonably be
; expected to result in significant injury to the user. The inclusion of
; Cypress' product in a life-support systems application implies that the
; manufacturer assumes all risk of such use and in doing so indemnifies
; Cypress against all charges.
;
; Use may be limited by and subject to the applicable Cypress software
; license agreement.
;
;--------------------------------------------------------------------------
;
;
; These macro definitions no-op the functions. They are intended for
; systems that do not touch the SPI hardware, Radio access routines, or
; call the RadioGet_State inside an IRQ handler.
;
;--------------------------------------------------------------------------;
; ;
; I N C L U D E F I L E S ;
; ;
;--------------------------------------------------------------------------;
INCLUDE "m8c.inc"
;--------------------------------------------------------------------------;
; ;
; M A C R O D E F I N I T I O N S ;
; ;
;--------------------------------------------------------------------------;
;
; Macros to disable or enable the code compressor. Redefined here to allow
; them to be easily no-op'd by replacing them in lpnoirq.inc.
;
MACRO DISABLE_CODE_COMPRESSION
Suspend_CodeCompressor
ENDM
MACRO ENABLE_CODE_COMPRESSION
Resume_CodeCompressor
ENDM
;
; This macro saves the state of the flags register on the stack and disables
; global interrupts. It does not disturb A or X.
;
; THIS MACRO WILL BREAK IF THE SUBLIMATOR IS ALLOWED TO HAVE ITS WAY WITH IT.
; CODE COMPRESSION MUST BE TURNED OFF IF YOU USE THIS MACRO.
;
MACRO PUSH_F_DISABLE_IRQ
PUSH A ; Make room for flags register.
PUSH A ; Save A and X cause we're going
PUSH X ; to stomp them.
MOV X, SP ; Going to poke directly into stack.
MOV A, REG[0xF7] ; Get flags register
MOV [X+-3], A ; Stash under saved A and X.
POP X ; Restore regs
POP A
AND F, 0xFE ; Disable IRQ
ENDM
;
; This macro saves the state of the flags register on the stack and disables
; global interrupts. This messy version stomps A and X.
;
; THIS MACRO WILL BREAK IF THE SUBLIMATOR IS ALLOWED TO HAVE ITS WAY WITH IT.
; CODE COMPRESSION MUST BE TURNED OFF IF YOU USE THIS MACRO.
;
MACRO PUSH_F_DISABLE_IRQ_MESSY
MOV A, REG[0xF7] ; Get flags register
PUSH A ; Make room for flags register.
AND F, 0xFE ; Disable IRQ
ENDM
;
; This macro restores the state of the flag register from the stack and
; performs a return to the calling routine.
;
MACRO POP_F_RET
RETI
ENDM
;
; Clear the temporary IE state. Can be restored with RET_RESTORE_IE_THROUGH_X
; or RET_RESTORE_IE_THROUGH_A.
;
MACRO CLEAR_TEMP_IE
AND F, 0xFE ; Disable IRQ
ENDM
;
; Set the GEI shadow.
;
MACRO SET_PERM_IE
MOV [IrqFlagShadow], 1
ENDM
;
; Clear the GEI shadow.
;
MACRO CLEAR_PERM_IE
MOV [IrqFlagShadow], 0
ENDM
;
; Push the GEI shadow.
;
MACRO PUSH_PERM_IE_THROUGH_A
MOV A, [IrqFlagShadow]
PUSH A
ENDM
;
; Pop the GEI shadow.
;
MACRO POP_PERM_IE_THROUGH_A
POP A
MOV [IrqFlagShadow], A
ENDM
;
; Push IE shadow through A.
;
MACRO PUSH_F_MESSY
MOV A, REG[0xF7] ; Get flags register
PUSH A ; Stack it.
ENDM
;
; Return and restore IE state through X register.
;
MACRO RET_RESTORE_IE_THROUGH_X
MOV X, [IrqFlagShadow]
PUSH X
RETI
ENDM
;
; Return and restore IE state through A register.
;
MACRO RET_RESTORE_IE_THROUGH_A
MOV A, [IrqFlagShadow]
PUSH A
RETI
ENDM
;
; Update IE perm from temp.
;
MACRO UPDATE_PERM_IE_THROUGH_A
MOV A, REG[0xF7] ; Get flags register
MOV [IrqFlagShadow], A
ENDM
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -