📄 dcm44n.a51
字号:
$TITLE (iDCM 44 COMMUNICATIONS FIRMWARE: SERIAL NON-AUTO MODULE)
$DATE (8 AUGUST 86)
$NOMO
$PAGING
$REGISTERBANK (0)
;***************************************************************************
;*
;* TITLE: iDCM 44 COMMUNICATIONS FIRMWARE: SERIAL NON-AUTO MODULE
;*
;* RELEASE: 2.0
;*
;* DESCRIPTION: THIS MODULE CONTAINS THE SERIAL PROCEDURES
;*
;* UPDATES:
;*
;***************************************************************************
;*
;* COPYRIGHT 1983, 1986 INTEL CORPORATION
;*
;* INTEL CORPORATION PROPRIETARY INFORMATION. THIS LISTING
;* IS SUPPLIED UNDER THE TERMS OF A LICENSE AGREEMENT WITH
;* INTEL CORPORATION AND MAY NOT BE COPIED NOR DISCLOSED
;* EXCEPT IN ACCORDANCE WITH THE TERMS OF THAT AGREEMENT.
;*
;***************************************************************************
NAME DCM44N
USING 0
$nolist
$include(reg44.pdf)
$include(dcm44c.ext)
$include(dcm44c.lit)
$include(r2sys.mac)
$include(dcm44m.a51)
$list
public non_auto_slave_rcv, non_auto_master_rcv, set_slave_offline
public serial_timeout, swap_station_states
extrn bit (s_station_mode, s_timeout_count, s_timeout_set)
extrn bit (s_init_mode, s_info_mode, s_poll_mode, s_set_rts)
extrn data (s_queue_ptr, s_poll_queue_in, s_poll_queue_out)
extrn data (s_last_nsnr, buf_size, req_next_buffer)
extrn xdata (s_station_state, s_station_poll)
extrn code (event_detect, serial_gateway_switch, check_receive_buffer)
extrn code (initiate_order_transmission, auto_send_acknowledge_check)
DCMFW_CODE_SEG SEGMENT CODE
DCMFW_BIT_SEG SEGMENT DATA BITADDRESSABLE
DCMFW_INT_SEG SEGMENT DATA
DCMFW_EXT_SEG SEGMENT XDATA
DCMFW_STATION_SEG SEGMENT XDATA INPAGE
DCMFW_POLL_SEG SEGMENT XDATA INPAGE
RSEG DCMFW_CODE_SEG
$eject
;***************************************************************************
;*
;* ENTRY: non_auto_slave_rcv
;*
;* PURPOSE: Process a frame received by a slave node in non-auto
;* mode
;*
;* ENTERED FROM: serial_interrupt_check
;*
;* CALLS: check_receive_buffer
;*
;* ENTERS: auto_send_acknowledge_check, event_detect,
;* set_non_auto_transmit
;*
;* INPUTS: none
;*
;* RETURNS: nothing
;*
;* DESCRIPTION: If a sequence error occurred, then go to the
;* slave protocol error routine.
;* Next, the type of received frame is checked.
;* If it is an information or supervisory frame, then
;* either buffer-overflow occurred, or a frame was
;* received before the slave was able to get into auto
;* mode (after initialization was complete). In any
;* case, go back into auto mode, reenable the receiver,
;* and go make an i-frame acknowledge check with the
;* rts-flag set, indicating that the rts siu bit needs
;* to be set.
;* If it is an unnumbered frame, then if the slave is in
;* init mode, then jump to slave_init_generate, else
;* jump to slave_protocol_error.
;*
;***************************************************************************
non_auto_slave_rcv:
; A frame was received while the slave was in non-auto mode.
; First check for type of frame.
;
jb ses, slave_protocol_error ;if protocol error, go process
jb ser, slave_protocol_error ;
mov a, rcb ;determine frame type
jnb acc.i_frame_bpos, slave_info_rcv ;if info frame, jump
jnb acc.s_frame_bpos, slave_supv_rcv ;if supervisory frame, jump
jnb s_init_mode, slave_protocol_error ;if u-frame, no init mode, jump
sjmp slave_init_generate ;if u-frame, init mode, jump
slave_info_rcv:
slave_supv_rcv:
; An information or supervisory frame was received either before the slave
; was able to go into auto mode, or after the slave was in auto mode but
; was kicked out of auto mode. These conditions can be caused by buffer
; overflow, or receiving the first I-frame before the slave is able to
; go into auto mode (as the last step in synchronization).
;
acall check_receive_buffer ;check on receive buffer
setb am ;set slave back into auto mode
setb s_set_rts ;set rts flag
setb rbe ;reenable receiver
ajmp auto_send_acknowledge_check ;go check for msg. ack.
;---------------------------------------------------------------------------
; Entry Point: slave_init_generate
;
; Purpose: Determine next control frame for slave to transmit
; during synchronization, and transmit the frame.
;
; Entered From: non_auto_slave_rcv, protocol_error_reset
;
; Calls: check_receive_buffer
;
; Enters: set_non_auto_transmit, which enters event_detect
;
; Inputs: none
;
; Returns: none
;
; Description: Checks last transmit control byte against current
; received control byte for a slave station. For trans-
; mitted anything and received disc, it transmits a ua.
; For transmitted ua and received snrm, it transmits a ua,
; clears sequence numbers, and later (with transmit ack)
; goes into auto mode. For anything else, it transmits
; a frmr.
;---------------------------------------------------------------------------
slave_init_generate:
setb s_init_mode ;reset flags
clr s_info_mode ;
mov a,rcb ;identify the received frame
cjne a,#disc_msk,slave_snrm_chk ;if not disc, jump
mov tcb,#ua_msk ;else xmit ua in response
ajmp set_non_auto_transmit ;go xmit unnumbered frame
slave_snrm_chk:
cjne a,#snrm_msk,slave_other ;if not snrm, jump
mov a,#ua_msk ;was a ua xmitted prev to snrm?
cjne a,tcb,slave_other ;if not, xmit frmr
; mov tcb,#ua_msk ;else transmit ua
mov nsnr,#0 ;initialize ns and nr counts
clr s_init_mode ;turn off init mode
mov sts,#10100000b ;tbf=1,rts=1,rest=0
acall check_receive_buffer ;Check for receive buffer
jnb si,$ ;wait for xmit complete interrupt
mov sts,#01000010b ;rbe=1,am=1,rest=0
ajmp event_detect ;go wait on event
slave_other:
; if not snrm, then it is either an error (0) or an unrecognized frame.
; generate a frame reject to force resynchronization.
;
mov tcb,#frmr_msk ;set for transmitting frmr
ajmp set_non_auto_transmit ;go xmit unnumbered frame
;---------------------------------------------------------------------------
; Entry Point: slave_protocol_error
;
; Purpose: Handle protocol error conditons on a slave node
;
; Entered From: non_auto_slave_rcv
;
; Calls: serial_gateway_switch
;
; Enters: slave_init_generate
;
; Inputs: none
;
; Returns: none
;
; Description: This routine processes a non-recoverable error on the
; slave node by returning all message queued for transmission
; to the System Buffer Pool, clearing the siu transmit
; registers, and clearing the info mode flag. It then jumps
; to slave_init_generate in order to transmit a disc frame
; back to the master.
;---------------------------------------------------------------------------
slave_protocol_error:
mov tbs,#0 ;clear siu xmit registers
mov tbl,#0 ;
slave_recycle_msgs: ;empty all msgs. from queue
%dequeue_message_def(s_queue_ptr) ;is there another message?
jz slave_recycle_end ;if not, exit loop
%req_deallocate ;else, deallocate next msg.
sjmp slave_recycle_msgs ;check for another msg.
slave_recycle_end:
ajmp slave_init_generate ;go xmit a snrm to the master
$eject
;***************************************************************************
;*
;* ENTRY: non_auto_master_rcv
;*
;* PURPOSE: Process a frame received by a master node.
;*
;* ENTERED FROM: serial_interrupt_check
;*
;* CALLS: serial_gateway_switch, check_receive_buffer
;* enqueue_poll_station_def (macro),
;* dequeue_poll_station_def (macro),
;* swap_station_states_def (macro),
;* dequeue_message_def (macro),
;* req_deallocate (macro)
;*
;* ENTERS: event_detect, initiate_order_transmission
;*
;*
;* INPUTS: none
;*
;* RETURNS: nothing
;*
;* DESCRIPTION: If a sequence error occurred, then go to the
;* master protocol error routine.
;* Next, the type of received frame is checked.
;* If it is an information frame, then jump to the
;* master info receive routine.
;* If it is a supervisory frame, then go the the master
;* ack check routine to process any acknowledgement.
;* If it is an unnumbered frame, then if the master is in
;* init mode, then jump to master_init_generate, else
;* jump to master_protocol_error.
;*
;***************************************************************************
non_auto_master_rcv:
jb ses, master_protocol_error ;if protocol error, jump
jb ser, master_protocol_error ;
mov a, rcb ;determine frame type
jnb acc.i_frame_bpos, master_info_rcv ;if info frame, jump
jnb acc.s_frame_bpos, master_ack_check ;if supervisory frame, jump
jnb s_init_mode, master_protocol_error ;if u-frame, non-init, jump
; ajmp master_init_generate ;if u-frame, init-mode, jump
;---------------------------------------------------------------------------
; Entry Point: master_init_generate
;
; Purpose: Determine next control frame for master to transmit
; during synchronization, and transmit the frame.
;
; Entered From: non_auto_master_rcv, protocol_error_reset
;
; Calls: none
;
; Enters: set_non_auto_transmit, which enters event_detect
;
; Inputs: none
;
; Returns: none
;
; Description: Checks last transmit control byte against current
; received control byte for a master station. For trans-
; mitted disc and received ua, it generates a snrm. For
; transmitted snrm and received ua, it clears the sequence
; numbers and exits init mode. Any other transmitted control
; field transmits a disc.
;---------------------------------------------------------------------------
master_init_generate:
setb s_init_mode ;reset flags
clr s_info_mode ;
clr s_poll_mode ;
mov a,rcb ;identify the received frame
cjne a,#ua_msk,master_disc_xmit ;if not a ua, go xmit disc
mov a,#disc_msk ;see if a disc was xmitted
cjne a,tcb,master_snrm_chk ;if not, go check for snrm
mov tcb,#snrm_msk ;if disc xmitted before, xmit snrm
ajmp set_non_auto_transmit ;go xmit unnumbered frame
master_disc_xmit:
mov tcb,#disc_msk ;transmit a disc
ajmp set_non_auto_transmit ;go xmit unnumbered frame
master_snrm_chk:
mov a,#snrm_msk ;see if a snrm was xmitted
cjne a,tcb,master_disc_xmit ;if not, go xmit disc
mov nsnr,#0 ;zero the sequence numbers
clr s_init_mode ;take out of init mode
ajmp sps_transmit_rr ;and go transmit rr
;---------------------------------------------------------------------------
; Entry Point: master_protocol_error
;
; Purpose: Handle protocol error conditons
;
; Entered From: non_auto_master_rcv
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -