44
Chapter 7 Chapter 7 DSP/BIOS” DSP/BIOS”

04a Dsp Bios

Embed Size (px)

Citation preview

Page 1: 04a Dsp Bios

Chapter 7Chapter 7““DSP/BIOS”DSP/BIOS”

Page 2: 04a Dsp Bios

““DSP/BIOS”DSP/BIOS” Real-time SchedulingReal-time Scheduling

Simple example of real-time problemSimple example of real-time problem HWI, SWI, and TSKHWI, SWI, and TSK SchedulerScheduler DSP/BIOS II adds multi-tasking DSP/BIOS II adds multi-tasking

Real-time analysis (RTA)Real-time analysis (RTA)

Page 3: 04a Dsp Bios

TI DSPTI DSP

New System Requirement - AbstractNew System Requirement - Abstract

DTMFDTMF

FilterFilter Previous RequirementPrevious Requirement DSP filters audio signalDSP filters audio signal

New RequirementNew Requirement Add DTMF functionAdd DTMF function DTMF is independent of filterDTMF is independent of filter Issues:Issues:

Do we have enough bandwidth (MIPS)?Do we have enough bandwidth (MIPS)? Will one routine conflict with the other?Will one routine conflict with the other? How do we create the compound system?How do we create the compound system?

Page 4: 04a Dsp Bios

System Implementation ConsiderationsSystem Implementation Considerations

DTMFDTMFFilterFilter

mainmain{{while(1)while(1){{

}}}}

One method: put each algo into One method: put each algo into an endless loop under mainan endless loop under main

Problems:Problems: What if algorithms run at What if algorithms run at

differing rates? differing rates? (eg: our filter runs ~ 44 KHz (eg: our filter runs ~ 44 KHz and the DTMF algo ~ 8 KHz)and the DTMF algo ~ 8 KHz)

What if one algorithm What if one algorithm overshadows another, overshadows another, starving it for recognition or starving it for recognition or delaying it’s response beyond delaying it’s response beyond the limits of the system?the limits of the system?

Page 5: 04a Dsp Bios

Interrupt Driven SystemInterrupt Driven System

TI DSPTI DSP

mainmain{{while(1);while(1);

}}

Timer1_ISRTimer1_ISR{{

}}

Timer2_ISRTimer2_ISR{{

}}BB

AA

The choice of most designers:The choice of most designers:Put each routine in it’s own ISRPut each routine in it’s own ISR

Page 6: 04a Dsp Bios

Interrupt Driven SystemInterrupt Driven System

AArunningrunning

idleidle

TimeTime 11 22 33 5544 66 7700

BB

Only one can run at a time...Only one can run at a time...TI DSPTI DSP

mainmain{{while(1);while(1);

}}

Timer1_ISRTimer1_ISR{{

}}

Timer2_ISRTimer2_ISR{{

}}BB

AA

PeriodPeriod ComputeCompute CPU UsageCPU UsageRoutine Routine AA:: 22 22 ss 11 11 ss (50%)(50%)Routine Routine BB:: 125 125 ss 33 33 ss (26%)(26%)

76%76%

Page 7: 04a Dsp Bios

Interrupt Driven System - ProblemInterrupt Driven System - Problem

PeriodPeriod ComputeCompute CPU UsageCPU UsageRoutine Routine AA:: 22 22 ss 11 11 ss (50%)(50%)Routine Routine BB:: 125 125 ss 33 33 ss (26%)(26%)

76%76%

TimeTime 11 22 33 5544 66 7700

BB

AArunningrunning

idleidleyy11 yy22 yy33 yy44

Missed !Missed !

TI DSPTI DSP

mainmain{{while(1);while(1);

}}

Timer1_ISRTimer1_ISR{{

}}

Timer2_ISRTimer2_ISR{{

}}BB

AA

There are There are twotwo elements of CPU loading: elements of CPU loading: average & instantaneousaverage & instantaneous

Page 8: 04a Dsp Bios

Nested InterruptsNested InterruptsA common solution is to allow hardware A common solution is to allow hardware interrupts to preempt each other - called interrupts to preempt each other - called 'nesting''nesting' interrupts interrupts

Problem is, the user must handle all context Problem is, the user must handle all context save and restoresave and restore

While reasonable for 1-2 interrupts, it While reasonable for 1-2 interrupts, it becomes tedious and trouble-prone for morebecomes tedious and trouble-prone for more

Can become near impossible when using Can become near impossible when using object-coded algorithms or libraries object-coded algorithms or libraries (thus, making it difficult to purchase algo's)(thus, making it difficult to purchase algo's)

DSP/BIOS handles this for you with simple DSP/BIOS handles this for you with simple drag -n- drop editingdrag -n- drop editing

TI DSPTI DSP

mainmain{{while(1);while(1);

}}

Timer1_ISRTimer1_ISR{{

}}

Timer2_ISRTimer2_ISR{{

}}BB

AA

AArunningrunning

idleidle

TimeTime 11 22 33 5544 66 7700

BB

Page 9: 04a Dsp Bios

Interrupt Driven State MachinesInterrupt Driven State MachinesTo solve this scheduling problem, you could To solve this scheduling problem, you could build a complicated state-machine in your build a complicated state-machine in your main( ) routine. main( ) routine. mainmain

{{if tick>set1if tick>set1 if …if …

else if else if if …if …

else if ...else if ...

else …else …

......}}

B (part 1)B (part 1)

AA

B (part 2)B (part 2)

B (part 3)B (part 3)

Difficult and tedious to write Difficult and tedious to write - Need to keep - Need to keep track of various execution times and paths track of various execution times and paths through softwarethrough software

Difficult to maintain Difficult to maintain - Code is too tightly coupled - Code is too tightly coupled to allow any changes or updatesto allow any changes or updates

Can be slow and large Can be slow and large - Conditional - Conditional statements lead to branching operations and statements lead to branching operations and disruptions in normal software flowdisruptions in normal software flow

TimeTime 11 22 33 5544 66 7700

BB BB11 BB22 BB33

AArunningrunning

idleidleyy11 yy22 yy33 yy44

Page 10: 04a Dsp Bios

Hardware-Interrupt Only SchedulingHardware-Interrupt Only Scheduling No or Difficult Interrupt Pre-emptionNo or Difficult Interrupt Pre-emption Unmanaged Interrupt Context SwitchUnmanaged Interrupt Context Switch

C main background functionsC main background functions No Guarantee of ConcurrencyNo Guarantee of Concurrency Non-deterministic timingNon-deterministic timing No Software PreemptionNo Software Preemption Ad Hoc AnalysisAd Hoc Analysis

Real-time Problem SummaryReal-time Problem Summary

Page 11: 04a Dsp Bios

The DSP/BIOS SolutionThe DSP/BIOS Solution

BB

AA

mainmain{{return;return;

}}

DSP/BIOSDSP/BIOS AArunningrunning

idleidle

TimeTime 11 22 33 5544 66 7700

BB

DSP/BIOS provides scheduling:DSP/BIOS provides scheduling: You needn’t build a custom (inflexible) You needn’t build a custom (inflexible)

state-machine for each DSP designstate-machine for each DSP design Instead, you can leverage 1000’s of hours Instead, you can leverage 1000’s of hours

of development, proven in 100’s of systems!of development, proven in 100’s of systems!

Easy to writeEasy to write - Modules written independently - Modules written independentlyEasy to maintainEasy to maintain - Module interaction minimized - Module interaction minimizedBuilt-in SchedulingBuilt-in Scheduling - Managed by DSP/BIOS - Managed by DSP/BIOS

Page 12: 04a Dsp Bios

““DSP/BIOS”DSP/BIOS” Real-time SchedulingReal-time Scheduling

Simple example of real-time problemSimple example of real-time problem HWI, SWI, and TSKHWI, SWI, and TSK SchedulerScheduler DSP/BIOS II adds multi-tasking DSP/BIOS II adds multi-tasking

Real-time analysis (RTA)Real-time analysis (RTA)

Page 13: 04a Dsp Bios

Some TerminologySome Terminology

threadthread independent function -- within it’s own contextindependent function -- within it’s own contextschedulerscheduler system software to manage execution of system software to manage execution of

