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

📄 dcm44s.a51

📁 8051实时操作系统
💻 A51
📖 第 1 页 / 共 2 页
字号:
$title (iDCM 44 Communications Firmware: Serial Handler Module)
$date (8 August 86)
$nomo
$paging
$registerbank (0)

;***************************************************************************
;*
;*     TITLE:          iDCM 44 Communications Firmware: Serial Handler 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    dcm44s


using 0


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


PUBLIC  init_serial, serial_interrupt_check, send_serial

PUBLIC  send_serial_slave_reply, initiate_order_transmission


PUBLIC  s_station_mode, s_timeout_set, s_timeout_count, s_init_mode

PUBLIC  s_info_mode, s_poll_mode, i_blocked_flag, x_parallel_enabled

PUBLIC  s_set_rts

PUBLIC  s_queue_ptr, s_station_state, s_station_poll, s_poll_queue_in

PUBLIC  s_poll_queue_out, s_last_nsnr, buf_size, s_timeout_val

EXTRN   CODE    (event_detect, serial_gateway_switch)
EXTRN   CODE    (auto_information_frame_check, check_receive_buffer)
EXTRN   CODE    (non_auto_master_rcv, non_auto_slave_rcv)

EXTRN   CODE    (swap_station_states)



EXTRN   DATA    (req_next_buffer, rqbufsize)


DCMFW_CODE_SEG          SEGMENT CODE
DCMFW_BIT_SEG           SEGMENT DATA    BITADDRESSABLE
DCMFW_INT_SEG           SEGMENT DATA

DCMFW_INT1_SEG          SEGMENT DATA
DCMFW_EXT_SEG           SEGMENT XDATA
DCMFW_STATION_SEG       SEGMENT XDATA   INPAGE
DCMFW_POLL_SEG          SEGMENT XDATA   INPAGE

RSEG                    DCMFW_BIT_SEG

s_station_ops:          ds      1

    s_station_mode      bit     s_station_ops.s_station_mode_bpos
    s_timeout_set       bit     s_station_ops.s_timeout_set_bpos
    s_timeout_count     bit     s_station_ops.s_timeout_count_bpos

    s_set_rts           bit     s_station_ops.s_timeout_count_bpos
    s_init_mode         bit     s_station_ops.s_init_mode_bpos
    s_info_mode         bit     s_station_ops.s_info_mode_bpos
    s_poll_mode         bit     s_station_ops.s_poll_mode_bpos
    i_blocked_flag      bit     s_station_ops.I_blocked_flag_bpos
    x_parallel_enabled  bit     s_station_ops.X_parallel_enabled_bpos


DSEG AT 2AH      



user_reserved:          ds      6     ;reserved 2ah - 2fh for user



RSEG                    DCMFW_INT_SEG

s_queue_ptr:            ds      1
s_poll_queue_in:        ds      1
s_poll_queue_out:       ds      1
s_last_nsnr:            ds      1

buf_size:               ds      1



RSEG                    DCMFW_INT1_SEG



s_timeout_val:          ds      1


RSEG                    DCMFW_STATION_SEG

s_station_state:        ds      256


RSEG                    DCMFW_POLL_SEG

s_station_poll:         ds      256

RSEG                    DCMFW_CODE_SEG

$EJECT
;***************************************************************************
;*
;*     PROCEDURE:      init_serial
;*
;*     PURPOSE:        Initialize SIU H/W and serial S/W
;*
;*     CALLED FROM:    comm_task
;*
;*     ENTERED FROM:   None
;*
;*     CALLS:          None
;*
;*     ENTERS:         None
;*
;*     INPUTS:         None
;*
;*     RETURNS:        Nothing
;*
;*     DESCRIPTION:    Init_Serial sets up the SIU for the configured
;*                     BITBUS attributes. If the timer is involved, it is
;*                     configured also.  It then initializes the serial

;*                     S/W data structures.

;*
;***************************************************************************

init_serial:
        mov     sts,#00000010b                ;init sts to am=1,rest=0

        mov     dptr, #g_station_mode_cfg     ;read the mode port      
        movx    a, @dptr
        anl     a, #bitbus_mode_msk           ;check the bitbus mode
        mov     dptr, #ish_bitbus_type_branch ;
        movc    a, @a+dptr
        jmp     @a+dptr                       ;jump to proper type

ish_bitbus_type_branch:
        db      ish_bitbus_ext_type - ish_bitbus_type_branch
        db      ish_bitbus_375K_type - ish_bitbus_type_branch
        db      ish_bitbus_187K_type - ish_bitbus_type_branch
        db      ish_bitbus_62K_type - ish_bitbus_type_branch

ish_bitbus_ext_type:
        mov     smd, #smd_bitbus_ext_msk        ;Set for External Bitbus mode
        sjmp    init_serial_sw                  ;Go initialize serial S/W

ish_bitbus_375K_type:
        mov     smd, #smd_bitbus_375k_msk       ;Otherwise set for 375K operation
        sjmp    init_serial_sw                  ;Go initialize serial S/W

ish_bitbus_187K_type:
        mov     smd, #smd_bitbus_187k_msk       ;Otherwise set for 187K operation
        sjmp    init_serial_sw                  ;Go initialize serial S/W

ish_bitbus_62K_type:
        mov     th1, #timer_count_msk           ;Set timer count for one (62.5K)

        mov     smd, #smd_bitbus_62k_msk        ;Set for 62K operation
        orl     tmod, #timer_mode_msk           ;Set timer mode
        setb    tr1                             ;Enable timer 1

init_serial_sw:

        clr     a

;       mov     s_queue_ptr, a                  ;clear message queue
        mov     s_station_ops, a                ;clear all mode flags
        mov     rbs, a                          ;
        mov     rbl, a                          ;
        mov     tbs, a
        mov     tbl, a

        mov     buf_size,rqbufsize              ;init buf_size variable

        dec     buf_size                        ;

        dec     buf_size                        ;

        mov     s_timeout_val,#bitbus_response_max ;init serial timeout val
        mov     dptr, #g_station_address_cfg
        movx    a, @dptr                        ;get the configured station address
        mov     stad, a                         ;  and set SIU receive address to it
        setb    rbe                             ;Turn on the SIU to receive
        ret                                     ;done

$EJECT
;***************************************************************************
;*
;*     ENTRY:          serial_interrupt_check
;*
;*     PURPOSE:        first stage decode of serial interrupt
;*
;*     ENTERED FROM:   event_detect
;*
;*     ENTERS:         auto_information_frame_check
;*                     non_auto_slave_rcv          

;*                     non_auto_master_rcv         
;*                     event_detect 
;*
;*     CALLS:          None
;*
;*     INPUTS:         None
;*
;*     RETURNS:        None

⌨️ 快捷键说明

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