27. Triggering SWI or TSK SWI cannot pend. SWI always returns from function. TSK only returns when no longer needed, otherwise normally an infinite loop. SWI start end SWI_post “ run to completion” TSK SEM_pend start end block SEM_post
28.
29. Thread Preemption Example HWI SWI 2 SWI 1 IDL main() TSK 2 TSK 1 Events over time interrupt pend sem2 return interrupt interrupt pend sem2 pend sem1 interrupt return return post swi1 return post swi2 return post sem2 return post swi2 return post sem1 post sem2 return pend sem2 pend sem1
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43. Putting it all together… void main (void) { /* Put all your setup code here */ return; /*DSP BIOS starts after the return */ } /* Hardware Interrupt */ void timerIsr (void) { /* Put your code here */ SWI_post (&SWI_for_algorithm_1); SEM_post (&taskOneSem); } /*Software Interrupt */ void algorithm_1 (void) { /* Put your code here */ } /* Task */ void ProcessTask (void) { while (1) { SEM_pend (&taskOneSem, SYS_FOREVER); /* Insert your code here */ } }
44. Putting it all together… void main (void) { /* Put all your setup code here */ return; /*DSP BIOS starts after the return */ } /* Hardware Interrupt */ void timerIsr (void) { /* Put your code here */ SWI_post (&SWI_for_algorithm_1); SEM_post (&taskOneSem); } /*Software Interrupt */ void algorithm_1 (void) { /* Put your code here */ } /* Task */ void ProcessTask (void) { while (1) { SEM_pend (&taskOneSem, SYS_FOREVER); /* Insert your code here */ } }
45. Putting it all together… See example located in: … Chapter 04 - DSP BIOSios_Lab2ios_lab_2.pjt
68. DSP/BIOS Feature Summary Features Benefits Easy to use Saves development time Small Footprint (<2Kw) Easily fits in limited memory systems Fast Execution Ideal for real time systems Real-Time Analysis View system parameters while system is executing without breakpoints and without additional overhead - “Test what you fly and fly what you test” Set of Library Functions Use only what you need to minimize footprint Extensible Full featured kernel allows additional OS functions in future