threadsthreadspreemptionpreemption higher priority thread interrupts thread of higher priority thread interrupts thread of

lower prioritylower prioritypostpost signal an event, or make a thread “ready”signal an event, or make a thread “ready”pendpend test for an event, possibly wait (block)test for an event, possibly wait (block)

What types of threads can we define?What types of threads can we define?How are they scheduled to run?How are they scheduled to run?

Page 14: 04a Dsp Bios

DSP/BIOS Thread TypesDSP/BIOS Thread TypesPr

iorit

yPr

iorit

y

HWIHWIHardware InterruptsHardware Interrupts

Used to implement 'urgent' part of real-time eventUsed to implement 'urgent' part of real-time event Triggered by hardware interruptTriggered by hardware interrupt HWI priorities set by hardwareHWI priorities set by hardware

SWISWISoftware InterruptsSoftware Interrupts

Use SWI to perform HWI 'Use SWI to perform HWI 'follow-upfollow-up' activity' activity SWI's are 'SWI's are 'postedposted' by HWI's or SWI's' by HWI's or SWI's Multiple SWIs at each of 14 priority levelsMultiple SWIs at each of 14 priority levels

IDLIDLBackgroundBackground

Multiple IDL functions Multiple IDL functions Run round-robinRun round-robin

Page 15: 04a Dsp Bios

DSP/BIOS SchedulerDSP/BIOS Schedulerh/w INTh/w INT

HWI:HWI:urgent codeurgent code

post SWIpost SWI

SWI (or TSK)SWI (or TSK)

ints disabledints disabled rather than all this timerather than all this time

read read serial portserial port run filter with new datarun filter with new data

HWIHWI Fast response to interruptsFast response to interrupts Minimal context switchingMinimal context switching High priority onlyHigh priority only Can post SWI or TSKCan post SWI or TSK Danger of missing an Danger of missing an

interrupt while executing ISRinterrupt while executing ISR

SWI or TSKSWI or TSK Latency in response timeLatency in response time Context switch performedContext switch performed Selectable priority levelsSelectable priority levels Can post another SWICan post another SWI Execution managed by Execution managed by

schedulerscheduler

Let’s look at a scheduling example...Let’s look at a scheduling example...

Page 16: 04a Dsp Bios

HWIHWI

SWI 2SWI 2

SWI 1SWI 1

main()main()

IDLIDL

HWI with SWI & IDLHWI with SWI & IDL

interruptinterrupt

returnreturn

returnreturn returnreturnpost swi2post swi2

Skip Slide Animation Skip Slide Animation

returnreturn

returnreturn

interruptinterrupt

post swi1post swi1

Page 17: 04a Dsp Bios

HWI with SWI & IDLHWI with SWI & IDL

HWI

SWI 2

SWI 1

main()

IDL

interrupt

return

return returnpost swi2

return

return

interrupt

post swi1

Page 18: 04a Dsp Bios

SWI PropertiesSWI Properties

Page 19: 04a Dsp Bios

Managing SWI PriorityManaging SWI Priority Drag and Drop SWIs to change Drag and Drop SWIs to change

prioritypriority Equal priority SWIs run round-robinEqual priority SWIs run round-robin

Page 20: 04a Dsp Bios

DSP/BIOS Thread TypesDSP/BIOS Thread TypesPr

iorit

yPr

iorit

y

HWIHWIHardware InterruptsHardware Interrupts

Used to implement 'urgent' part of real-time eventUsed to implement 'urgent' part of real-time event Triggered by hardware interruptTriggered by hardware interrupt HWI priorities set by hardwareHWI priorities set by hardware

SWISWISoftware InterruptsSoftware Interrupts

Use SWI to perform HWI 'Use SWI to perform HWI 'follow-upfollow-up' activity' activity SWI's are 'SWI's are 'postedposted' by HWI's or SWI's' by HWI's or SWI's Multiple SWIs at each of 14 priority levelsMultiple SWIs at each of 14 priority levels

TSKTSKTasksTasks

Use TSK to run different programs concurrently Use TSK to run different programs concurrently under separate contextsunder separate contexts

TSK's are usually enabled to run by setting a flag, TSK's are usually enabled to run by setting a flag, called a 'called a 'semaphoresemaphore''

IDLIDLBackgroundBackground

Multiple IDL functions Multiple IDL functions Run round-robinRun round-robin

Page 21: 04a Dsp Bios

SWI vs. TSKSWI vs. TSK

Similar to hardware Similar to hardware interrupt, but triggered by interrupt, but triggered by SWI_post() function callSWI_post() function call

All SWI's share system All SWI's share system software stack (along with software stack (along with HWI's)HWI's)

SWISWI SWI_postSWI_post

startstart

endend

““run torun tocompletion”completion”

Each TSK has its own stack, Each TSK has its own stack, which allows them to pausewhich allows them to pause

Usually implemented as loopUsually implemented as loop Executed conditionally Executed conditionally

based on a semaphore based on a semaphore (condition, flag)(condition, flag)

SEM_post function call set’s SEM_post function call set’s flag to trigger executionflag to trigger execution

TSKTSK

startstart

endend

PausePause

SEM_postSEM_post

(blocked(blocked state) state)

SEM_pendSEM_pend

Page 22: 04a Dsp Bios

TSK Preemption ExampleTSK Preemption Example

HWIHWI

SWI 2SWI 2

SWI 1SWI 1

IDLIDL

main()main()

TSK 2TSK 2

TSK 1TSK 1interruptinterrupt

pend pend sem2sem2

returnreturn

interruptinterrupt

interruptinterrupt

pend pend sem2sem2

pend pend sem1sem1

returnreturn

returnreturn

post swi1post swi1 returnreturn returnreturn post post sem2sem2 returnreturn

post swi2

Skip Slide Animation Skip Slide Animation

Page 23: 04a Dsp Bios

TSK Preemption ExampleTSK Preemption Example

HWIHWI

SWI 2SWI 2

SWI 1SWI 1

IDLIDL

main()main()

TSK 2TSK 2

TSK 1TSK 1interruptinterrupt

pend pend sem2sem2

returnreturn

interruptinterrupt

interruptinterrupt

pend pend sem2sem2

pend pend sem1sem1

returnreturn

returnreturn

post swi1post swi1 returnreturn returnreturn post post sem2sem2 returnreturn

post swi2

How do you set priorities ...How do you set priorities ...

Page 24: 04a Dsp Bios

Kernel FundamentalsKernel Fundamentals

A kernel is responsible for:A kernel is responsible for: Creation and Deletion of processesCreation and Deletion of processes Scheduling of processesScheduling of processes SynchronizationSynchronization CommunicationCommunication Resource managementResource management Memory allocationMemory allocation Hardware abstractionHardware abstraction

DSP/BIOS provides these services, DSP/BIOS provides these services, being both a static and dynamic real-being both a static and dynamic real-time, multitasking kernel.time, multitasking kernel.

““The objective of a real-time, multi-tasking kernel is to allow The objective of a real-time, multi-tasking kernel is to allow processes to share CPU bandwidth and resources in order to meet processes to share CPU bandwidth and resources in order to meet real-time constraints and multiplex across multiple processes.”real-time constraints and multiplex across multiple processes.”

Page 25: 04a Dsp Bios

““DSP/BIOS”DSP/BIOS” Real-time SchedulingReal-time Scheduling

Simple example problemSimple example problem HWI, SWI, and TSKHWI, SWI, and TSK Scheduler Scheduler

Real-time analysis (RTA)Real-time analysis (RTA) printf() and LOG_printfprintf() and LOG_printf StatisticsStatistics Visual InstrumentationVisual Instrumentation

Page 26: 04a Dsp Bios

Why is printf() used?Why is printf() used?

printf is widely used for logical debugprintf is widely used for logical debug (checking your answer) (checking your answer)

What’s wrong with printf?What’s wrong with printf? 30,000+ cycles to perform printf 30,000+ cycles to perform printf

Requires extensive prog & data memoryRequires extensive prog & data memory DSP has to format the text stringDSP has to format the text string

Worse yet, it's Non-Deterministic Worse yet, it's Non-Deterministic The DSP must stop and wait for MS Windows to send The DSP must stop and wait for MS Windows to send

string back to debugger (is Windows real-time?)string back to debugger (is Windows real-time?) Bottom LineBottom Line

Not DeterministicNot Deterministic Why waste DSP's MIPS and MbytesWhy waste DSP's MIPS and Mbytes Real-time code can fail due to printfReal-time code can fail due to printf

printf (“I'm a wasteful function = %d\n”,i++);printf (“I'm a wasteful function = %d\n”,i++);

Page 27: 04a Dsp Bios

DSP/BIOS: Real-Time InstrumentationDSP/BIOS: Real-Time Instrumentation

DSPDSPReal-Time CaptureReal-Time Capture

Host (CCS)Host (CCS)Analysis & DisplayAnalysis & Display

Two main printf real-time issues are …Two main printf real-time issues are …1.1. Not DeterministicNot Deterministic2.2. Why waste DSP's MIPS and MbytesWhy waste DSP's MIPS and Mbytes

If captured in real-time, how is debug data transferred?If captured in real-time, how is debug data transferred?

Page 28: 04a Dsp Bios

RTDX: Real-Time Data ExchangeRTDX: Real-Time Data ExchangePCPCTMS320 DSPTMS320 DSP

IEEEIEEEJTAGJTAG

EMU

H/W

EMU

H/W

R T D

X R

T D X

USER

CO

DE

USER

CO

DE

Third PartyThird PartyDisplayDisplay

CCSCCS

DisplayDisplay UserUser TITI 3rd Party3rd Party MS COMMS COM

RTDX enables non-obtrusive two-way communication between RTDX enables non-obtrusive two-way communication between thethe host PC and the DSP (host PC and the DSP (during IDLduring IDL))

Since it runs in IDL (by default), it runs lower priority than your Since it runs in IDL (by default), it runs lower priority than your real-time codereal-time code

RTDX is used by DSP/BIOS RTA, but it is also available directly to RTDX is used by DSP/BIOS RTA, but it is also available directly to DSP programmer (useful for testing or if end-equipment is PC DSP programmer (useful for testing or if end-equipment is PC resident)resident)

Transfer speed limited by:Transfer speed limited by: JTAG connection type (parallel, PCI, etc.) JTAG connection type (parallel, PCI, etc.) DSP activity levelDSP activity level

How does LOG_printf work? Where's the buffer for captured data?How does LOG_printf work? Where's the buffer for captured data?

Page 29: 04a Dsp Bios

LOG_printfLOG_printf

LOG_printf is answer to real-time issuesLOG_printf is answer to real-time issues Data is captured to a buffer on the DSPData is captured to a buffer on the DSP Data is transferred to buffer in background (IDL)Data is transferred to buffer in background (IDL)

How is LOG_printf used in code?How is LOG_printf used in code?

Page 30: 04a Dsp Bios

External reference External reference to LOG object to LOG object

defined using the defined using the configuration toolconfiguration tool

Call LOG_printfCall LOG_printf

#include <std.h>#include <std.h>#include <log.h>#include <log.h>extern far LOG_Obj myLog;extern far LOG_Obj myLog;

LOG_printf(&myLog, “New load = %d000 instructions”, loadVal);LOG_printf(&myLog, “New load = %d000 instructions”, loadVal);

Call the functionCall the function

Run-time display of Run-time display of user-defined LOGuser-defined LOG

Page 31: 04a Dsp Bios

““DSP/BIOS”DSP/BIOS” Real-time SchedulingReal-time Scheduling Real-time analysis (RTA)Real-time analysis (RTA)

printf() and LOG_printfprintf() and LOG_printf StatisticsStatistics Visual InstrumentationVisual Instrumentation

Page 32: 04a Dsp Bios

Built-in Statistics ToolsBuilt-in Statistics Tools Execution GraphExecution Graph is useful for visualization of thread scheduling is useful for visualization of thread scheduling StatisticsStatistics give you finer detail to profile thread execution give you finer detail to profile thread execution

Is the thread meeting its real-time deadline?Is the thread meeting its real-time deadline?

The number of times The number of times the SWI has runthe SWI has run

Max and Average number of Max and Average number of instructions from SWI_post to instructions from SWI_post to completion (can also display as completion (can also display as milliseconds or microseconds)milliseconds or microseconds)

Page 33: 04a Dsp Bios

Create & Name the STS Object Create & Name the STS Object

STS objects buffer statistics data accesses by STS functionsSTS objects buffer statistics data accesses by STS functions

Page 34: 04a Dsp Bios

User-Defined STS exampleUser-Defined STS example

Reference the STS Reference the STS objectobject

#include <std.h>#include <std.h>#include <sts.h>#include <sts.h>extern far STS_Obj myStat;extern far STS_Obj myStat;

STS_add(&myStat, your_variable);STS_add(&myStat, your_variable);Monitor a variableMonitor a variable

Insert STS object in Insert STS object in configuration tool, configuration tool, rename to “myStat”rename to “myStat”

Page 35: 04a Dsp Bios

User-Defined STS exampleUser-Defined STS example

How do we profile code execution time?How do we profile code execution time?We need We need twotwo values: a beginning and ending timestamp values: a beginning and ending timestamp

Reference the STS Reference the STS objectobject

#include <std.h>#include <std.h>#include <sts.h>#include <sts.h>extern far STS_Obj myStat;extern far STS_Obj myStat;

STS_add(&myStat, your_variable);STS_add(&myStat, your_variable);

Insert STS object in Insert STS object in configuration tool, configuration tool, rename to “myStat”rename to “myStat”

Monitor a variableMonitor a variable

Page 36: 04a Dsp Bios

Profiling with User-Defined STSProfiling with User-Defined STS

#include <std.h>#include <std.h>#include <sts.h>#include <sts.h>extern far STS_Obj audioSts;extern far STS_Obj audioSts;

STS_set(&audioSts, CLK_gethtime());STS_set(&audioSts, CLK_gethtime()); ; processBuffer function; processBuffer functionSTS_delta(&audioSts, CLK_gethtime());STS_delta(&audioSts, CLK_gethtime());

STS_set saves STS_set saves beginning timestamp in beginning timestamp in

“prev” history field“prev” history field

Run-time display of Run-time display of user-defined LOGuser-defined LOG

STS_delta records STS_delta records current timestamp minus current timestamp minus

previous timestampprevious timestamp

Reference the STS Reference the STS objectobject

Page 37: 04a Dsp Bios

What does deterministic, low-overhead RTA mean to you?What does deterministic, low-overhead RTA mean to you?

LOG, STS, and TRC module operations are very fast and LOG, STS, and TRC module operations are very fast and execute in a consistent time, as shown in the following list:execute in a consistent time, as shown in the following list:

LOG_printf:LOG_printf: approximately 32 cyclesapproximately 32 cycles STS_add: STS_add: approximately 18 cyclesapproximately 18 cycles STS_delta: STS_delta: approximately 21 cyclesapproximately 21 cycles TRC_enable & _disable:TRC_enable & _disable: approximately 6 cyclesapproximately 6 cycles

* (exact timing depends upon processor type)* (exact timing depends upon processor type)

STS and LOG - low overheadSTS and LOG - low overhead Each STS object uses only four words of data memory. Therefore, only four Each STS object uses only four words of data memory. Therefore, only four

words need to be uploaded from a statistics objectwords need to be uploaded from a statistics object LOG functions only need to capture 4 words per invocationLOG functions only need to capture 4 words per invocation

Low Instrumentation OverheadLow Instrumentation Overhead

You can leave RTA in your code and get:You can leave RTA in your code and get:1.1. What you test is "exactly" what you shipWhat you test is "exactly" what you ship2.2. When (if) field problems arise, debug instrumentation is When (if) field problems arise, debug instrumentation is

already in place!already in place!

Page 38: 04a Dsp Bios

““DSP/BIOS”DSP/BIOS” Real-time SchedulingReal-time Scheduling Real-time analysis (RTA)Real-time analysis (RTA)

printf() and LOG_printfprintf() and LOG_printfStatisticsStatistics Visual InstrumentationVisual Instrumentation

Execution GraphExecution Graph CPU Load GraphCPU Load Graph

Page 39: 04a Dsp Bios

Viewing System EventsViewing System Events

System Log is an System Log is an Event “Logic Analyzer”Event “Logic Analyzer” The HWI and SWI routines are on the left axis,The HWI and SWI routines are on the left axis,

and the bottom axis are event ticks and the bottom axis are event ticks … … This makes it easy to follow the actionThis makes it easy to follow the action

Page 40: 04a Dsp Bios

Viewing System EventsViewing System Events

Each tick represents an Each tick represents an event has occurred.event has occurred.

(not time based)(not time based)

PRD_Ticks is based on a PRD_Ticks is based on a ‘C6211 timer.‘C6211 timer.

(hence it’s time based)(hence it’s time based)

Page 41: 04a Dsp Bios

CPU Load MeterCPU Load Meter

CPU load meter acts like a MIPs calculatorCPU load meter acts like a MIPs calculator Basically, it keeps track of the IDLE timeBasically, it keeps track of the IDLE time

Page 42: 04a Dsp Bios

DSP/BIOS - API ModulesDSP/BIOS - API Modules

Instrumentation/Real-Time AnalysisInstrumentation/Real-Time Analysis

LOGLOG Message Log mangerMessage Log mangerSTSSTS Statistics accumulator manager Statistics accumulator manager TRCTRC Trace manager Trace manager RTDXRTDX Real-Time Data Exchange manager Real-Time Data Exchange manager

Thread Types Thread Types

HWIHWI Hardware interrupt manager Hardware interrupt manager SWISWI Software interrupt manager Software interrupt manager TSKTSK Multitasking manager Multitasking manager IDLIDL Idle function & processing loop manager Idle function & processing loop manager

Clock and Periodic Functions Clock and Periodic Functions

CLKCLK System clock manager System clock manager PRDPRD Periodic function manger Periodic function manger

Comm/Synch between threadsComm/Synch between threads

SEMSEM Semaphores manager Semaphores manager MBXMBX Mailboxes manager Mailboxes manager LCKLCK Resource lock manager Resource lock manager

Input/OutputInput/Output

PIPPIP Data pipe manager Data pipe manager HSTHST Host input/output manager Host input/output manager SIOSIO Stream I/O manager Stream I/O manager DEVDEV Device driver interface Device driver interface

Memory and Low-level PrimitivesMemory and Low-level Primitives

MEMMEM Memory manager Memory manager SYSSYS System services manager System services manager QUEQUE Queue manager Queue manager ATMATM Atomic functions Atomic functions GBLGBL Global setting manager Global setting manager

Page 43: 04a Dsp Bios

DSP/BIOS Feature SummaryDSP/BIOS Feature Summary

FeaturesFeatures BenefitsBenefitsSmall Footprint (<2Kw)Small Footprint (<2Kw) Easily fits in limited memory systemsEasily fits in limited memory systemsFast Execution Fast Execution Ideal for real time systemsIdeal for real time systemsReal-Time Analysis Real-Time Analysis View system parametersView system parameters while system is executing withoutwhile system is executing without

breakpoints and without additionalbreakpoints and without additionaloverhead - “Test what you fly and flyoverhead - “Test what you fly and flywhat you test”what you test”

Set of Library FunctionsSet of Library Functions Use only what you need to minimize Use only what you need to minimize footprintfootprint

ExtensibleExtensible Full featured kernel allows additional Full featured kernel allows additional OS functions in futureOS functions in future

Page 44: 04a Dsp Bios

#include’s#include’sextern far SWI_Objextern far SWI_Objglobal variablesglobal variablesmain( ) {main( ) {

CSL_Init();CSL_Init();BSL_init();BSL_init();codec_init();codec_init();init_HWI();init_HWI();AD535_write(hAD535, 0);AD535_write(hAD535, 0);return;return;

}}// HWI routines// HWI routines

init_HWI();init_HWI();XINT0_HWI;XINT0_HWI;

// Codec Routines// Codec Routinescodec_init();codec_init();codec_out();codec_out();

lab6.clab6.c

HWIHWI9: _XINT0_HWI9: _XINT0_HWI

SWISWIcodec_swi: _codec_outcodec_swi: _codec_out

lab6.cdblab6.cdb

sineGen( )sineGen( )sine_float.csine_float.c

LabLab

You get to You get to complete thesecomplete these