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

📄 dcm44a.a51

📁 8051实时操作系统
💻 A51
字号:
$TITLE (iDCM 44 COMMUNICATIONS FIRMWARE: SERIAL AUTO MODULE)
$DATE (8 AUGUST 86)

$NOMO
$PAGING
$REGISTERBANK (0)

;***************************************************************************
;*
;*     TITLE:          iDCM 44 COMMUNICATIONS FIRMWARE: SERIAL 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    DCM44A

USING 0

$include(reg44.pdf)
$include(dcm44c.ext)
$include(dcm44c.lit)
$include(r2sys.mac)
$include(dcm44m.a51)

public  auto_information_frame_check, auto_send_acknowledge_check

public  check_receive_buffer


extrn   bit  (s_init_mode, s_info_mode, s_poll_mode, s_set_rts)
extrn   data (s_queue_ptr, rqbufsize, buf_size, req_next_buffer)

extrn   code (event_detect, serial_gateway_switch, send_serial_slave_reply)


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:          auto_information_frame_check
;*
;*     PURPOSE:        check for received information frame in auto mode
;*
;*     ENTERED FROM:   serial_interrupt_check
;*
;*     CALLS:          serial_gateway_switch           (msg_ptr in R0)

;*
;*     ENTERS:         auto_send_acknowledge_check     (no parameters)
;*
;*     INPUTS:         None
;*
;*     RETURNS:        None
;*
;*     DESCRIPTION:    If received message length is not zero, then
;*                     the received message is sent for routing.
;*                     Otherwise, a check is made for acknowledgement
;*                     of the last transmitted frame.
;*
;***************************************************************************

auto_information_frame_check:

    jb      rbe, auto_send_acknowledge_check ;if no msg received, jump

 
sai_message_received: 

    mov     r0,rbs                  ;r0 => received message

    mov     rbl,#0                  ;clear receive buffer regs.
    mov     rbs,#0                  ;

    acall   get_receive_buffer      ;try to get new receive buffer

    setb    rbe                     ;enable the receiver

    dec     r0                      ;point r0 to start of msg. buffer

    dec     r0
    acall   serial_gateway_switch   ;Call the routing function

;   sjmp    auto_send_acknowledge_check

$EJECT
;***************************************************************************
;*
;*     ENTRY:          auto_send_acknowledge_check
;*
;*     PURPOSE:        Check for acknowledgement on last transmitted frame
;*                     and sets up new transmit frame, if any.
;*
;*     ENTERED FROM:   auto_information_frame_check
;*
;*     CALLS:          req_allocate    (inline macro)  (buffer_ptr ret in A)
;*                     req_deallocate  (inline macro)  (msg_ptr in A)
;*                     dequeue_message (inline macro)  (msg_ptr in A on ret)
;*                     send_serial_slave_reply         (msg_ptr in acc)
;*
;*     ENTERS:         event_detect    (origin)        (no parmeters)
;*
;*     INPUTS:         None
;*
;*     RETURNS:        None
;*
;*     DESCRIPTION:    Checks to see if message is still awaiting
;*                     transmission.  If so, and if a receive buffer is
;*                     needed, then one is allocated.  Otherwise, the transmit
;*                     message is either deallocated or assigned to the
;*                     receive buffer.  Then, if another message is waiting,
;*                     it is dequeued and set up for auto transmission.
;*
;***************************************************************************

auto_send_acknowledge_check:

    jnb     s_info_mode,ed_vec      ;if xmission not in progress, jump

    jb      tbf,ed_vec              ;if xmission not complete, jump
    %dequeue_message_def(s_queue_ptr)  ;Else, return buffer to pool
    %req_deallocate                    ;locate buffer

    acall   check_receive_buffer    ;if so, get one

    mov     a,s_queue_ptr           ;are there any more messages to transmit?

    jnz     send_serial             ;if so, jump

    clr     s_info_mode             ;else clear info mode flag

    mov     tbs,a                   ;and clear transmit registers

    mov     tbl,a                   ;

ed_vec:

    jbc     s_set_rts,rts_vec       ;if rts needs setting, jump

    ajmp    event_detect            ;and go wait on event

rts_vec:

    setb    rts                     ;set rts siu bit

    ajmp    event_detect



send_serial:

    mov     r0,a                    ;r0 => msg. to be transmitted

    acall   send_serial_slave_reply ;transmit message pointed to by acc

    sjmp    ed_vec                  ;and go wait on event
 


check_receive_buffer:

; This procedure checks the siu receive register to see if it has a receive

; buffer.  If not, it tries to get one for it.

; Input parms: none

; Upon exit:  acc = 0, if rbs = 0 and no buffer available

;             else acc = the valid buffer address in rbs

;

    mov     a,rbs               ;see if the receiver needs a buffer

    jnz     grb_exit            ;if not, exit



get_receive_buffer:

; Secondary entry point.  It is assumed here that the receiver does

; not presently have a buffer.

;

    %req_allocate               ;else try to allocate one

    jz      grb_exit            ;if none available, exit

    add     a, #message_length_ofs ;else update receive registers with

    mov     rbs,a               ;buffer start address and buffer length        

    mov     rbl,buf_size        ;

grb_exit:

    ret                         ;return



END

⌨️ 快捷键说明

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