Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/cex/cextim.m11
There are no other files named cextim.m11 in the archive.
	.TITLE	CEXTIM - Comm/Exec Timer Services
	.IDENT	/003070/
	.ENABL	LC

;
;                    COPYRIGHT (c) 1980, 1981, 1982
;                    DIGITAL EQUIPMENT CORPORATION
;                        Maynard, Massachusetts
;
;     This software is furnished under a license and may  be  used
;     and copied only in accordance with the terms of such license
;     and with the inclusion of the above copyright notice.   This
;     software  or any other copies thereof may not be provided or
;     otherwise made available to any other person.  No  title  to
;     and ownership of the software is hereby transferred.
;
;     The information  in  this  software  is  subject  to  change
;     without  notice  and should not be construed as a commitment
;     by DIGITAL EQUIPMENT CORPORATION.
;
;     DIGITAL assumes no responsibility for the use or reliability
;     of  its  software  on  equipment  which  is  not supplied by
;     DIGITAL.
;

;++
; FACILITY: MCB Communications Executive
;
; FUNCTIONAL ABSTRACT:
;
;	This module contains the routines to handle timer service requests.
;
; ENVIRONMENT: RSX kernel mode with EIS
;
; AUTHOR: Alan D. Peckham, CREATION DATE: 21-MAR-80
;
; MODIFIED BY:
;
;	Alan D. Peckham, 2-Jul-80: VERSION 3.0
; 01	- Change CRSH$ references to CRSH$S.
; 02	- Macroize references to APR6 mapping
; 03	- Update CRSH$S contexts.
;	Alan D. Peckham, 9-Dec-80: VERSION 3.1
; 04	- All LIX, PIX bytes refer to data base indices.
;	  Rename ZF.TIM to ZF.LTM.
;	  Merge $DDSTM, $DLSTM, $LLSTM into STM.
;	Alan D. Peckham, 30-Jan-80: VERSION 3.2
; 05	- Support .CRPDB current process descriptor.
;	  Add data base timer enable/disable.
; 06	- Remove LLC timer support.
; 07	- Fix short timer determination and expand to include
;	  time unit specifier.
;--
	.SBTTL	DECLARATIONS

;
; INCLUDE FILES:
;

	.MCALL	CLKDF$,CRSH$S
	.GLOBL	$CLINS,$CLRMV,$TKPS

;
; MACROS:
;
;	None
;
; EQUATED SYMBOLS:
;

	CLKDF$			; RSX clock queue symbol definitions.

;
; OWN STORAGE:
;

	.GLOBL	.TIMDS		; Address of timer handler.

;
	.SBTTL	$LTMDS - Disable Database Timer
;++
; FUNCTIONAL DESCRIPTION:
;
;	Disable the data base timer.
;
; CALLING SEQUENCE:
;
;	CALL	$LTMDS
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	None
;--

	.PSECT	$CODE$,I,RO
$LTMDS::PLVL$			; Crash if not at process level.
	PUSH$S	R1
	MOV	.CRPDB,R1	; Get process descriptor
	BIC	#ZF.DTM,Z.FLG(R1) ; to disable timer.
	POP$S	R1
	RETURN
	.SBTTL	$LTMEN - Enable Database Timer
;++
; FUNCTIONAL DESCRIPTION:
;
;	Enable the data base timer.
;
; CALLING SEQUENCE:
;
;	CALL	$LTMEN
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	None
;--

	.PSECT	$CODE$,I,RO
$LTMEN::PLVL$			; Crash if not at process level.
	PUSH$S	R1
	MOV	.CRPDB,R1	; Get process descriptor
	BIS	#ZF.DTM,Z.FLG(R1) ; to enable timer.
	POP$S	R1
	RETURN
	.SBTTL	$STMCN - Cancel short timer
;++
; FUNCTIONAL DESCRIPTION:
;
;	Cancel the specified short timer.
;
; CALLING SEQUENCE:
;
;	CALL	$STMCN
;
; INPUT PARAMETERS:
;
;	R4 = Address of timer block.
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	None
;--

	.PSECT	$CODE$,I,RO
$STMCN::PLVL$			; Crash if not at process level.

	.IF	NE,D$$BUG
	CMP	T.IDN(R4),R4	; If identifier not block address
	BNE	100$		; then crash.
	.IFTF

	SAV5$S			; Get room to move
	PUSH$S	R0
	MOV	R4,R5		; Set timer ID,
	MOV	#C.SYST,R4	; request type,
	CALL	$CLRMV		; and tell RSX to cancel them.
	POP$S	R0
	RETURN

	.IFT
100$:	CRSH$S	TMB		; Invalid timer block identifier
	.ENDC
	.SBTTL	$STMRQ - Start short timer
;++
; FUNCTIONAL DESCRIPTION:
;
;	Schedule a short timer for the current process.
;
; CALLING SEQUENCE:
;
;	CALL	$STMRQ
;
; INPUT PARAMETERS:
;
;	R4 = Timer block containing:
;	    T.TIM	timer interval in milliseconds.
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	None
;--

	.PSECT	$CODE$,I,RO
$STMRQ::PLVL$			; Crash if not at process level.

	.IF	DF,D$$BUG
	TSTB	T.UNT(R4)
	BEQ	10$
	CMPB	#TU.SEC,T.UNT(R4)
	BNE	100$
	.IFTF

10$:	MOV	.CRPDB,T.PDB(R4) ; Set process descriptor,
	MOV	R4,T.IDN(R4)	; timer identifier,
	MOV	.TIMDS,C.SUB(R4) ; and service routine address
	BEQ	90$		; (if there is one).
	SAV5$S			; Get room to move...
	PUSH$S	<R0,@#KISAR5>
	MOV	T.TIM(R4),R2	; Get time interval
	TSTB	T.UNT(R4)	; If in seconds
	BEQ	20$		; then
	MUL	$TKPS,R2	; this many ticks.
	MOV	R3,R2
	BR	70$
20$:	MUL	$TKPS,R2	; convert to number of ticks
	DIV	#1000.,R2	; from milliseconds.
60$:	TST	R3		; If remainder,
	BEQ	70$		; then
	INC	R2		; round up.
70$:	CLR	R1		; Set high order time.
	MOV	R4,R0		; Clock queue entry address.
	MOV	#C.SYST,R4	; Request type
	MOV	T.IDN(R0),R5	; and identifier.
	MOV	@.PDBVB,@#KISAR5 ; Set mapping to CEX process,
	CALL	$CLINS		; tell RSX to queue it up.
	POP$S	<@#KISAR5,R0>
90$:	RETURN

	.IFT
100$:	CRSH$S	TMU		; Invalid time unit
	.ENDC

	.END