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

📄 systemtimer.asm

📁  PSoC(可编程片上系统)是Cypress半导体公司生产的包含有8位微处理器核和数字与模拟混合的信号阵列芯片
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;;*****************************************************************************
;;*****************************************************************************
;;  Filename:   SystemTimer.asm
;;  Version: 1.0, Updated on 2006/05/15 at 15:10:02
;;  Generated by PSoC Designer ???
;;
;;  DESCRIPTION:  SleepTimer User Module software implementation file for the
;;                22/24/27/29xxx families.
;;
;;
;;  NOTE: User Module APIs conform to the fastcall16 convention for marshalling
;;        arguments and observe the associated "Registers are volatile" policy.
;;        This means it is the caller's responsibility to preserve any values
;;        in the X and A registers that are still needed after the API functions
;;        returns. For Large Memory Model devices it is also the caller's 
;;        responsibility to perserve any value in the CUR_PP, IDX_PP, MVR_PP and 
;;        MVW_PP registers. Even though some of these registers may not be modified
;;        now, there is no guarantee that will remain the case in future releases.
;;-----------------------------------------------------------------------------
;;  Copyright (c) Cypress MicroSystems 2000-2006. All Rights Reserved.
;;*****************************************************************************
;;*****************************************************************************


include "m8c.inc"
include "memory.inc"
include "SystemTimer.inc"

;-----------------------------------------------
;  Global Symbols
;-----------------------------------------------
;-------------------------------------------------------------------
;  Declare the functions global for both assembler and C compiler.
;
;  Note that there are two names for each API. First name is
;  assembler reference. Name with underscore is name reference for
;  C compiler.  Calling function in C source code does not require
;  the underscore.
;-------------------------------------------------------------------
export  SystemTimer_EnableInt
export _SystemTimer_EnableInt
export  SystemTimer_DisableInt
export _SystemTimer_DisableInt

export  SystemTimer_Start
export _SystemTimer_Start
export  SystemTimer_Stop
export _SystemTimer_Stop

export  SystemTimer_TickWait
export _SystemTimer_TickWait

export  SystemTimer_SyncWait
export _SystemTimer_SyncWait

export  SystemTimer_SetInterval
export _SystemTimer_SetInterval
	
export  SystemTimer_bGetTickCntr
export _SystemTimer_bGetTickCntr

export  SystemTimer_SetTimer
export _SystemTimer_SetTimer

export  SystemTimer_bGetTimer
export _SystemTimer_bGetTimer

IF(SystemTimer_TICK_CNTR_SIZE & (4|2))
export  SystemTimer_iGetTickCntr
export _SystemTimer_iGetTickCntr
ENDIF

IF(SystemTimer_TICK_CNTR_SIZE & 4)
export  SystemTimer_lGetTickCntr
export _SystemTimer_lGetTickCntr
ENDIF

;-----------------------------------------------
; Variable Allocation
;-----------------------------------------------
    
area SystemTimer_RAM (RAM, REL, CON)
    

area text (ROM,REL)

;-----------------------------------------------
;  EQUATES
;-----------------------------------------------

; Counter LSB Offset if 4 byte tick counter
IF(SystemTimer_TICK_CNTR_SIZE & 4)
ST_LSB_OFFSET:   equ  3
ENDIF

; Counter LSB Offset if 2 byte tick counter
IF(SystemTimer_TICK_CNTR_SIZE & 2)
ST_LSB_OFFSET:   equ  1
ENDIF

; Counter LSB Offset if 1 byte tick counter
IF(SystemTimer_TICK_CNTR_SIZE & 1)
ST_LSB_OFFSET:   equ  0
ENDIF


area UserModules (ROM, REL, CON)

;=============================================================================
;=============================================================================
;
;     Low-Level Commands
;
;=============================================================================
;=============================================================================

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: SystemTimer_EnableInt
;
;  DESCRIPTION:
;     Enables this UART's interrupt by setting the interrupt enable mask
;     bit associated with this User Module. Remember to call the global
;     interrupt enable function by using the macro: M8C_EnableGInt.
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
;  THEORY of OPERATION OR PROCEDURE:
;
 SystemTimer_EnableInt:
