📄 lpirqmacros.inc
字号:
;--------------------------------------------------------------------------
;
; Filename: lpIrqMacros.inc
;
; Description: LP radio driver macros.
;
;--------------------------------------------------------------------------
; WirelessUSB LP Radio Driver Version 1.4
;--------------------------------------------------------------------------
;
; Copyright 2005-2007, 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.
;
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------;
; ;
; 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 ;
; ;
;--------------------------------------------------------------------------;
; ----------------------------------------------------------------------------
; Disable or enable the code compressor. Redefining here allows 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
; ----------------------------------------------------------------------------
; PUSH_F_VIA_A - Save Flags register on the stack and DISABLE GIE
;
; CODE COMPRESSION MUST BE TURNED OFF TO USE THIS MACRO.
; ----------------------------------------------------------------------------
MACRO PUSH_F_VIA_A ; A reg is lost
MOV A, REG[CPU_F] ;[6] Get flags register
PUSH A ;[4] Make room for flags register.
AND F, 0xFE ;[4] Disable GIE (M8C_DisableGInt)
ENDM ; 14 cycles total
; ----------------------------------------------------------------------------
; PUSH_F_VIA_X - Save Flags register on the stack and DISABLE GIE
;
; CODE COMPRESSION MUST BE TURNED OFF TO USE THIS MACRO.
; ----------------------------------------------------------------------------
MACRO PUSH_F_VIA_X ; X reg is lost
MOV X, A ;[ 4]
PUSH_F_VIA_A ;[14]
MOV A, X ;[ 4]
ENDM ; 22 cycles total
; ----------------------------------------------------------------------------
; PUSH_F - Save Flags register on the stack and DISABLE GIE
;
; CODE COMPRESSION MUST BE TURNED OFF TO USE THIS MACRO.
; ----------------------------------------------------------------------------
MACRO PUSH_F_VIA_RAM ; No registers lost
MOV [tmpPushF], A ;[ 5]
PUSH_F_VIA_A ;[14]
MOV A, [tmpPushF] ;[ 5]
ENDM ; 24 cycles total
; ----------------------------------------------------------------------------
;
; POP_F_RET - Pop F reg to restore GIE bit and return
;
; ----------------------------------------------------------------------------
MACRO POP_F_RET
RETI
ENDM
;; Save F register on the stack and disables Global Interrupts.
;; It preserves A and X registers.
;; Don't use becauses takes many cycles and uses INDEXed mode
;; which means Large Memory Model would also need to diddle with Page Mode.
;MACRO PUSH_F_DISABLE_IRQ
; PUSH A ;[ 4] Make room for flags register.
; PUSH A ;[ 4] Save A and X cause we're going
; PUSH X ;[ 4] to stomp them.
; MOV X, SP ;[ 4] Going to poke directly into stack.
; MOV A, REG[CPU_F] ;[ 6] Get flags register
; MOV [X+-3], A ;[ 6]Stash under saved A and X.
; POP X ;[ 5] Restore regs
; POP A ;[ 5]
; AND F, 0xFE ;[ 4] Disable IRQ
;ENDM ; 42 cycles total, uses INDEX instr
; ############################################################################
; END OF <irqMacros.inc>
; ############################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -