📄 initcom.asm
字号:
;/*************************************************************************/
;/* Warning: */
;/* Pls don't remodify this File. */
;/* If you have something exhausted, pls contact with me. */
;/* GauTsuanFar----2001/12/22 */
;/*************************************************************************/
;/*************************************************************************/
;/* */
;/* Copyright (c) 2001-2001 XJ electric corporation. */
;/* */
;/* PROPRIETARY RIGHTS of XJ Group are involved in the */
;/* subject matter of this material. All manufacturing, reproduction, */
;/* use, and sales rights pertaining to this subject matter are governed */
;/* by the license agreement. The recipient of this software implicitly */
;/* accepts the terms of the license. */
;/* */
;/*************************************************************************/
;
;/*************************************************************************/
;/* */
;/* FILE NAME VERSION */
;/* */
;/* initcom.asm ver1.0 */
;/* */
;/* COMPONENT */
;/* */
;/* Initial 16c554 - Initial of 16C554 */
;/* Interrupt-of 16c554 communication */
;/* */
;/* DESCRIPTION */
;/* */
;/* This file contains the 16c554 processor dependent Initial */
;/* routines and data. */
;/* */
;/* AUTHOR */
;/* */
;/* GauTsunFar, XJ electric corporation. */
;/* */
;/* DATA STRUCTURES */
;/* */
;/* No. */
;/* */
;/* FUNCTIONS */
;/* interrupt functions */
;/* INT16c554_Initialize Target initialization */
;/* DEPENDENCIES */
;/* */
;/* None */
;/* */
;/* HISTORY */
;/* */
;/* NAME DATE REMARKS */
;/* GauTsunFar 2001-8-22 complete the initial routine */
;/* and the interrupt routine */
;/* */
;/*************************************************************************/
;
.global _Init_16c554,_Init_16c554A,_Init_16c554B,_Init_16c554C
.global _Init_16c554D
.global _INT_EXINT3
.global _Com_Port1,_Com_Port2,_Com_Port3,_Com_Port4
.global _RDY_OE,_Relay_Out,_Digital_In
.global _pInReceBuffA,_pOutReceBuffA,_ReceiveBuffA
.global _pInReceBuffB,_pOutReceBuffB,_ReceiveBuffB
.global _pInReceBuffC,_pOutReceBuffC,_ReceiveBuffC
.global _pInReceBuffD,_pOutReceBuffD,_ReceiveBuffD
.global _ReceBuffALen_,_ReceBuffBLen_
.global _ReceBuffCLen_,_ReceBuffDLen_
_ReceBuffALen_ .set 400h ;receive buffer length
_ReceBuffBLen_ .set 400h ;receive buffer length
_ReceBuffCLen_ .set 400h ;receive buffer length
_ReceBuffDLen_ .set 400h ;receive buffer length
_DataReady .set 01H ;receive data ready
ReceiveBuffA_Addr .usect ".sysm8",_ReceBuffALen_ ;receive data buffer
ReceiveBuffB_Addr .usect ".sysm8",_ReceBuffBLen_ ;receive data buffer
ReceiveBuffC_Addr .usect ".sysm8",_ReceBuffCLen_ ;receive data buffer
ReceiveBuffD_Addr .usect ".sysm8",_ReceBuffDLen_ ;receive data buffer
.bss pInReceBuffA_Addr,1 ;Input pointer of buffer
.bss pOutReceBuffA_Addr,1 ;output pointer of buffer
.bss pInReceBuffB_Addr,1 ;Input pointer of buffer
.bss pOutReceBuffB_Addr,1 ;output pointer of buffer
.bss pInReceBuffC_Addr,1 ;Input pointer of buffer
.bss pOutReceBuffC_Addr,1 ;output pointer of buffer
.bss pInReceBuffD_Addr,1 ;Input pointer of buffer
.bss pOutReceBuffD_Addr,1 ;output pointer of buffer
;com1-813800,com2-813000,com3-812800,com4-812000
.text
;_Com_Port1 .word 813800H ; Addrress GPS-- com1
;_Com_Port2 .word 813000H ; Addrress PC-- com2
;_Com_Port3 .word 812800H ; Addrress JK1-- com3
;_Com_Port4 .word 812000H ; Addrress JK2-- com4
;_RDY_OE .word 811001H ; 485OE,CPU_RDY
;_Relay_Out .word 811000H ; Dout
;_Digital_In .word 811002H ; Din
ReceiveBR .word 00000000B ;Receive buffer register(Addr+0,read only)
TransmitHR .word 00000000B ;Transmit holding register(Addr+0,write only)
;4800-d0,9600-68
DLL .word 01101000B ;Baudrate low byte(Addr+0,DLAB=1)
DLL1 .word 11010000B ;Baudrate low byte(Addr+0,DLAB=1)
DLM .word 00000000B ;Baudrate High byte(Addr+1,DLAB=1)
;receive Interrupt enabled
InterruptER .word 00000001B ;Interrupt enable register(Addr+1)
;FIFO,1char trigger level
FIFOCR .word 00000111B ;FIFO control register(Addr+2,write only)
InterruptIR .word 00000000B ;Interrupt identify register(Addr+2,read only)
;8bit,1stop,even parity
LineCR .word 00011011B ;line control register(Addr+3)
LineCR1 .word 00000011B ;line control register(Addr+3)
ModemCR .word 00001000B ;modem control register(Addr+4,no need mention)
;
LineSR .word 00100001B ;line Status register(Addr+5)
ModemSR .word 00000000B ;Modem Status register(Addr+6,no need mention)
ScratchR .word 00000000B ;ScratchPad register(Addr+7,no need mention)
_ReceiveBuffA .word ReceiveBuffA_Addr ;receive buffer address
_ReceiveBuffB .word ReceiveBuffB_Addr ;receive buffer address
_ReceiveBuffC .word ReceiveBuffC_Addr ;receive buffer address
_ReceiveBuffD .word ReceiveBuffD_Addr ;receive buffer address
_pInReceBuffA .word pInReceBuffA_Addr ;input pointer address
_pOutReceBuffA .word pOutReceBuffA_Addr ;output pointer address
_pInReceBuffB .word pInReceBuffB_Addr ;input pointer address
_pOutReceBuffB .word pOutReceBuffB_Addr ;output pointer address
_pInReceBuffC .word pInReceBuffC_Addr ;input pointer address
_pOutReceBuffC .word pOutReceBuffC_Addr ;output pointer address
_pInReceBuffD .word pInReceBuffD_Addr ;input pointer address
_pOutReceBuffD .word pOutReceBuffD_Addr ;output pointer address
;---------------------------------------------------------
;void _Init_16c554(void);
_Init_16c554:
call _Init_16c554D
call _Init_16c554C
call _Init_16c554B
;initial Achannel
;void _Init_16c554A(void);
_Init_16c554A:
push ST
push DP
push AR0
push AR1
LDP @_Com_Port1 ;Load Data Page Pointer
LDI @_Com_Port1,AR0 ;LOAD in AR0 the pointer to Com_Port1
ldi 0,AR1
STI AR1,*+AR0(1) ;Mask InterruptER Register ; registers
LDP @FIFOCR ;Load Data Page Pointer
LDI @FIFOCR,AR1
STI AR1,*+AR0(2) ;Init FIFOCR Register
ldi 80h,AR1
STI AR1,*+AR0(3) ;Line Control Register DLAB=1
LDP @DLL ;Load Data Page Pointer
LDI @DLL,AR1
STI AR1,*+AR0(0) ;Init DLL Register
LDP @DLM ;Load Data Page Pointer
LDI @DLM,AR1
STI AR1,*+AR0(1) ;Init DLM Register
LDP @LineCR ;Load Data Page Pointer
LDI @LineCR,AR1
STI AR1,*+AR0(3) ;Init Line Control Register
LDP @ModemCR ;Load Data Page Pointer
LDI @ModemCR,AR1
STI AR1,*+AR0(4) ;Init Line Control Register
LDP @InterruptER ;Load Data Page Pointer
LDI @InterruptER,AR1
STI AR1,*+AR0(1) ;Init InterruptER Register
LDP @ScratchR ;Load Data Page Pointer
LDI @ScratchR,AR1
STI AR1,*+AR0(7) ;Init ScratchR Register
LDP @_ReceiveBuffA ;Load Data Page Pointer
LDI @_ReceiveBuffA,AR1 ;First address of Receive Buffer
LDP @_pInReceBuffA ;Load Data Page Pointer
LDI @_pInReceBuffA,AR0 ;Receive Buffer memory pointer
STI AR1,*AR0
LDP @_pOutReceBuffA ;Load Data Page Pointer
LDI @_pOutReceBuffA,AR0 ;Receive Buffer memory pointer
STI AR1,*AR0
pop AR1
pop AR0
pop DP
pop ST
rets
;initial B channel
;void _Init_16c554B(void);
_Init_16c554B:
push ST
push DP
push AR0
push AR1
LDP @_Com_Port2 ;Load Data Page Pointer
LDI @_Com_Port2,AR0 ;LOAD in AR0 the pointer to Com_Port1
ldi 0,AR1
STI AR1,*+AR0(1) ;Mask InterruptER Register ; registers
LDP @FIFOCR ;Load Data Page Pointer
LDI @FIFOCR,AR1
STI AR1,*+AR0(2) ;Init FIFOCR Register
ldi 80h,AR1
STI AR1,*+AR0(3) ;Line Control Register DLAB=1
LDP @DLL ;Load Data Page Pointer
LDI @DLL,AR1
STI AR1,*+AR0(0) ;Init DLL Register
LDP @DLM ;Load Data Page Pointer
LDI @DLM,AR1
STI AR1,*+AR0(1) ;Init DLM Register
; LDP @FIFOCR ;Load Data Page Pointer
; LDI @FIFOCR,AR1
; STI AR1,*+AR0(2) ;Init FIFOCR Register
LDP @LineCR ;Load Data Page Pointer
LDI @LineCR,AR1
STI AR1,*+AR0(3) ;Init Line Control Register
LDP @ModemCR ;Load Data Page Pointer
LDI @ModemCR,AR1
STI AR1,*+AR0(4) ;Init Line Control Register
LDP @InterruptER ;Load Data Page Pointer
LDI @InterruptER,AR1
STI AR1,*+AR0(1) ;Init InterruptER Register
LDP @ScratchR ;Load Data Page Pointer
LDI @ScratchR,AR1
STI AR1,*+AR0(7) ;Init ScratchR Register
LDP @_ReceiveBuffB ;Load Data Page Pointer
LDI @_ReceiveBuffB,AR1 ;First address of Receive Buffer
LDP @_pInReceBuffB ;Load Data Page Pointer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -