`
`DSP Operating System
`
`GetSectionAddress
`
`The GetSectionAddress macro returns the physical address of the specified section.
`
`GetSectionAddress (theSectionPtr,theSectionName)
`
`the S e c ': i o n P t 1:
`the S e ct i onName
`
`Returns a value, physical location of section.
`The name of section to locate.
`
`REGISTER USAGE
`
`The GetSectionAddress macro does not alter the contents of any registers except
`theSectionPtr.
`
`DESCRIPTION
`
`The GetSectionAddress macro calculates the physical address of thesectionName
`and copies the address into the theSectionPtr register, which may be any cau
`register r1 —r1 8.
`
`GetSectionLabel
`
`The GetSectionLabel macro returns a physical pointer to a label in the
`specified section.
`
`GetSection.abe'
`
`(theSectionLabelPtr,theSectionLabel)
`
`the S e ct i on .abe ' Pt 1: Returns a pointer, physical location of section.
`thesection‘ .abe'
`Label used within the section.
`
`REGISTER USAGE
`
`The GetSectionLabel macro does not alter the contents of any register except
`theSectionLabelPtr.
`
`DESCRIPTION
`
`The GetSectionLabel macro returns a physical pointer to a label designated by
`theSectionLabel. The pointer is returned in theSectionLabelPtr, which may
`be any cau register r1—r18.
`
`DSP Operating System Reference
`
`Page 251 of 500
`
`PUMA EXHIBIT 2005
`
`PART 6 OF 10
`
`Page 251 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`GetSectionSize
`
`The Ge t S e ct i on S i z e macro returns the size of the specified section.
`
`Getsectionsize (thesectionsize,theSectionName)
`
`thesectionsize
`
`The size of the section.
`
`theSectionName
`
`The section name.
`
`REGISTER USAGE
`
`The Getsectionsize macro destroys the contents of cau registers rl—r4, rl5—rl8,
`and a0—a1.
`
`The Getsectionsize macro calculates the size of theSectionName and copies it into
`the thesectionsize register, which may be any cau register r1—r18.
`
`DESCRIPTION
`
`PopSection
`
`The Popsection macro caches the specified section off—chip.
`
`Popsection (theSectionName)
`
`theSectionName
`
`The section name.
`
`REGISTER USAGE
`
`The Popsection macro destroys the contents of cau registers rl—r4, r15—rl 8, and
`a0—a1.
`
`DESCRIPTION
`
`The Popsection macro caches theSectionName. The actual caching operation
`performed depends upon the section's caching flags.
`
`For static sections, Popsection caches the section data from its primary container to its
`secondary container. For non-static sections, Popsection caches the section data from
`the top of the demand cache stack to its primary container.
`
`DSP Operating System Reference
`
`Page 252 of 500
`
`Page 252 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`Note
`
`The Save flag must be set (caching flags) for the specified section if data
`is to be moved. The memory space is automatically reclaimed by the
`DSP operating system. 0
`
`WARNING
`
`Sections must use Popsection in the reverse order that they use
`Pushsection. A
`
`PushSection
`
`The Pushsection macro loads the specified section on—chip.
`
`Pushsection (theSectionName)
`
`thesectionName
`
`The section name.
`
`REGISTER USAGE
`
`The Pushsection macro destroys the contents of cau registers r1—r4, r15—r18,
`and aO—a1.
`
`DESCRIPTION
`
`The Pushsection macro caches theSectionName. The actual caching operation
`performed depends upon the section's caching flags.
`
`For static sections Pu shsection caches the section data from its secondary container to
`its primary container. For non—static sections, Pushsection caches the section data
`from its primary container to the top of a demand cache stack.
`
`Note
`
`You must set the Load flag (caching flags) for the specified section if data
`is to be moved. The Clear flag must be set if the section is to be cleared.
`Either the Bank A or Bank B flag should also be set. If no Bank flag or the
`Don't Care flag is selected the DSP operating system will use Bank A. 0
`
`Module Manipulation Macro
`
`The Setskipcount macro helps you program DSP modules.
`
`DSP Operating System Reference
`
`Page 253 of 500
`
`Page 253 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`SetSkipCount
`
`The Setskipcount macro sets the skip count (number of modules to be jumped over).
`
`Setskipcount
`
`(theskipcount)
`
`theskipcount
`
`The number of modules to skip over.
`
`REGISTER USAGE
`
`The Setskipcount macro destroys the contents of cau registers r1—r4, rl5—rl 8,
`and a0-al.
`
`DESCRIPTION
`
`The Setskipcount macro sets the skip count for the currently executing module. The
`current module continues its execution. When the module finishes its execution, the new
`
`skip count takes effect.
`
`The theskipcount parameter is a 32-bit constant or any cau register in the range r1
`through r 1 7.
`
`Task Manipulation Macros
`
`The macros described in this section help you work with tasks.
`
`GetNumRealTimeFrames
`
`The Ge tNumRealTimeFrames macro returns the number of real-time frames that have
`been executed.
`
`Ge tNumRealTimeFrame s
`
`(numFrame s)
`
`numFrames
`
`The number of frames executed.
`
`REGISTER USAGE
`
`The Ge tNumRealTimeFrames macro destroys the contents of cau registers rl—r4,
`r15-r18, and a0-al.
`
`DESCRIPTION
`
`The GetNumRealTimeFrames macro is used to get the number of real-time frames that
`have been executed since the DSP was started or reset.
`
`DSP Operating System Reference
`
`Page 254 of 500
`
`Page 254 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`SetTaskInactive
`
`The SetTas klnactive macro turns off the task associated with the section that is
`
`using it.
`
`SetTaskInactive ()
`
`REGISTER USAGE
`
`The SetTaskInactive macro destroys the contents of cau registers rl—r4, r15—r18,
`and aO—a1.
`
`DESCRIPTION
`
`The SetTas klnactive macro sets the owner task for the currently executing module
`inactive. Setting the task inactive does not take effect until the next frame. The task’s
`modules complete their execution for the current frame.
`
`FIFO Manipulation Macros
`
`The macros described in this section help you work with FIFO buffers.
`
`A WARNING
`
`Although FIFO manipulations deal with byte counts, all operations
`must be done in longword (4 bytes) increments only. Use of the FIFO
`calls with non—longword counts will cause unpredictable results. A
`
`FIFOGetReadCount
`
`The FIFOGetReadCount macro returns the available number of data bytes in the FIFO.
`
`FIFOGetReadCount
`
`(theFIFOName)
`
`theFIFOName
`
`The FIFO name.
`
`REGISTER USAGE
`
`The FIFOGetReadCount macro destroys the contents of cau registers rl—r4,
`rl5—r18, and a0—al.
`
`DESCRIPTION
`
`The FIFOGetReadCount macro returns, in 1:2, the current number of bytes available in
`the FIFO that can be read. A value of 0 indicates an empty FIFO.
`
`DSP Operating System Reference
`
`Page 255 of 500
`
`Page 255 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`FIFORead
`
`The FIFORead macro copies FIFO data into the specified section.
`
`FIFORead (theSectionName)
`
`theSectionName
`
`The section name.
`
`REGISTER USAGE
`
`The FIFORead macro destroys the contents of cau registers r1—r4, r15—rl 8,
`and a0-al.
`
`DESCRIPTION
`
`The FIFORead macro takes one argument, the section name of an AIAO FIFO
`section. The AIAO FIFO section must be located within the same DSP module as
`the current section.
`
`The FIFORead macro copies data to the AIAO FIFO section from the FIFO that's
`connected to it.
`
`The size of AIAO is used as the number of bytes to read from the FIFO. If the FIFO
`empties during the read, only the actual number available will be read. The remaining
`bytes in the section are cleared to 0.
`
`In the event that an underrun occurs (the FIFO does not contain enough data to fill the
`AIAO), a kdspFIFOUnderrunMessage message is sent to the FIFO’s message handler
`if the FIFO’s kdspEnableOverUnde rMessage flag is set. Also, if the FIFO’s
`kdspOVerUnderTas klnactive flag is set, the owner task of the currently executing
`module is set inactive.
`
`Note
`
`Reads and writes to the buffers must occur on longword boundaries. 6
`
`FIFOReadN
`
`The FIFOReadN macro copies the requested number of bytes of FIFO data into the
`specified section.
`
`FIFOReadN (theFIFOName,
`
`theCount)
`
`theFIFOName
`
`thecount
`
`The FIFO name.
`
`The number of bytes to copy.
`
`DSP Operating System Reference
`
`Page 256 of 500
`
`Page 256 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`REGISTER USAGE
`
`The FIFOReadN macro destroys the contents of cau registers r1 —r4 , rl 5—rl 8, and
`a0-a1.
`
`DESCRIPTION
`
`The FIFOReadN macro reads the specified number of bytes in thecount from the
`named FIFO to the section. The programmer should check 1:2 to make sure that the
`requested number of bytes was transferred. If the FIFO empties during the read, only
`the actual number of bytes available are read. The remaining bytes in the section are
`cleared to O.
`
`FIFOReadNBuffer
`
`The FIFOReadNBuf fer macro copies the requested number of bytes of FIFO data into
`the specified section.
`
`FIFOReadNBuffer
`
`(theFIFOName,
`
`thecount,
`
`theBufferPtr)
`
`the F I FOName
`
`The FIFO name.
`
`thecount
`
`The number of bytes to copy.
`
`theBu f f e r Pt 1:
`
`The section data is being copied to.
`
`REGISTER USAGE
`
`The FIFOReadNBuffer macro destroys the contents of cau registers r1 —r4, r15—rl 8,
`and a0-a1.
`
`DESCRIPTION
`
`The FIFOReadNBuf fer macro reads the specified number of bytes in thecount from
`the named FIFO to the section pointed to by theBuf f erPtr. The programmer should
`check r2 to make sure that the requested number of bytes was transferred. If the FIFO
`empties during the read process, only the actual number of bytes available will be read.
`The remaining bytes in the section are cleared to 0.
`
`DSP Operating System Reference
`
`Page 257 of 500
`
`Page 257 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`FIFOGetWriteCount
`
`The FIFOGetWriteCour1t macro returns the number of empty bytes available in
`the FIFO.
`
`FIFOGetWriteCount
`
`(theFIFOName)
`
`theFI FOName
`
`The FIFO name.
`
`REGISTER USAGE
`
`The FIFOGetWriteCour1t macro destroys the contents of cau registers rl—r4,
`r15—rl8, and aO—al.
`
`The FIFOGetWriteCour1t macro returns in r2 the current number of bytes available in
`the FIFO that can be written—in other words, how much empty space is available. A
`value of 0 indicates a full FIFO.
`
`DESCRIPTION
`
`FIFOWrite
`
`The FIFOWrite macro copies section data into the specified FIFO.
`
`FIFOWrite (theSectionName)
`
`thesect ionName
`
`The section name.
`
`REGISTER USAGE
`
`The FIFOWrite macro destroys the contents of cau registers r1—r4, r15—rl 8, and
`aO—al.
`
`DESCRIPTION
`
`The FIFOWrite macro writes from the AIAO section to the named FIFO. The
`
`programmer should check 1:2 to make sure that the requested number of bytes was
`transferred. If the FIFO fills up, without overrunning, the maximum number of
`bytes possible will be transferred.
`
`The size of the AIAO section is used as the number of bytes to write to the FIFO.
`
`DSP Operating System Reference
`
`Page 258 of 500
`
`Page 258 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`In the event that an overrun occurs (the FIFO does not contain enough space to hold the
`AIAO’s data), a kdspFI FOOverrunMes sage message is sent to the FIFO’s message
`handler if the FIFO’s kdspEnableOverUnde rMes sage flag is set. Also, if the FIFO’s
`kdspove rUnderTaskInactive flag is set, the owner task of the currently executing
`module is set inactive.
`
`Note
`
`Reads and writes to the FIFO and the buffer may occur on longword
`boundaries only. 0
`
`FIFOWriteN
`
`The FIFOWriteN macro copies the specified number of bytes of section data into the
`specified FIFO.
`
`FIFOWriteN (theFIFOName,
`
`thecount)
`
`theFIFOName
`
`thecount
`
`The FIFO name.
`
`The number of bytes to copy.
`
`REGISTER USAGE
`
`The FIFOWriteN macro destroys the contents of cau registers rl—r4, rl5—r18, and
`a0-aL
`
`DESCRIPTION
`
`The FIFOWriteN macro writes the specified number of bytes in thecount to the
`named FIFO from the section. The programmer should check 1:2 to make sure that the
`requested number of bytes was transferred. If the FIFO fills up, without overrunning, the
`maximum number of bytes possible will be transferred.
`
`FIFOWriteNBuffer
`
`The FIFOWriteNBuf fer macro copies the specified number of bytes of section data
`into the specified FIFO.
`
`FIFOWriteNBuffer
`
`(theFIFOName,
`
`thecount,
`
`theBufferPtr)
`
`theFIFOName
`
`thecount
`
`The FIFO name.
`
`The number of bytes to copy.
`
`theBu f f e r P t r
`
`The section data is being copied from.
`
`DSP Operating System Reference
`
`Page 259 of 500
`
`Page 259 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`REGISTER USAGE
`
`The FI FOWr i teNBu f f e r macro destroys the contents of cau registers r 1 — r 4,
`r15-r18, and a0-al.
`
`DESCRIPTION
`
`The FIFOWriteNBuf fer macro writes the specified number of bytes in thecount to
`the named FIFO from the buffer pointed to by theBuf f erPtr. The programmer should
`check r2 to make sure that the requested number of bytes was transferred. If the FIFO
`fills up, without overrunning, the maximum number of bytes possible will be transferred.
`
`Note
`
`Reads and Writes to the FIFO and the buffer are on longword
`boundaries only. 6
`
`GPB Manipulation Macros
`
`The macros described in this section help you manage the GPB for a module. GPB is
`discussed in ”Guaranteed Processing Bandwidth,” in Chapter 3.
`
`GPBElapsedCyc1es
`
`The GPBElapsedCycles macro returns the number of DSP cycles used by this module
`up to the point it is called.
`
`GPBElapsedCycles
`
`(thecycles)
`
`thecycles
`
`Elapsed cycles since start or reset.
`
`REGISTER USAGE
`
`The GPBElapsedCycles macro destroys the contents of cau registers r1—r4,
`rl5—rl8, and a0-al.
`
`DESCRIPTION
`
`The GPBElapsedCycles macro returns the number of DSP instruction cycles that have
`elapsed since this module started execution. By comparing this Value with the expected
`value returned from the GPBExpectedCycles () macro, a dumb lumpy algorithm can
`determine if it should cease processing. Dumb lumpy algorithms are discussed in
`”Smooth and Lumpy Algorithms,” in Chapter 3.
`
`DSP Operating System Reference
`
`Page 260 of 500
`
`Page 260 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`GPBExpectedCycles
`
`The GPBExpectedCycles macro returns the computed number of DSP cycles this
`module is expected to need based on the supplied GPB estimate.
`
`GPBExpectedCycles
`
`(thecycles)
`
`thecycles
`
`Expected cycles for this module.
`
`REGISTER USAGE
`
`The GPBExpectedCycles macro destroys the contents of cau registers r1—r4,
`rl5—r18, and aO—al.
`
`DESCRIPTION
`
`The GPBExpectedCycles macro returns the expected number of DSP instruction cycles
`to complete this module. This is used in conjunction with the GPBElapsedCycles
`macro (page 235) to control the execution of a dumb lumpy algorithm.
`
`GPBSetUseActual
`
`The GPBSetUseActual macro tells the DSP operating system to use the actual GPB
`required instead of the estimated value.
`
`GPBSetUseActual
`
`()
`
`REGISTER USAGE
`
`The GPBSetUseActual macro destroys the contents of cau registers r1 —r4, r15—rl 8,
`and aO—al.
`
`DESCRIPTION
`
`The GPBSetUseActual macro sets the UseActualGPB flag for the module. This flag is
`set immediately, so this routine should not be called until the module is in its worst—case
`GPB usage.
`
`DSP Operating System Reference
`
`Page 261 of 500
`
`Page 261 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`Semaphore Manipulation Macros
`
`The macros described in this section help you work with semaphores.
`
`SemaphoreClear
`
`The Semaphoreclear macro clears the specified semaphore in a locked environment.
`
`SemaphoreClear
`
`(theSemaphorePtr,
`
`theMask,
`
`theoldsemaphorevalue)
`
`theSemaphorePtr
`
`Pointer to the semaphore.
`
`theMas k
`
`Mask of new semaphore value.
`
`theoldsemaphorevalue Returns the Value of the old semaphore.
`
`REGISTER USAGE
`
`The SemaphoreClear macro destroys the contents of cau registers rl—r4, 1:15-1:18,
`and a0-a1.
`
`DESCRIPTION
`
`The Semaphoreclear macro locks the system bus and performs the following
`operation:
`
`[lock the bus]
`
`*theSemaphorePtr = ((theOldSemaphoreValue = *theSemaphorePtr)
`~theMask)
`
`&
`
`[unlock the bus]
`
`The value of thesemaphorePtr must be a cau register in the range rl through r17
`containing a physical pointer.
`
`The Value of theMask may be any register in the range rl through r1 7, or a constant.
`
`The Semaphoreclear macro performs dolock on the bus to prevent host access and
`then reads the semaphore location. The old semaphore value is AND-combined with NOT
`of the mask and this new value is written back to the semaphore location.
`
`RETURN VALUE
`
`The value of theoldsemaphorevalue is the value of the semaphore before it was
`AND-combined with the one’s-complement of the Value of theMask.
`
`DSP Operating System Reference
`
`Page 262 of 500
`
`Page 262 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`Semaphoreset
`
`The Semaphoreset macro sets the specified semaphore in a locked environment.
`
`Semaphoreset
`
`(theSemaphorePtr,
`
`theMask,
`
`theoldsemaphorevalue)
`
`the S emapho re Ptr
`
`Pointer to the semaphore.
`
`theMas k
`
`Mask of new semaphore value.
`
`theoldsemaphorevalue Returns the value of the old semaphore.
`
`REGISTER USAGE
`
`The Semaphoreset macro destroys the contents of cau registers r1—r4, r15—r1 8, and
`aO—al.
`
`DESCRIPTION
`
`The Semaphoreset macro locks the system bus and performs the following operation:
`
`[lock the bus]
`
`*theSemaphorePtr = ((theOldSemaphoreValue = *theSemaphorePtr)
`theMask)
`
`|
`
`[unlock the bus]
`
`The value of theSemaphorePtr must be a cau register rl—r1 7 containing a
`physical pointer.
`
`The Semaphoreset macro performs DoLock on the bus to prevent host access and then
`reads the semaphore location. The old semaphore value is OR-combined with the mask
`and this new value is written back to the semaphore location.
`
`RETURN VALUE
`
`The value of theoldsemaphorevalue is the Value of the semaphore before it was
`OR-combined with theMask.
`
`DSP Operating System Reference
`
`Page 263 of 500
`
`Page 263 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`Message Manipulation Macro
`
`The SendMessageToHost macro helps you work with DSP messages.
`
`SendMessageToHost
`
`The SendMessageToHost macro sends a message from the module to the host using
`the interrupt handler.
`
`SendMessageToHost
`
`(theDSPMessagePtr)
`
`t he DS PMe s s a ge Pt 1:
`
`Pointer to the message vector.
`
`REGISTER USAGE
`
`The SendMessageToHost macro destroys the contents of cau registers rl—r4 ,
`r15—rl8, and aO—al.
`
`DESCRIPTION
`
`The SendMessageToHost macro calls the msvector (interrupt handler) in the Real
`Time Manager structure that then passes the message to the interrupt handler. When
`used by a module to send a message to the client application the ms Data [0] through
`ms Data [2] fields are not defined when using this macro.
`
`The value of theDSPMes sagePtr must be a cau register rl —rl 7 containing a physical
`pointer to a DSP message.
`
`Note
`
`The msvector field of the message must be initialized to a valid
`interrupt handler. Fields ms Data [0] through ms Data [2] can be
`used by the programmer as needed. 0
`
`When the Real Time Manager uses this routine to send a message to the client
`application ms Data [0] contains theErrorMes sage constant. The message is sent to
`the interrupt Vector of the owner task for the currently executing module. The owner
`task is then set inactive.
`
`The theErrorMessage constant is a DSP message constant or a register containing a
`DSP message constant. The Apple-defined DSP message constants are defined in the
`next section.
`
`DSP Operating System Reference
`
`Page 264 of 500
`
`Page 264 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`When the host interrupt Vector for the task is called, a complete DSPMes sage structure
`is passed on the stack containing the following information:
`
`The owner task’s interrupt vector
`
`theErrorMessage
`
`The task’s reference number
`
`—> msvector
`
`—>msData [O]
`
`—> ms Data [1]
`
`The current module's reference number
`
`—> ms Data [2]
`
`The DSP message structure is diagrammed in Figure 5-3.
`
`Figure 5-3
`
`DSP message structure
`
`DSP message
`
`msData[O]
`
`msData[2]
`
`The corresponding routine in the Macintosh API is the Mes sageAct i onProc routine.
`
`Summary of the DSP Operating System
`
`Constants
`
`#define
`
`kdspFIFOMaskAllMessages
`
`OXOOOOOOOO
`
`// disable all
`
`//messages (p) priority of FIFO messages in descending order
`
`#define
`
`kdspFIFOEnableOverUnderMessage
`
`OxOOOOOOOl
`
`// (3) enable
`
`// message when FIFO transfer causes an overrun or underrun
`
`Summary of the DSP Operating System
`
`Page 265 of 500
`
`Page 265 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`kdspFIFOEnableFullEmptyMessage
`
`OxOOOOOOO2
`
`//
`
`// message when FIFO goes full or empty
`
`kdspFIFOEnableHighLowMessage
`
`OXOOOOOOO4
`
`// (1) enable
`
`// message when FIFO goes at least half full or half empty
`
`kdspFIFOEnableLinkMessage
`
`0x00000008
`
`// (4) enable
`
`// message when FIFO’s link is traversed
`
`#define
`
`kdspFIFOOverUnderTaskInactive
`
`OxOOOOOOlO
`
`// if task
`
`// accessing FIFO causes either FIFO overrun or underrun then
`// set task inactive
`
`#define
`
`kdspFIFOFullEmptyTaskInactive
`
`OXOOOOOOZO
`
`// if task
`
`// accessing FIFO causes either FIFO full or FIFO empty then set
`// task inactive
`
`// ---------------------------------------------------------------- --
`
`// ModuleFlags
`// ---------------------------------------------------------------- --
`
`#define
`
`kdspAutoCache
`
`OXOOOOOOOO
`
`// select auto cache model
`
`#define
`
`kdspDemandCache
`
`OxOOOOOOOl
`
`// select demand cache model
`
`#define
`
`kdspOnChipSectionTable
`
`OXOOOOOOO4
`
`// put section table on—chip
`
`#define
`
`kdspOnChipStack
`
`0x00000020
`
`// a stack of the specified
`
`#define
`
`kdspOffChipStack
`
`0x00000040
`
`// a stack of the specified
`
`// size will be created on—chip
`
`// size will be created off—chip
`
`// ———————————————————————————————————————————————————————————————— --
`
`(see DSPConstantsPrivate.h for the complete list of flags)
`// GPBFlags
`// ---------------------------------------------------------------- --
`
`#define
`
`kdspLumpyModule
`
`OXOOOOOOOO
`
`// use bnEstimate
`
`#define
`
`kdspSmoothModule
`
`OxOOOOOOOl
`
`// see DSPConstantsPrivate.h
`
`// ---------------------------------------------------------------- --
`
`// SectionFlags
`// ---------------------------------------------------------------- --
`
`// Costs the DSP one instruction to use the following flags:
`
`#define
`
`kdspLeaveSection
`
`OXOOOOOOOO
`
`// do not load or save this
`// section
`
`#define
`
`kdspLoadSection
`
`OxOOOOOOOl
`
`// load this section
`
`#define kdspsavesection
`
`OxOO0OOOO2
`
`// save this section
`
`#define kdspclearsection
`
`OXOOOOOOO4
`
`// fill this section with zeroes
`
`Summary of the DSP Operating System
`
`Page 266 of 500
`
`Page 266 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`kdspsaveoncontextswitch OXOOOOOOO8
`
`// save this section on context
`// switch
`
`#define
`
`kdspExternal
`
`OXOOOOOOOO
`
`// never loaded on—chip
`
`#define
`
`kdspBankA
`
`#define
`
`kdspBankB
`
`OxOOOOOO2O
`
`// load in Bank A if possible
`
`0x00000040
`
`// load in Bank B if possible
`
`#define
`
`kdspAnyBank
`
`(kdspBankA | kdspBankB) // load anywhere
`
`#define kdspstaticsection
`
`OxOOOOOO8O
`
`// section statically allocated
`// before runtime
`
`#define
`
`kdspFIFOSection
`
`OxOOOOO1OO
`
`// section is a FIFO buffer
`
`#define
`
`kdspReservedSectionFlagO2OO
`
`OxOOOOO2OO
`
`// reserved
`
`#define
`
`kdspLoadFIFOSection
`
`OxOOOOO4OO
`
`// when loading convert from a
`// FIFO
`
`#define
`
`kdspSaveFIFOSection
`
`0x00000800
`
`// when saving convert to a FIFO
`
`#define
`
`kdspHIHOSection
`
`0x00001000
`
`// this is a HIHO section
`
`#define
`
`kdspReservedForToggleSectionTbl
`
`0x00002000
`
`// this flag holds the
`
`// kdspToggleSectionTable flag
`
`// from the module's flag
`
`#define
`
`kdspLoadHIHOSection
`
`OxOOO04000
`
`#define
`
`kdspSaveHIHOSection
`
`0x00008000
`
`// when saving convert to a HIHO
`
`// when loading convert from a
`// HIHO
`
`// Costs the DSP two instructions to use the following flags:
`
`#define
`
`kdspNotIOBufferSection
`
`0x00010000
`
`// all cases other than below
`
`#define
`
`kdspInpu:Buffer
`
`0x00020000
`
`// section is an input buffer
`
`#define
`
`kdspOutputBuffer
`
`0x00040000
`
`// section is an output buffer
`
`#define
`
`kdspITBSection
`
`0x00080000
`
`// section is an intertask
`// buffer
`
`#define kdspscalablesection
`
`OxOO1000OO
`
`// section size can be scaled
`
`#define kdspSectionAllocated
`
`OxOO2000OO
`
`// reserved for use by the DSP
`
`// Manager
`
`#define
`
`kdspDSPUseOnly
`
`OxOO4000OO
`
`// only DSP should modify this
`
`// memory
`
`// ---------------------------------------------------------------- --
`
`// SectionDataTypes
`// ---------------------------------------------------------------- --
`
`#define
`
`kdspNonData
`
`OXOOOOOOOO
`
`// data in section is beyond
`
`#define
`
`kdsp3200Float
`
`OxOOOOOO0l
`
`// 3200 float
`
`#define
`
`kdspIn««Float
`
`OxOOOOOOO2
`
`// IEEE float format
`
`// description
`
`Summary of the DSP Operating System
`
`Page267of5OO
`
`Page 267 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`#define
`
`#define
`
`#define
`
`#define
`
`kdspIn:32
`
`kdspIntl6l6
`
`kdspIn:8888
`
`kdspmuLaw
`
`0x00000003
`
`0x00000004
`
`0x00000005
`
`0x00000006
`
`// 32bit integer
`
`// 16bit integer packed
`
`// 8bit integer packed
`// muLaw format
`
`#define
`
`kdspALaw
`
`OXOOOOOOO7
`
`// Alaw format
`
`#define
`
`kdspAppSpecificData
`
`OXOOOOFFFF
`
`// application—specific
`
`// ————————————————————————————————————————————————————————————————--
`
`//
`
`DSP CLIENT DEFINITIONS
`
`//==================================================================
`
`// ———————————————————————————————————————————————————————————————— --
`
`// constants used by a client to specify where to insert a task
`// ———————————————————————————————————————————————————————————————— --
`
`#define
`
`kdspHeadInsert
`
`#define kdspTailInsert
`
`#define kdspBeforeInsert
`
`#define kdspAfterInsert
`
`OXOOOOOOO4
`
`OxOOOOOOO8
`
`OXOOOOOOIO
`
`// insert at list:
`
`// head
`
`// tail
`
`// before reference link
`
`OxOOOOOO2O
`
`// after reference link
`
`#define kdspAnyPositionInsert
`
`kdspHeadInsert // anywhere
`
`// ———————————————————————————————————————————————————————————————— --
`
`// constants for messages received by client tasks
`// ———————————————————————————————————————————————————————————————— --
`
`#define
`
`kdspBIOPinChangedState Ox62696f7O //'biop'
`// state)
`
`(bio pin has changed
`
`// constants used for FIFO:
`
`#define
`
`kdspFIFOMessage
`
`Ox66000OOO // 'f
`
`'
`
`(messages)
`
`#define
`
`kdspFIFOLinkMessage
`
`Ox666c6e6b
`
`// 'lnk '
`
`(link was traversed)
`
`#define
`
`kdspFIFOOverrunMessage Ox666f7672
`
`// 'fovr'
`
`(buffer filled before
`
`// FIFO write completed)
`
`#define
`
`kdspFIFOUnderrunMessage Ox66756e64
`
`//'fund'
`
`(buffer emptied before
`
`// FIFO read completed)
`
`// constants used for FIFO buffer:
`
`#define
`
`kdspFIFOFullMessage
`
`Ox6666756c
`
`'fful'
`
`(exactly full)
`
`#define
`
`kdspFIFOEmptyMessage
`
`0x66656d7O
`
`'femp'
`
`(exactly empty)
`
`#define
`
`kdspFIFOHighMessage
`
`0x66686967
`
`'fhig'
`
`(at least half full
`
`but not exactly full)
`
`#define
`
`kdspFIFOLowMessage
`
`Ox666c6f77
`
`‘flow’
`
`(at least half empty
`
`#define
`
`kdspFIFOPrimeMessage
`
`0x66707269
`
`'fpri'
`
`(application—specific)
`
`but not exactly empty)
`
`Summary of the DSP Operating System
`
`Page 268 of 500
`
`Page 268 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`// constants
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`Jsed for dsp exception messages
`0x78000000
`
`kdspExceptionMessage
`
`kdsp3xceptionReset
`
`kdspExceptionBusError
`
`kdsp3xceptionIllegalopcode
`
`kdspExceptionReservedOne
`
`kdspExceptionAddressError
`
`kdspExceptionDAUOverUnderflow
`
`kdspExceptionNotANumber
`
`kdspExceptionReservedTwo
`
`kdspExceptionExternalIntZero
`
`kdspExceptionTimer
`
`kdspExcep:ionReservedThree
`
`kdspExceptionSIOInputBufFull
`
`kdspExcep:ionSIOOutputBufEmpty
`
`0x78727374
`
`0x78627573
`
`Ox78696c6c
`
`0x78727631
`
`0x78616472
`
`0x78646175
`
`Ox786e6l6e
`
`0x78727632
`
`0x78657830
`
`Ox7874696d
`
`0x78727633
`
`0x78736962
`
`0x78736f62
`
`0x78736966
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`‘X
`
`'xbus'
`
`'xrv1'
`
`'xadr'
`
`'xdau'
`
`'xnan'
`
`'xrv2'
`
`'xex0'
`
`'xtim'
`
`'xrv3'
`
`'xsib'
`
`'xsob'
`
`'xsif'
`
`#define
`
`#define
`
`#define
`
`kdspExceptionSIODMAInputFrame
`
`kdspExceptionSIODMAOutputFrame
`
`kdspExceptionExternalIntOne
`
`kdspExceptionRuntimeError
`
`#define
`
`kdspGPBMessage
`
`#define
`
`kdspGPBTaskActive
`
`#define
`
`kdspGPBTaskInactive
`
`#define
`
`kdspGPBFrameOverrun
`
`Ox78736f66
`
`0x78657831
`
`0x78657272
`
`0x67000000
`
`0x67616374
`
`Ox67696e6l
`
`0x676f7672
`
`#define
`
`kdspGPBFrameSkip
`
`Ox67736b7O
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`'xsof'
`
`'xex1'
`
`'xerr'
`
`'g
`
`'
`
`(prefix used
`
`for GPB messages)
`
`'gact'
`active)
`
`(task is
`
`(task is
`'gina'
`inactive)
`
`(task was
`'govr'
`involved in a frame
`
`overrun and is now
`
`inactive)
`
`'gskp'
`
`(task has
`
`skipped one or more
`frames due to a
`
`frame overrun)
`
`// ———————————————————————————————————————————————————————————————— --
`
`// read/write permission constants for clients
`// ———————————————————————————————————————————————————————————————— --
`OxOOO1
`
`#define
`
`kdspWritePermission
`
`#define
`
`#define
`
`kdspReadPermission
`
`OxOOO2
`
`kdspReadWritePermission
`
`(kdspWritePermission
`
`kdspReadPermission)
`
`Summary of the DSP Operating System
`
`Page 269 of 500
`
`Page 269 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`// ---------------------------------------------------------------- --
`
`// constants for indexed devices
`
`// ---------------------------------------------------------------- --
`
`// CPU processor types
`
`#define
`
`kdsp321O
`
`#define
`
`kdsp32C
`
`'3210'
`
`'32C '
`
`// ---------------------------------------------------------------- --
`
`// constants for DSP API functions
`
`// ---------------------------------------------------------------- --
`
`#define
`#define
`
`kevtMessageToHost
`kevtCacheSection
`
`kev:CopyFIFO
`#define
`#define kevtGetSectionSize
`
`#define
`
`kev:GPBSetUseActua1
`
`#define
`
`kevtGPBExpectedCycles
`
`#define
`
`kevtGPBElapsedCycles
`
`#define
`
`kevtsemaphoreset
`
`#define
`
`kevtsemaphoreclear
`
`kevtSetSkipCount
`#define
`#define kevtSetTaskInactive
`
`#define
`
`kevtBlockMove
`
`(17)
`(22)
`
`(23)
`(43)
`
`(44)
`
`(45)
`
`(46)
`
`(47)
`
`(48)
`
`(50)
`(51)
`
`(53)
`
`#define
`
`kevtNumreal—timeFrames
`
`(113)
`
`// ————————————————————————————————————————————————————————————————--
`
`// constants for errors returned by Macintosh DSP API
`//==================================================================
`
`// ———————————————————————————————————————————————————————————————— --
`
`// misc errors
`
`// the next available error code number is -733
`
`// if you add an error, also add it to the DSPErrorStrings.r file
`// ---------------------------------------------------------------- --
`
`#define
`
`kdspUnimplemented
`
`#define
`
`kdspParamErr
`
`(-692)
`
`(-704)
`
`// feature is not
`
`implemented
`
`// bad parameter
`
`// ———————————————————————————————————————————————————————————————— --
`
`// DSPFIFO errors
`
`// ---------------------------------------------------------------- --
`
`#define
`
`kdspNotAFIFOSection
`
`(-700)
`
`// not a FIFO section
`
`#define
`
`kdspNoMessageInterrupt
`
`(-702)
`
`// no message passing without a
`// vector
`
`Summary of the DSP Operating System
`
`Page 270 of 500
`
`Page 270 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`#define
`
`kdspFIFOInUseByDSP
`
`#define
`
`kdspTaskMustBeInActive
`
`#define
`
`kdspNotFirstFIFO
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`this FIFO is currently being
`
`accessed by the DSP
`
`can only dipose of inactive
`structures
`
`the FIFO must be the first FIFO
`
`in the link to wrap it
`
`// ---------------------------------------------------------------- --
`
`// DSPList errors
`
`// ———————————————————————————————————————————————————————————————— --
`#define
`
`(-666)
`
`//
`
`illegal DSPPosition type
`
`kdspPositionIllegalErr
`
`#define
`
`#define
`
`#define
`
`kdspPositionBusyErr
`
`kdspInvalidReferenceErr
`
`(-667)
`
`(-668)
`
`kdspNonExistantReferenceErr(-669)
`
`#define
`
`kdspNonExistantElementErr
`
`(-670)
`
`//
`
`//
`
`//
`
`//
`
`//
`
`DSPPosition already occupied
`
`illegal insertion request
`reference element does not
`
`exist
`
`deletion element not found
`
`// ———————————————————————————————————————————————————————————————— --
`
`// DSPMemory errors
`// ———————————————————————————————————————————————————————————————— --
`#define
`
`kdspMemFullErr
`
`(-671)
`
`//
`
`#define
`
`#define
`
`kdspAddressNotInZone
`
`(-672)
`
`//
`
`//
`
`heap full,allocation failed
`address is not
`in a zone
`
`trying to dispose
`
`of nil
`
`#define
`
`#define
`
`#define
`
`kdspNilAddress
`
`(-683)
`
`kdspContainingNilAddress(-684)
`(-685)
`
`kdspInvalidZoneSize
`
`kdspInvalidZoneBase
`
`(-686)
`
`//
`
`//
`
`//
`
`//
`
`trying to dispose
`
`heap size must be
`
`of (nil, nil)
`factor of four
`
`heap base must be longword
`
`aligned
`
`// ———————————————————————————————————————————————————————————————— --
`
`// DSPClient errors
`
`// ———————————————————————————————————————————————————————————————— --
`
`#define
`
`#define
`
`kdspDeviceNotFound
`
`kdspInvalidIndexErr
`
`(-673)
`
`(-674)
`
`#define
`
`kdspDeviceHasActiveclients (-675)
`
`#define
`
`kdspInvalidPermission
`
`(-688)
`
`#define
`
`kdspWritePermissionDenied
`
`(-689)
`
`#define
`
`kdspClientNameInvalid
`
`(-690)
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`no device matching given name
`no device (or whatever)
`
`matching index given
`
`can't sign out device with
`clients
`
`invalid permission for
`
`operation
`
`client already exists with
`
`write permission
`client name must be [1 .... U31]
`
`bytes
`
`Summary of the DSP Operating System
`
`Page 271 of 500
`
`Page 271 of 500
`
`
`
`CHAPTER 5
`
`DSP Operating System
`
`#define kdspInvalidoptionselector
`
`// options selector not
`
`// recognized
`
`#define
`
`kdspInvalidIODeviceType
`
`// invalid io device type,
`
`// index out of range
`
`#define
`
`kdspInvalidClientICON
`
`// an invalid ICON was passed
`
`#define
`
`kdspDeviceCantBeSlave
`
`// specified cpu device cannot
`// be a slave
`
`// ——————————————————————————————