• Aucun résultat trouvé

.HRESET Errors:

Dans le document RT–11 System Macro Library Manual (Page 191-195)

Programmed Request Description and Examples

.HRESET Errors:

None.

.INTEN

Macro Expansion

Interrupt service routines use .INTEN:

• To notify the monitor that an interrupt has occurred and to switch to system state.

• To set the processor priority to the correct value.

• To save the contents of R4 and R5 before returning to the Interrupt Service Routine. Any other registers must be saved by the routine.

Macro Call:

.INTEN prio[,pic]

where:

prio is the processor priority at which the interrupt routine is to run, normally the priority at which the device requests an interrupt pic is an optional argument that should be non-blank if the interrupt

routine is written as a PIC (position-independent code) routine. Any interrupt routine written as a device handler must be a PIC routine and must specify this argument

.INTEN issues a subroutine call to the monitor and does not use an EMT instruction request.

All external interrupts must cause the processor to go to priority level 7. .INTEN is used to lower the priority to the value, at which point the device should be run.

On return from .INTEN, the device interrupt can be serviced, at which point the interrupt routine returns with a RETURN instruction.

NOTE

An RTI instruction should not be used to return from an interrupt routine that uses an .INTEN.

Errors:

None.

.INTEN

Example:

.TITLE EINTEN.MAC

;+

; DL11.MAC - This is an example in the use of the .INTEN request.

; The example is an in-line, interrupt service routine, which may

; be assembled separately and linked with a mainline program.

; The routine transfers data from a user specified buffer to a DL11

; Serial Line Interface.

;

; CALLING FORMAT: JSR R5,DL11 ;Initiate Output

; .WORD wordcount ;# words to transfer

; .WORD BUFFER ;Address of Data Buffer

; .

; .

; BUFFER: .BLKW wordcount

;-.MCALL .INTEN

DLVEC = 304 ;DL11 Vector ***

DLCSR = 176504 ;DL11 OUTPUT CSR ***

DLPRI = 4 ;DL11 Priority for RT-11

DL11:: MOV (R5)+,(PC)+ ;I/O Initiation - Get word count WCNT: .WORD 0

MOV (R5)+,(PC)+ ;Get address of Data Buffer BUFAD: .WORD 0

ASL WCNT ;Make word count byte count

BEQ 1$ ;Just leave if zero word count

MOV #DLINT,@#DLVEC ;Initialize DL11 interrupt vector BIS #100,@#DLCSR ;Enable interrupts

1$: RTS R5 ;Return to caller

DLINT: .INTEN DLPRI ;Interrupt service - Notify RT-11

;and drop priority to that of DL11 MOVB @BUFAD,@#DLCSR+2 ;Transfer a byte

INC BUFAD ;Bump buffer pointer

DEC WCNT ;All bytes transferred?

BEQ DLDUN ;Branch if yes

RETURN ;No return from interrupt thru RT-11

DLDUN: BIC #100,@#DLCSR ;All done - disable DL11 interrupts

RETURN ;Return thru RT-11

.END

.LOCK/.UNLOCK

.LOCK: EMT 346 .UNLOCK: EMT 347

.LOCK

The .LOCK request keeps the USR in memory to provide any of its services required by your program. A .LOCK inhibits another job from using the USR.

Macro Call:

.LOCK

The .LOCK request reduces time spent in file handling by eliminating the swapping of the USR in and out of memory. The .LOCK request keeps other jobs from using the USR while it is in use and loads USR into memory if it is not already in memory.

Under mapped monitors, USR is always in memory.

.LOCK causes the USR to be read into memory or swapped into memory. If all the conditions that cause swapping are satisfied, the part of the user program over which the USR swaps is written into the system swap blocks (the file SWAP.SYS) and the USR is loaded. Otherwise, the copy of the USR in memory is used, and no swapping occurs. (Note that certain calls always require a fresh copy of the USR.) The .LOCK/.UNLOCK requests are complementary and must be matched. That is, if you have issued three .LOCK requests, you must issue at least three .UNLOCK requests. You can issue more .UNLOCK requests than .LOCK requests without error.

Calling the CSI or using a .GTLIN request can also perform an implicit and temporary .UNLOCK.

Notes

• Do not put executable code or data in the area occupied by the USR while it is locked, because you can’t access the area until an .UNLOCK is issued. When USR has swapped over, the return from the .LOCK request is to the USR itself, rather than to the user program, In this way, the .LOCK function inhibits the user program from being re-read.

• Once a .LOCK has been performed, it is not advisable for the program to destroy the area occupied by the USR, even if no further use of the USR is required, because this causes unpredictable results when an .UNLOCK is done.

• If a foreground job performs a .LOCK request while the background job owns the USR, foreground execution is suspended until the USR is available. In this case, it is possible for the background to lock out the foreground. (See the .TLOCK request.)

Errors:

.LOCK/.UNLOCK Example:

Refer to the example for the .UNLOCK request.

.UNLOCK

The .UNLOCK request releases the User Service Routine (USR) from memory if it was placed there with a .LOCK request. If the .LOCK required a swap, the .UNLOCK loads the user program back into memory. There is a .LOCK count. Each time the user program does a .LOCK, the lock count is incremented. When the user does an .UNLOCK, the lock count is decremented. When the lock count goes to 0, the user program is swapped back in.

Macro Call:

.UNLOCK

Dans le document RT–11 System Macro Library Manual (Page 191-195)