_SystemTimer_EnableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_EnableIntMask SystemTimer_INT_REG, SystemTimer_INT_MASK
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

    
.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: SystemTimer_DisableInt
;
;  DESCRIPTION:
;     Disables the sleep timer. 
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
;  THEORY of OPERATION OR PROCEDURE:
;
 SystemTimer_DisableInt:
_SystemTimer_DisableInt:
   RAM_PROLOGUE RAM_USE_CLASS_1
   M8C_DisableIntMask SystemTimer_INT_REG, SystemTimer_INT_MASK
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: SystemTimer_Start()
;
;  DESCRIPTION:
;     Clears all the variables.  
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;      none
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS;    
;    REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;    IN THE LARGE MEMORY MODEL CURRENTLY ONLY THE PAGE POINTER 
;    REGISTERS LISTED BELOW ARE MODIFIED.  THIS DOES NOT GUARANTEE 
;    THAT IN FUTURE IMPLEMENTATIONS OF THIS FUNCTION OTHER PAGE POINTER 
;    REGISTERS WILL NOT BE MODIFIED.
;          
;    Page Pointer Registers Modified: 
;          CUR_PP
;
;  THEORY of OPERATION OR PROCEDURE:
;
 SystemTimer_Start:
_SystemTimer_Start:
   RAM_PROLOGUE RAM_USE_CLASS_4
   RAM_SETPAGE_CUR >SystemTimer_fTick      
   mov  A,0
   mov  [SystemTimer_fTick],A
   mov  [SystemTimer_bTimerValue],A
   mov  [SystemTimer_bCountDown],A
   mov  [SystemTimer_TickCount + ST_LSB_OFFSET],A        ; Clear TickCount[0:7]
IF(SystemTimer_TICK_CNTR_SIZE & (4|2))
   mov  [SystemTimer_TickCount + ST_LSB_OFFSET - 1],A    ; Clear TickCount[8:15]
ENDIF


IF(SystemTimer_TICK_CNTR_SIZE & 4)
   mov   [SystemTimer_TickCount + ST_LSB_OFFSET - 2],A    ; Clear TickCount[16:31]
   mov   [SystemTimer_TickCount + ST_LSB_OFFSET - 3],A    
ENDIF


   RAM_EPILOGUE RAM_USE_CLASS_4
   ret
.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: SystemTimer_Stop
;
;  DESCRIPTION:
;   This function does nothing at this time.  It is only here as a place 
;   holder.
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
;  THEORY of OPERATION OR PROCEDURE:
;
 SystemTimer_Stop:
_SystemTimer_Stop:
   RAM_PROLOGUE RAM_USE_CLASS_1
   RAM_EPILOGUE RAM_USE_CLASS_1
   ret
.ENDSECTION

.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: SystemTimer_SetInterval
;
;  DESCRIPTION:
;     Sets sleep timer interval
;
;-----------------------------------------------------------------------------
;
;  ARGUMENTS:
;     A <= Timer setting
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
;
;  THEORY of OPERATION OR PROCEDURE:
;
 SystemTimer_SetInterval:
_SystemTimer_SetInterval:
   RAM_PROLOGUE RAM_USE_CLASS_2
IF (SystemTimer_PSOC_TYPE)
   and  A,SystemTimer_CLOCK_MASK               ; Mask off invalid data
   mov  X, SP
   push A
   M8C_SetBank1
   mov  A, reg[OSC_CR0]                  ; Get current timer value
   and  A,~SystemTimer_CLOCK_MASK   ; Zero out old timer value
   or   A, [X]                           ; Set new timer values
   mov  reg[OSC_CR0],A                   ; Write it
   M8C_SetBank0
   pop  A
ELSE
   and  A,SystemTimer_CLOCK_MASK               ; Mask off invalid data
   mov  X, SP
   push A
   M8C_SetBank1
   mov  A, reg[SLP_CR0]                  ; Get current timer value
   and  A,~SystemTimer_CLOCK_MASK   ; Zero out old timer value
   or   A, [X]                           ; Set new timer values
   mov  reg[SLP_CR0],A                   ; Write it
   M8C_SetBank0
   pop  A
ENDIF
   RAM_EPILOGUE RAM_USE_CLASS_2
   ret
.ENDSECTION


.SECTION
;-----------------------------------------------------------------------------
;  FUNCTION NAME: SystemTimer_TickWait(BYTE bTicks)
;

⌨️ 快捷键说明

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