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

📄 radioint.asm

📁 cypress公司PROC开发源码(cywusb6953)
💻 ASM
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  FILENAME: radioINT.asm
;;   Version: 1.0, Updated on 2005/08/10 at 14:24:50
;;  Generated by PSoC Designer ver 4.2  b1013 : 02 September, 2004
;;
;;  DESCRIPTION:
;;    Interrupt handler routine for WirelessUSBLS user module instance: radio.
;;-----------------------------------------------------------------------------
;;  Copyright (c) Cypress MicroSystems 2000-2003. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************

include "m8c.inc"
include "memory.inc"
include "radio.inc"
include "psocgpioint.inc"

IF ( radio_NON_BLOCKING_CALLS & 1h )

;-----------------------------------------------
;  Global Symbols
;-----------------------------------------------
export  _radio_ISR


AREA InterruptRAM (RAM,REL,CON)

;@PSoC_UserCode_INIT@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom declarations below this banner
;---------------------------------------------------

;------------------------
; Includes
;------------------------

	
;------------------------
;  Constant Definitions
;------------------------


;------------------------
; Variable Allocation
;------------------------
AREA  InterruptRAM(RAM,REL,CON)        


export _fRxDone, fRxDone
export bIntRxDataLength
export bIntRxDataBuffer
export bIntRxValidBuffer
export bIntRxBufferLength

_fRxDone: 
 fRxDone: 
    blk 1
bIntRxIrqStatus: 
    blk 1
bIntRxDataLength: 
    blk 1
bIntRxBufferLength: 
    blk 1
bIntRxDataBuffer: 
    blk 2
bIntRxValidBuffer: 
    blk 2


;---------------------------------------------------
; Insert your custom declarations above this banner
;---------------------------------------------------
;@PSoC_UserCode_END@ (Do not change this line.)


AREA UserModules (ROM, REL)

;-----------------------------------------------------------------------------
;  FUNCTION NAME: _radio_ISR
;
;  DESCRIPTION: Unless modified, this implements only a null handler stub.
;
;-----------------------------------------------------------------------------
;

.SECTION
_radio_ISR:
    push  A
    push  X
    REG_PRESERVE MVW_PP

.BeginWhileLoop:
    RAM_SETPAGE_CUR >fRxDone
    mov   A, [fRxDone]
    and   A, RX_NO_BLOCK
    jz    .IrqDone

.CheckIrqAsserted:
    or    reg[PRT0DR], NSS_PIN           ; de-assert slave select

    TST   REG[PRT0DR], IRQ_PIN
    jz    .IrqDone

    and    reg[PRT0DR], ~NSS_PIN         ; assert slave select
    and    reg[PRT0DR], ~MOSI_PIN        ; clear write bit
    or     reg[PRT0DR], SCLK_PIN
    and    reg[PRT0DR], ~SCLK_PIN
    or     reg[PRT0DR], MOSI_PIN         ; set auto increment bit (for burst mode)
    or     reg[PRT0DR], SCLK_PIN
    and    reg[PRT0DR], ~SCLK_PIN
               
    mov   A,REG_RX_INT_STAT
    call  radio_WriteAddress  ; writes the 6-bit register address
    call  radio_ReadData      ; read REG_RX_INT_STAT
    cmp   A, 0
    jz    .IrqDone
    RAM_SETPAGE_CUR >bIntRxIrqStatus
    mov   [bIntRxIrqStatus], A
    tst   [bIntRxIrqStatus], RX_FULL_A
    jz   .CheckEofInt

    ; if (bRxDataLength < bBufferLength)
.CheckForBufferOverflow:
    mov   A, [bIntRxDataLength]
    cmp   A, [bIntRxBufferLength]
    jc    .ReadData

.BufferOverflow:
    mov   [bIntRxDataLength], 0          ; reset buffer length so that we don't get a buffer overflow

    mov   [fRxDone], RX_DONE
    jmp   .IrqDone

.ReadData:
    call  radio_ReadData      ; read REG_RX_DATA_A
    push  A
IF SYSTEM_LARGE_MEMORY_MODEL 
    mov   A, [bIntRxDataBuffer]
    RAM_SETPAGE_MVW A
ENDIF
    mov   A,[bIntRxDataBuffer+1]
    RAM_SETPAGE_CUR >bRadioTemp
    add   A, [bIntRxDataLength]
    mov   [bRadioTemp], A
    pop   A
    mvi   [bRadioTemp], A

    tst   [bIntRxIrqStatus], RX_VALID_A
    jz    .ReadValidRegister

IF SYSTEM_LARGE_MEMORY_MODEL 
    mov   A, [bIntRxValidBuffer]
    RAM_SETPAGE_MVW A    
ENDIF
    mov   A, [bIntRxValidBuffer+1]
    add   A, [bIntRxDataLength]
    mov   [bRadioTemp], A
    mov   A,FFh
    mvi   [bRadioTemp], A
    jmp   .IncrementLength

.ReadValidRegister:
    call  radio_ReadData
    push  A  
IF SYSTEM_LARGE_MEMORY_MODEL 
    mov   A,[bIntRxValidBuffer]
    RAM_SETPAGE_MVW A    
ENDIF
    mov   A, [bIntRxValidBuffer+1]
    add   A, [bIntRxDataLength]
    mov   [bRadioTemp], A
    pop   A
    mvi   [bRadioTemp], A
    cmp   a, 0Fh
    jnc   .IncrementLength
    mov   A, 0
    cmp   A, [bIntRxDataLength]
    jnc   .CheckEofInt

.IncrementLength:
    inc   [bIntRxDataLength]

.CheckEofInt:
    tst   [bIntRxIrqStatus], RX_EOF_A
    jz    .CheckOverInt

    cmp   [bIntRxDataLength], 0
    jz    .CheckOverInt

    mov   [fRxDone], RX_DONE

    jmp   .IrqDone

.CheckOverInt:
    ; if(bIrqSource & RX_OVER_A)
    tst   [bIntRxIrqStatus], RX_OVER_A
    jz    .CheckIrqAsserted

    or    [fRxDone], RX_OVER

.IrqDone:
    or    reg[PRT0DR], NSS_PIN           ; de-assert slave select

    REG_RESTORE MVW_PP
    pop   X
    pop   A
    ret   
.ENDSECTION

ENDIF  ; radio_NON_BLOCKING_CALLS

⌨️ 快捷键说明

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