📄 dcm44r.a51
字号:
$TITLE (iDCM 44 COMMUNICATIONS FIRMWARE: RAC TASK MODULE)
$DATE (8 AUGUST 86)
$NOMO
$PAGING
$REGISTERBANK (0)
;***************************************************************************
;*
;* TITLE: iDCM 44 COMMUNICATIONS FIRMWARE: RAC TASK MODULE
;*
;* RELEASE: 2.0
;* 2.1 -- Changed to coincide with iDCX R2.1.
;*
;* DESCRIPTION: THIS MODULE CONTAINS THE RAC TASK 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 DCM44R
USING 0
$nolist
$include(reg44.pdf)
$include(dcm44c.lit)
$include(r2sys.mac)
$include(dcm44m.a51)
$list
public process_rac_cmd
extrn code (local_gateway_switch, reqcreatetask, reqdeletetask)
extrn code (reqgetfunctionids, reqreleasemem, rqsystemstart)
extrn code (set_slave_offline)
extrn data ( rqbufsize )
dcmfw_code_seg segment code
dcmfw_bit_seg segment data bitaddressable
dcmfw_ext_seg segment xdata
rseg dcmfw_bit_seg
extrn bit ( s_station_mode)
public c_station_ops, c_protect_mode
c_station_ops: ds 1
c_protect_mode bit c_station_ops.c_protect_mode_bpos
rseg dcmfw_ext_seg
public c_save_msg_ptr
c_save_msg_ptr: ds 1
rseg dcmfw_code_seg
$eject
;***************************************************************************
;*
;* ENTRY: process_rac_cmd
;*
;* PURPOSE: handle remote access and control commands
;*
;* CALLED FROM: None
;*
;* ENTERED FROM: send_local
;*
;* CALLS: None
;*
;* ENTERS: local_gateway_switch (msg_ptr in R0)
;* rqsystemstart: reset
;*
;* INPUTS: message pointer in R0
;* C_Protect_Mode
;*
;* RETURNS: None, jump to Local_Gateway_Switch, or RAC procedure
;*
;* DESCRIPTION: Procedure begins by setting the Message Type bit to
;* a Reply for return. Then the Message Command is
;* checked to see if it is a supported code. If not,
;* the message is returned, via send_local with an
;* error. Otherwise, C_Protect_Mode is checked to see
;* if it has been set to stop access types of commands.
;* If so, the Message Command is checked to see if
;* it falls within the access category. If it does,
;* the message is returned.
;*
;* Otherwise, the number of data (non-header) bytes
;* in the message is computed. If the result is
;* zero, the message is returned. Otherwise, result is
;* put in R7, the result divided by 2 is put in R6,
;* and a pointer to the start of the data
;* area is put in R1. Then a jump is computed to the
;* appropriate handler for the command and executed.
;*
;***************************************************************************
c_jmp_base:
ajmp c_reset_device ;rac command 0
ajmp c_create_tsk ;rac command 1
ajmp c_delete_tsk ;rac command 2
ajmp c_get_fn_id ;rac command 3
ajmp c_protect_rac ;rac command 4
ajmp c_ext_read_io ;rac command 5
ajmp c_ext_write_io ;rac command 6
ajmp c_ext_update_io ;rac command 7
ajmp c_upload_data ;rac command 8
ajmp c_dnload_data ;rac command 9
ajmp c_ext_OR_io ;rac command A
ajmp c_ext_AND_io ;rac command B
ajmp c_ext_XOR_io ;rac command C
ajmp c_int_write ;rac command D
ajmp c_int_read ;rac command E
ajmp c_node_info ;rac command F
ajmp c_offline ;rac command 10
ajmp c_upload_code ;rac command 11
ajmp c_dnload_code ;rac command 12
process_rac_cmd:
%set_msg_ptr(message_route_ofs) ;set message type to reply
mov a,#reply_msk ;
orl a,@r1 ;
mov @r1,a ;
%set_msg_ptr(message_command_ofs) ;check for valid rac
mov b,#e_unknown_rac_command ; preset reply status for error
%jlt(#max_rac_command_val,@r1,c_error_return)
; Look at the number of bytes of data in the message. If there are none,
; do nothing, else record the data field length in r7
;
mov b,r1 ;Save Command Address
%set_msg_ptr(message_length_ofs) ;
mov a,@r1 ;a = message length
mov r1,b ;Restore Command Address
mov b,#e_service_ok ;preset reply for SERVICE$OK
%jle(A,#message_header_size,c_error_return) ;if no data area, return
mov r7,a ;r7 = data area length
; For i/o commands, cache the number of accesses (data bytes/2) in r6
; The size of each i/o access is 2.
;
clr c ;
rrc a ;
mov r6,a ;
; Vector to the code to process the command number in @r1
;
mov b,@r1 ;save command in b
mov @r1,#e_service_ok ;preset response
%set_msg_ptr(message_data_ofs) ;r1 = data area base addr
mov a,b ;a = command
rl a ;a = offset into jump table
mov dptr,#c_jmp_base ;dptr => jump table base
jmp @a+dptr ;jump to appropriate jump vector
c_error_return:
; Error return routine
; Inputs: b = msg. reply status
; r1 => message.command/reply
;
mov a,b ;place error in msg. reply field
mov @r1,a ;
ajmp local_gateway_switch ;and return msg. to sender
;---------------------------------------------------------------------------
;
; Entry Point: ext_read_io
;
; Purpose: read bytes of external memory and return message
;
; Entered From: process_rac_cmd
;
; Calls: none
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
; data count in R6
;
; Returns: None
;
; Description: Computes number of read requests, reads the
; specified external memory locations, and
; returns the results in the reply message.
;
;---------------------------------------------------------------------------
c_ext_read_io:
jb c_protect_mode,p_error_return ;if rac protect is in effect
mov a,r6 ;if no data to read, exit
jz c_ext_read_io_exit ;
mov dph,#ext_io_page ;dph => i/o area
c_ext_read_io_loop:
mov dpl,@r1 ;dptr => abs. i/o address
inc r1 ;read i/o byte into message
movx a,@dptr ;
mov @r1,a ;
inc r1 ;r1 => next i/o offset addr.
djnz r6,c_ext_read_io_loop ;check for more itemsx
c_ext_read_io_exit:
ajmp local_gateway_switch ;return message
;---------------------------------------------------------------------------
;
; Entry Point: ext_write_io
;
; Purpose: write bytes of external memory and return message
;
; Entered From: process_rac_cmd
;
; Calls: none
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
; data count in R6
;
; Returns: None
;
; Description: Computes number of write requests, writes the
; specified external memory locations, and
; returns the results in the reply message.
;
;---------------------------------------------------------------------------
c_ext_write_io:
jb c_protect_mode,p_error_return ;if rac protect is in effect
mov a,r6 ;if no data to write, exit
jz c_ext_write_io_exit ;
mov dph,#ext_io_page ;dph => i/o area
c_ext_write_io_loop:
mov dpl,@r1 ;dptr => abs. i/o address
inc r1 ;write next i/o byte from msg.
mov a,@r1 ;
movx @dptr,a ;
inc r1 ;r1 => next i/o offset addr.
djnz r6,c_ext_write_io_loop ;check for more items
c_ext_write_io_exit:
ajmp local_gateway_switch ;return message
;---------------------------------------------------------------------------
;
; Entry Point: ext_update_io
;
; Purpose: update bytes of external memory and return message
;
; Entered From: process_rac_cmd
;
; Calls: none
;
; Enters: local_gateway_switch (msg_ptr in R0)
;
; Inputs: message pointer in R0
; data pointer in R1
; data count in R6
;
; Returns: None
;
; Description: Computes number of update requests, updates the
; specified external memory locations, and
; returns the results in the reply message.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -