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

📄 spis.asm

📁 用VC编辑的一个MD5算法
💻 ASM
字号:
;------------------------------------------------------------------------------
;  FILENAME:   SPIS.asm
;   VERSION:   Rev B, 2002 Mar 30
;------------------------------------------------------------------------------
;  DESCRIPTION:
;     SPIS SPIS User Module API.
;------------------------------------------------------------------------------
;	Copyright (c) Cypress MicroSystems 2000-2002. All Rights Reserved.
;------------------------------------------------------------------------------

;-----------------------------------------------
; include instance specific register definitions
;-----------------------------------------------
include "m8c.inc"
include "SPIS.inc"

area text (ROM, REL)

;-------------------------------------------------------------------
;  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 refence for
;  C compiler.  Calling function in C source code does not require 
;  the underscore.
;-------------------------------------------------------------------
export   SPIS_EnableInt
export  _SPIS_EnableInt
export   SPIS_DisableInt
export  _SPIS_DisableInt
export   SPIS_Start
export  _SPIS_Start
export   SPIS_Stop
export  _SPIS_Stop
export   SPIS_SetupTxData
export  _SPIS_SetupTxData
export   bSPIS_ReadRxData
export  _bSPIS_ReadRxData
export   bSPIS_ReadStatus
export  _bSPIS_ReadStatus

;-----------
;  EQUATES
;-----------
bfCONTROL_REG_START_BIT:   equ   1     ; Control register start bit 

;-----------------------------------------------------------------------------
;  FUNCTION NAME: SPIS_EnableInt
;
;  DESCRIPTION:
;     Enables the SPIS interrupt by setting the interrupt enable mask 
;     bit associated with this User Module. 
;  
;     NOTE:  Remember to enable the global interrupt by calling the
;           M8C global macro: M8C_EnableGInt
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Sets the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
 SPIS_EnableInt:
_SPIS_EnableInt:
   M8C_EnableIntMask SPIS_INT_REG, bSPIS_INT_MASK
   ret	

	
;-----------------------------------------------------------------------------
;  FUNCTION NAME: SPIS_DisableInt
;
;  DESCRIPTION:
;     Disables this SPIS's interrupt by clearing the interrupt enable mask bit
;     associated with this User Module. 
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Clears the specific user module interrupt enable mask bit.
;
;-----------------------------------------------------------------------------
 SPIS_DisableInt:
_SPIS_DisableInt:
   M8C_DisableIntMask   SPIS_INT_REG, bSPIS_INT_MASK
   ret


;-----------------------------------------------------------------------------
;  FUNCTION NAME: SPIS_Start(BYTE bConfiguration)
;
;  DESCRIPTION:
;     Sets the start bit, SPI mode, and LSB/MSB first configuration of the SPIS 
;     user module. 
;
;     SPIS User Module will be ready to receive data, when an SPI Master initiates
;     an SPI transmission/receive protocol cycle.
;
;  ARGUMENTS:
;     BYTE bConfiguration - Consists of SPI Mode and LSB/MSB first bit.  
;           Use defined masks - masks can be OR'd together.
;     PASSED in Accumulator.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Set the specified SPI configuration bits in the Control register.
;
;-----------------------------------------------------------------------------
 SPIS_Start:
_SPIS_Start:
   ; setup the SPIS configuration setting 
   or    A, bfCONTROL_REG_START_BIT
   mov   REG[SPIS_CONTROL_REG], A
   ret	


;-----------------------------------------------------------------------------
;  FUNCTION NAME: SPIS_Stop
;
;  DESCRIPTION:
;     Disables SPIS operation, and de-asserts the slave select signals.
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     
;     1) Clear the start bit in the Control register.
;     2) De-assert slave select signals.
;
;-----------------------------------------------------------------------------
 SPIS_Stop:
_SPIS_Stop:
   ; clear the SPIS stop bits
   and   REG[SPIS_CONTROL_REG], ~bfCONTROL_REG_START_BIT
   ret	


;-----------------------------------------------------------------------------
;  FUNCTION NAME: SPIS_SetupTxData
;
;  DESCRIPTION:
;     Loads data into the SPI Tx Buffer in readiness for an SPI Tx/Rx cycle.  
;
;  ARGUMENTS:
;     BYTE  bTxData - data to transmit.
;        Passed in A register
;
;  RETURNS:
;     none.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     1) Writes data into the TX buffer register
;
;-----------------------------------------------------------------------------
 SPIS_SetupTxData:
_SPIS_SetupTxData:
	mov REG[SPIS_TX_BUFFER_REG], A
	ret


;-----------------------------------------------------------------------------
;  FUNCTION NAME: bSPIS_ReadRxData
;
;  DESCRIPTION:
;     Reads the RX buffer register.  Should check the status regiser to make
;     sure data is valid.
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     bRxData - returned in A.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     none.
;
;-----------------------------------------------------------------------------
 bSPIS_ReadRxData:
_bSPIS_ReadRxData:
	mov A, REG[SPIS_RX_BUFFER_REG]
	ret



;-----------------------------------------------------------------------------
;  FUNCTION NAME: bSPIS_ReadStatus
;
;  DESCRIPTION:
;     Reads the SPIS Status bits in the Control/Status register.
;
;  ARGUMENTS:
;     none.
;
;  RETURNS:
;     BYTE  bStatus - transmit status data.  Use the defined bit masks.
;        Returned in Accumulator.
;
;  SIDE EFFECTS:
;     none.
;
;  THEORY of OPERATION:  
;     Read the status and control register.
;
;-----------------------------------------------------------------------------
 bSPIS_ReadStatus:
_bSPIS_ReadStatus:
	mov A,  REG[SPIS_CONTROL_REG]
	ret
   

;	end of SPIS API code





⌨️ 快捷键说明

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