Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
46
Добавлен:
27.04.2015
Размер:
4.26 Mб
Скачать

Software Techniques

8.10.1.3 Many Instructions and Programmable Priorities

For ISRs that require a significant number of instruction cycles to complete, it is possible for the user to still program interrupt priorities in software. This is shown in the following generic ISR.

; Generic ISR - DSP56800 core (20 Overhead Cycles)

 

JSR

ISR

; Instr located in Interrupt Vector Table

;

(instructions)

 

ISR

LEA

(SP)+

; ISR

 

 

 

MOVE

N,X:(SP)+

; Save “N” register for usage by ISR

 

MOVE

X:IPR,N

; Save interrupted task’s IPR

 

MOVE

N,X:(SP)

 

 

MOVE

#xxxx,X:IPR

; Load new mask - defines which can interrupt

 

 

 

; this ISR

 

BFCLR

#$0200,SR

; Re-enable interrupts with new mask

;(interrupt code)

POP

N

; Restore interrupted task’s IPR

MOVE

N,X:IPR

 

POP

N

; Restore saved register used by ISR

RTI

 

 

8.10.2 Hardware Looping in Interrupt Routines

Since an interrupt can occur at any location in a program, it is possible that the HWS used by hardware DO loops may already be full. If an ISR needs to use the DO looping mechanism, it may be necessary to free up one location in the HWS. This can be done using the technique outline in Section 8.12, “Freeing One Hardware Stack Location.” Alternatively, if it can be guaranteed that the main program will never use more than one DO loop at a time (that is, no nested loops), it may then be possible for an ISR to simply use hardware DO loops without using this technique to free up a stack location.

8.10.3 Identifying System Calls by a Number

In operating systems, system calls are often made by using an SWI instruction when a user’s task needs assistance from the operating system. Usually, it is useful to have several different types of system calls, each identified with a number. The following code shows how system calls can have an associated number when an SWI instruction is executed.

MOVE

#xx,N

; Put number associated with system call in N reg

PUSH

N

; Push this value on the stack so accessible by O/S

SWI

 

; Generate interrupt to return to O/S

8-32

DSP56800 Family Manual

 

Соседние файлы в папке DSP568xx