Motorola DSP56305 Manuel d'utilisateur Page 39

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 112
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 38
3-10 Optimizing DSP56300/DSP56600 Applications MOTOROLA
Program Control
Task Switching with the Stack Extension
3.4 TASK SWITCHING WITH THE STACK
EXTENSION
A multi-tasking operating system using the stack extension should
ensure stack coherence when switching from one task to the other.
Here is a possible task switching scenario:
1. During the execution of the task “T1”, a “time-out” interrupt
occurs indicating the need to replace the active task with task
“T2”. The PC and SR of T1 task are pushed onto the stack by
the JSR instruction of the interrupt vector area.
2. The JSR gives control to the Operating System that must now
execute the task switching. First, all the registers are saved in
the register area of task T1:
movec r7,x:OS_temp ;save r7 in order to
;use is later
move #T1_task_reg_area,r7 ;Load pointer.
move x0,x:(r7)+ ;Save registers...
....
move r6,x:(r7)+ ;Save registers...
move x:OS_temp,r0 ;Pull r7
move r0,x:(r7)+ ;Save r7
move n0,x:(r7)+ ;Save n0
move n1,x:(r7)+ ;Save n1
....
move lc,x:(r7)+
move la,x:(r7)+
3. At this point, all the registers were saved as a mirror of the T1
task, but the stack has some data in it that belongs to the T1
task, as well. This data should also be copied to some
memory area reserved for that information by the operating
system.
;Stack saving:
move sc,x:(r7)+ ;Save SC
;The next 14 pushes ensure that all the current entries in the
;hardware stack will be automatically saved in the
;stack extension memory:
rep #14
move #dummy,ssh
;After these moves are executed, all the hardware stack is stored
;in the memory extension stack area, and the pointers EP and SP
;are updated, so they should be saved:
move sp,x:(r7)+ ;Save SP
move ep,x:(r7)+ ;Save EP.
4. After all task T1 programming model have been saved, the
Operating System chooses the task T2 as the next task to run.
Vue de la page 38
1 2 ... 34 35 36 37 38 39 40 41 42 43 44 ... 111 112

Commentaires sur ces manuels

Pas de commentaire