`
`Real ‘lime Manager
`
`DSPFIFOGetSize
`
`The DSPFIFOGetSi ze routine returns the size of the specified FIFO.
`
`pascal unsigned long DSPFIFOGetSize (DSPFIFORefNum theFIFORefNum);
`
`Field descriptions
`—>
`the F I FORe fNum
`
`The FIFO reference number.
`
`<—
`
`Func t i onRe su l t
`
`The number of total bytes allocated for the FIFO.
`
`DESCRIPTION
`
`The DSPFIFOGetSi ze routine returns the size of the given FIFO.
`
`DSPFIFOGetReadCount
`
`The DSPFIFOGetReadCount routine returns the number of bytes available in a FIFO.
`
`pascal unsigned long DSPFIFOGetReadCount
`theFIFORefNum);
`
`(DSPFIFORefNum
`
`Field descriptions
`—>
`the F I FORe fNum
`
`The FIFO reference number.
`
`<—
`
`Funct i onRe su l t
`
`The number of bytes currently in the FIFO.
`
`DESCRIPTION
`
`The DSPFIFOGetReadCount returns the number of bytes that can actually be read from
`a given FIFO.
`
`DSPFIFORead
`
`The DSPFIFORead routine reads data from the FIFO into the specified location.
`
`pascal unsigned long DSPFIFORead (
`DSPFIFORefNum
`theFIFORefNum,
`
`Ptr
`
`theDestination,
`
`unsigned long
`
`thecount);
`
`Real Time Manager Reference
`
`Page 201 of 500
`
`PUMA EXHIBIT 2005
`
`PART 5 OF 10
`
`Page 201 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`Field descriptions
`theFIFORefNum
`theDestination
`theCount
`FunctionResult
`
`Reference number of the FIFO to be read.
`
`The location in which to place the data being read.
`The number of bytes to be read.
`The number of bytes that were read.
`
`DESCRIPTION
`
`The DSPFIFORead routine reads data from a FIFO. The thecount parameter is the
`number of bytes requested. The number of bytes actually read are returned in the
`FunctionResult parameter. The data is written to theDestination.
`
`DSPFIFOGetWriteCount
`
`The DSPFIFOGetWriteCount routine returns the number of available bytes in a FIFO.
`
`pascal unsigned long DSPFIFOGetWriteCount
`theFIFORefNum);
`
`(DSPFIFORefNum
`
`Field descriptions
`—>
`theFIFORefNum
`<-
`FunctionResult
`
`The FIFO reference number.
`
`The number of empty bytes left in the FIFO.
`
`DESCRIPTION
`
`The DSPFIFOGetWriteCount routine returns the number of bytes that can be written
`to a FIFO.
`
`DSPFIFOWrite
`
`The DSPFIFOWrite routine writes data into the specified FIFO.
`
`pascal unsigned long DSPFIFOWrite (
`DSPFIFORefNum
`theFIFORefNum,
`
`Ptr
`
`thesource,
`
`unsigned long
`
`thecount);
`
`The FIFO reference number to write to.
`The location of the data to be written.
`
`The number of bytes to write.
`The number of bytes actually written.
`
`Field descriptions
`theFIFORefNum
`thesource
`theCount
`FunctionResult
`
`>
`—>
`<—
`
`% —
`
`Real Time Manager Reference
`
`Page 202 of 500
`
`Page 202 of 500
`
`
`
`CHAPTER 4
`
`Real ‘lime Manager
`
`DESCRIPTION
`
`The DSPFIFOWrite routine writes data to a FIFO. The thecount parameter is the
`number of bytes to be written. The number of bytes actually written are returned
`in the FunctionResult parameter. The data to be written to the FIFO is indicated
`by thesource.
`
`DSPFIFOSwap
`
`The DSPFIFOSwap routine swaps new data into the specified FIFO.
`
`pascal unsigned long DSPFIFOSwap (
`DSPFIFORefNum
`theFIFORefNum,
`
`unsigned long
`
`Ptr
`
`Ptr
`Boolean
`
`thesize,
`
`Logical,
`
`physical,
`fifoFull,
`
`MessageActionProc thelnterrupt);
`
`Field descriptions
`the F I FORe fNum
`thes i ze
`
`The FIFO reference number.
`The size of data buffer allocated.
`
`logical
`phys ical
`f i f o Ful l
`thelnterrupt
`
`The logical address.
`The physical address.
`Flag to tell routine to fill FIFO with data.
`The procedure for receiving messages from the FIFO.
`
`DESCRIPTION
`
`The DSPFIFOSwap routine takes an existing FIFO header and changes the FIFO data.
`This routine is used with linked FIFOs when a FIFO linked message is received and
`more data needs to be put into the FIFO. It does not allocate memory and is safe to call at
`the interrupt level. The FIFO linked message indicates the specific FIFO is empty and can
`safely be removed from the linked FIFO. If the removed FIFO was allocated by the
`application, then it must be deallocated by the application.
`
`For more information about Me s s ageActionProc see ”Sending Messages,” earlier in
`this chapter.
`
`Real Time Manager Reference
`
`Page 203 of 500
`
`Page 203 of 500
`
`
`
`CHAPTER 4
`
`Real ‘lime Manager
`
`DSPFIFOReset
`
`The DSPFIFOReset routine empties the FIFO and clears any pending operations for
`a FIFO.
`
`pascal OSErr DSPFIFOReset
`
`(DSPFIFORefNum theFIFORefNum);
`
`Field description
`—>
`the F I FORe fNum
`
`The FIFO reference number.
`
`DESCRIPTION
`
`The DSPFIFOReset routine is used to reset a FIFO after a transaction has finished.
`
`This routine disables message passing by calling DSPFIFOSetMes sageMode with
`theFlags set to kdspMaskAllMessages. It then Calls DSPFIFOClearInterrupt to
`
`clear any pending interrupts. Finally, it resets both the read and write indexes to 0,
`which has the effect of emptying the FIFO.
`
`DSPFIFOClearInterrupt
`
`The DSPFIFOClearInterrupt routine clears the interrupt for a FIFO.
`
`pascal OSErr DSPFIFOClearInterrupt
`
`(DSPFIFORefNum theFIFORefNum);
`
`Field description
`—>
`the}? I FORe fNum
`
`The FIFO reference number.
`
`DESCRIPTION
`
`The DSPFIFOClearInterrupt routine clears the interrupt for the given FIFO. Once
`the DSP has sent a message to a FIFO, it will not send additional messages until this call
`has been made to clear the current interrupt. Usually this call would be made from the
`FIFO's MessageActionProc.
`
`For more information about Me s s ageActionProc see ”Sending Messages,” earlier in
`this chapter.
`
`Real Time Manager Reference
`
`Page 204 of 500
`
`Page 204 of 500
`
`
`
`CHAPTER 4
`
`Real '|'Ime Manager
`
`DSPFIFOGetRefCon
`
`The DS PFI FOGetRe f Con routine returns application-specific information for the
`specified FIFO.
`
`pascal unsigned long DSPFIFOGetRefCon (DSPFIFORefNum
`theFIFORefNum);
`
`Field descriptions
`-9
`theFIFORefNum
`e
`FunctionResult
`
`The FIFO reference number.
`The current Re f Con of the FIFO.
`
`DESCRIPTION
`
`The DSPFIFOGetRe f Con routine returns the application-specific data for a given
`DSP FIFO.
`
`DSPFIFOSetRefCon
`
`The DSPFIFOsetRe f Con routine sets the Value of the app1ication—specific data field in a
`DSP FIFO buffer.
`
`pascal OSErr DSPFIFOSetRefCon (
`DSPFIFORefNum theFIFORefNum,
`
`unsigned long
`
`thevalue);
`
`Field descriptions
`-9
`theFIFORefNum
`—>
`thevalue
`
`The FIFO reference number.
`The desired value of the Re f Con.
`
`DESCRIPTION
`
`The Re f Con for the FIFO is an application-specific parameter. When a client application
`has to pass FIFO parameters to its FIFO Mes sageActionProc it should use this
`routine to set the parameter. DSPFI FOGe tRe f Con can be used from inside the
`Mes sageActionProc routine to get the FIFO parameter that was set up by the client.
`
`For more information about Me s s ageAct ionProc see ”Sending Messages,” earlier in
`this chapter.
`
`Real Time Manager Reference
`
`Page 205 of 500
`
`Page 205 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`DSPFIFOGetMessageMode
`
`The DSPFIFOGetMes sageMode routine returns the mode of the specified FIFO.
`
`pascal unsigned long DSPFIFOGetMessageMode
`theFIFORefNum);
`
`(DSPFIFORefNum
`
`Field descriptions
`—)
`theFIFORefNum
`<-
`FunctionResult
`
`The FIFO reference number.
`
`The current value of the FIFO’s flags.
`
`DESCRIPTION
`
`The DSPFIFOGetMes sageMode routine returns the mode set by the
`DSPFIFOSetMessageModeroufine
`
`DSPFIFOSetMessageMode
`
`DESCRIPTION
`
`The DSPFIFOSetMes sageMode routine sets the message passing mode for a FIFO.
`
`pascal OSErr DSPFIFOSetMessageMode (
`
`DSPFIFORefNum
`
`theFIFORefNum,
`
`unsigned long
`
`theFlags);
`
`Field descriptions
`—)
`theFIFORefNum
`<-
`
`theFlags
`
`The FIFO reference number.
`
`The desired value of the FIFO’s flags.
`
`The DSPFIFOSetMes sageMode routine is used to enable or disable message passing
`from the DSP to the FIFO. Setting theFlags to kdspMaskAllMes sages will disable
`all messaging. Setting theFlags to kdspHalfMessageEnable will enable the half
`empty/full messages. Setting theFlags to kdspTerminationMes sageEnable will
`enable the empty/ full message.
`
`To transfer data from the host to the DSP, the typical steps to follow are to set the mode
`to kdspHal fMes sageEnable until the host runs out of data, then set the mode to
`
`kdspTerminationMes sageEnable. When the empty message comes in, set the mode
`to kdspMas kAllMes sages since the transfer is complete.
`
`Table 4-6 shows the Apple-defined message masks.
`
`For more information about message passing see ”Sending Messages,” earlier in
`this chapter.
`
`Real Time Manager Reference
`
`Page 206 of 500
`
`Page 206 of 500
`
`
`
`CHAPTER 4
`
`Real ‘lime Manager
`
`Table 4-6
`
`Message masks
`
`Message
`
`Comments
`
`kd sp F I F0)/Ia s kAl lMe s s a ge s
`
`kdspFIFO3nableOverUnderMessage
`
`kdspFIFO3nableFullEmptyMessage
`
`kdspFIFO3nableHighLowMessage
`
`kdspFIFO3nableLinkMessage
`
`Disable all messages, (p) priority of FIFO
`messages in descending order
`
`(4) enable message when FIFO transfer
`causes an overrun or underrun
`
`(3) enable message when FIFO is full
`or empty
`
`(2) enable message when FIFO is at least
`half full or half empty
`
`(1) enable message when FIFO's link
`was traversed
`
`kdspFIFOOverUnderTaskInactive
`
`If task accessing FIFO causes either FIFO
`overrun or underrun then set task inactive
`
`kdspFIFOFullEmptyTaskInactive
`
`If task accessing FIFO causes either FIFO
`full or empty then set task inactive
`
`DSPFIFOGetMessageActionProc
`
`The DSPFI FOGetMe s sageAct ionProc routine returns a pointer to the specified FIFOS
`message action procedure.
`
`pascal OSErr DSPFIFOGetMessageActionProc (
`DSPFIFORefNum
`theFIFORefNum,
`
`MessageActionProc
`
`*theVector);
`
`Field descriptions
`—>
`theFIFORefNum
`(—
`thevector
`
`The FIFO reference number.
`
`The FIFO message action procedure.
`
`DESCRIPTION
`
`The DSPFIFOGetMessageActionProc routine provides the location of the specified
`FIFOs message action procedure. The result is used to get or set the messages associated
`with the FIFO.
`
`For more information about Me s s ageActionProc see ”Sending Messages,” earlier in
`this chapter.
`
`Real Time Manager Reference
`
`Page 207 of 500
`
`Page 207 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`DSPFIFOSetMessageActionProc
`
`The DS PF I FOS etMe s s ageAct i on Proc routine sets the location of the message action
`procedure for the specified FIFO.
`
`pascal OSErr DSPFIFOSetMessageActionProc (
`DSPFIFORefNum
`theFIFORefNum,
`
`MessageActionProc
`
`*theVector);
`
`Field descriptions
`—>
`theFIFORe fNum
`—>
`thevector
`
`The FIFO reference number.
`
`The FIFO message action procedure.
`
`DESCRIPTION
`
`The DsPFIFOSetMes sageActionProc routine sets the location of the specified FIFO’s
`message action procedure. The location is used to get or set the messages associated with
`the FIFO.
`
`For more information about Me s s ageActionProc see ”Sending Messages,” earlier in
`this chapter.
`
`DSPFIFOSetMessageThreshold
`
`The DSPFIFOSetMessageThreshold routine sets the byte level that triggers a
`FIFO message.
`
`pascal OSErr DSPFIFOSetMessageThreshold (
`DSPFIFORefNum
`theFIFORefNum,
`
`unsigned long
`
`theThreshold);
`
`Field descriptions
`—>
`theFI FORe fNum
`—>
`theThreshold
`
`The FIFO reference number.
`
`The desired Value of the threshold in bytes.
`
`DESCRIPTION
`
`The DSPFIFOSetMes sageThreshold routine is used by a client application to set the
`minimum number of bytes, the theThreshold value, from the beginning or end of the
`FIFO memory that are needed to generate the interrupt, as shown in Figure 4-13. The
`theThre shold value is an application—specific parameter subject to these rules:
`
`Reading data:
`
`When the FIFO has been filled with the threshold amount of data,
`then an interrupt will be generated.
`
`Real Time Manager Reference
`
`Page 208 of 500
`
`Page 208 of 500
`
`
`
`CHAPTER 4
`
`Real ‘lime Manager
`
`Writing data:
`
`When the FIFO has been emptied by the amount of the threshold,
`then an interrupt will be generated.
`
`Maximum theThreshold Value = FIFOSize — 4 bytes
`
`Minimum theThreshold Value = 4 bytes
`
`Figure 4-13
`
`FIFO threshold
`
`Write threshold
`
`Read threshold
`
`FIFO memory
`
`Summary of the Real Time Manager
`
`Constants
`
`All Constants used in real-time software are listed in Chapter 5, ”DSP Operating
`System.” Only the constants referred to in the present chapter are listed here.
`
`// ---------------------------------------------------------------- --
`
`// DSPManager Version Number
`// ---------------------------------------------------------------- --
`
`kdspManagerBuildVersion
`
`OXOOOOOOOX
`
`// last digit is version number
`
`// ---------------------------------------------------------------- --
`
`// constants used by a client to specify where to insert a task
`// ———————————————————————————————————————————————————————————————— --
`
`kdspHeadInsert
`
`kdspTailInsert
`
`OXOOOOOOO4
`
`// insert at head of list
`
`OXOOOOOOO8
`
`// insert at tail of list
`
`kdspBeforeInsert
`
`0x00000010
`
`// insert before reference link
`
`kdspAfterInsert
`
`OxOOOOOO2O
`
`// insert after reference link
`
`kdspAnyPositionInsert
`
`kdspHeadInsert // insert anywhere in list
`
`184
`
`Summary of the Real Time Manager
`
`Page 209 of 500
`
`Page 209 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`// ———————————————————————————————————————————————————————————————— --
`tasks
`
`// constants for messages received by client
`// ———————————————————————————————————————————————————————————————— --
`Ox62696f7O
`
`'biop'
`state)
`uf
`u
`
`kdspBIOPinChangedState
`
`//
`
`(bio pin has changed
`
`kdspFIFOMessage
`
`kdspFIFOLinkMessage
`
`kdspFIFOOverrunMessage
`
`Ox66000OOO
`
`Ox666c6e6b
`
`Ox666f7672
`
`kdspFIFOUnderrunMessage
`
`Ox66756e64
`
`kdspFIFOFullMessage
`
`kdspFIFOEmptyMessage
`
`kdspFIFOHighMessage
`
`Ox6666756c
`
`Ox66656d7O
`
`OX66686967
`
`kdspFIFOLowMessage
`
`Ox666c6f77
`
`kdspFIFOPrimeMessage
`
`0x66707269
`
`0x78000000
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`(prefix used for FIFO
`
`messages)
`'flnk'
`(the FIFO's link was
`
`traversed)
`'fovr‘
`
`(the FIFO's buffer
`filled before the FIFO write
`
`completed)
`‘fund’
`(the FIFO's buffer
`
`emptied before the FIFO read
`
`completed)
`'fful'
`(the FIFO's buffer is
`
`exactly full)
`(the FIFO's buffer is
`
`'femp'
`
`empty)
`
`(the FIFO's buffer is
`'fhig‘
`at least half full but not
`
`exactly full)
`‘flow’
`(the FIFO's buffer is
`
`at least half empty but not
`
`exactly empty)
`
`'fpri'
`
`(application—specific)
`
`(prefix for dsp
`
`kdspExceptionMessage
`
`kdspExceptionReset
`
`kdspExceptionBusError
`
`kdspExceptionIllegalopcode
`
`kdspExceptionReservedOne
`
`kdspExceptionAddressError
`
`kdspExceptionDAUOverUnderflow
`
`kdspExceptionNotANumber
`
`kdspExceptionReservedTwo
`
`kdspExceptionExternalIntZero
`
`kdspExceptionTimer
`
`kdspExceptionReservedThree
`
`kdspExceptionSIOInputBufFull
`
`kdspExceptionSIOOutputBufEmpty
`
`kdspExceptionSIODMAInputFrame
`
`kdspExceptionSIODMAOutputFrame
`
`0x78727374
`
`0x78627573
`
`Ox78696c6c
`
`0x78727631
`
`0x78616472
`
`0x78646175
`
`Ox786e6l6e
`
`0x78727632
`
`0x78657830
`
`Ox7874696d
`
`0x78727633
`
`0x78736962
`
`Ox78736f62
`
`0x78736966
`
`Ox78736f66
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`x
`
`'
`
`exception messages)
`'xrst'
`
`'xbus'
`
`'xill'
`
`'xrvl‘
`
`'xadr'
`
`'xdau‘
`
`'xnan'
`
`'xrv2'
`
`'xexO'
`
`'xtim'
`
`'xrv3‘
`
`'xsib'
`
`'xsob'
`
`'xsif'
`
`'xsof'
`
`Summary of the Real Time Manager
`
`Page 210 of 500
`
`Page 210 of 500
`
`
`
`CHAPTER 4
`
`Real '|'Ime Manager
`
`kdspExceptionExternalIntOne
`
`kdspExceptionRuntimeError
`
`kdspGPBMessage
`
`kdspGPBTaskActive
`
`kdspGPBTaskInactive
`
`kdspGPBFrameOverrun
`
`0x78657831
`
`0x78657272
`
`0x67000000
`
`0x67616374
`
`Ox67696e61
`
`Ox676f7672
`
`kdspGPBFrameSkip
`
`Ox67736b7O
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`'xexl'
`
`'xerr'
`
`lg
`
`I
`
`(prefix used for GPB
`
`messages)
`
`'gact'
`
`(the task is active)
`
`'gina'
`
`(the task is inactive)
`
`(this task was
`'govr'
`involved in a frame overrun
`
`and is now inactive)
`
`.gSkp.
`(this task has skipped
`one or more frames due to a
`
`frame overrun)
`
`// ———————————————————————————————————————————————————————————————— --
`
`// read/write permission constants for clients
`// ———————————————————————————————————————————————————————————————— --
`OxOOO1
`
`kdspWritePermission
`
`kdspReadPermission
`
`OxOOO2
`
`kdspReadWritePermission
`
`(kdspWritePermission I kdspReadPermission)
`
`// ———————————————————————————————————————————————————————————————— --
`
`// FIFOFlags
`// ———————————————————————————————————————————————————————————————— --
`0x00000000
`
`kdspFIFOMaskAllMessages
`
`kdspFIFOEnableOverUnderMessage
`
`0x00000001
`
`kdspFIFOEnableFullEmptyMessage
`
`0x00000002
`
`kdspFIFOEnableHighLowMessage
`
`0x00000004
`
`kdspFIFOEnableLinkMessage
`
`kdspFIFOOverUnderTaskInactive
`
`0x00000008
`
`0x00000010
`
`kdspFIFOFullEmptyTaskInactive
`
`0x00000020
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`disable all messages
`
`(p)
`
`priority of FIFO messages in
`
`descending order
`
`(4) enable message when FIFO
`transfer causes an overrun
`
`or underrun
`
`(3) enable message when FIFO
`
`is full or empty
`
`(2) enable message when FIFO
`is at least half full or
`
`half empty
`
`(1) enable message when
`FIFO's link was traversed
`
`if task accessing FIFO causes
`either FIFO overrun or
`
`underrun then set task
`
`inactive
`
`if task accessing FIFO
`causes either FIFO full or
`
`empty then set task inactive
`
`Summary of the Real Time Manager
`
`Page 211 of 500
`
`Page 211 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`// ---------------------------------------------------------------- --
`
`// GPBFlags
`// ---------------------------------------------------------------- --
`
`kdspLumpyModule
`
`kdspSmoothModule
`
`OXOOOOOOOO
`
`// use bnEstimate
`
`OxOOOOOOOl
`
`// use bnActual
`
`// ---------------------------------------------------------------- --
`
`// SectionFlags
`// ---------------------------------------------------------------- --
`
`// Costs the DSP one instruction to use the following flags:
`
`kdspLeaveSection
`
`kdspLoadSection
`
`kdspsavesection
`
`kdspclearsection
`
`OXOOOOOOOO
`
`// do not
`
`load or save this section
`
`OxOOOOOOOl
`
`// load this section
`
`0x00000002
`
`// save this section
`
`OXOOOOOOO4
`
`// fill this section with zeroes
`
`kdspsaveoncontextswitch
`
`0x00000008
`
`// save this section on context
`// switch
`
`kdspExternal
`
`kdspBankA
`
`kdspBankB
`
`kdspAnyBank
`
`OXOOOOOOOO
`
`// never loaded on chip
`
`OxOOOOOO2O
`
`// Load in Bank A if possib;
`
`OxOOOOOO4O
`
`// load in Bank B if possibl
`
`(kdspBankA | kdspBankB)//
`
`load anywhere
`
`kdspstaticsection
`
`0x00000080
`
`// this section statically
`// allocated before runtime
`
`kdspFIFOSection
`
`OxOOOOO1OO
`
`// section is a FIFO buffer
`
`kdspReservedSectionFlag0200
`
`0x00000200
`
`// reserved
`
`kdspLoadFIFOSection
`
`kdspSaveFIFOSection
`
`kdspHIHOSection
`
`0x00000400
`
`// when loading convert from a FIFO
`
`0x00000800
`
`// when saving convert to a FIFO
`
`0x00001000
`
`// this is a HIHO Section
`
`kdspReservedForToggleSectionTbl OxOOOO2000// holds the kdspToggleSectionTable
`
`// flag from the module's flag
`
`kdspLoadHIHOSection
`
`kdspSaveHIHOSection
`
`OxOOOO4000
`
`// when loading convert from a HIHO
`
`OxOOOO8000
`
`// when saving convert to a HIHO
`
`// Costs the DSP two instructions to use the following flags:
`
`kdspNotIOBufferSection
`
`OxOOO1000O
`
`// all cases other than below
`
`kdspInputBuffer
`
`kdspOutputBuffer
`
`kdspITBSection
`
`OxOOO2000O
`
`// section is an input buffer
`
`OxOOO4000O
`
`// section is an output buffer
`
`OxOOO8000O
`
`// section is an InterTask Buffer
`
`kdspscalablesection
`
`0x00100000
`
`// section size can be scaled
`
`kdspSectionAllocated
`
`0x00200000
`
`// reserved for use by the DSP
`
`kdspDSPUseOnly
`
`OxOO4000OO
`
`// only DSP should modify this
`
`// Manager
`
`// memory
`
`Summary of the Real Time Manager
`
`Page 212 of 500
`
`Page 212 of 500
`
`
`
`CHAPTER 4
`
`Real '|'Ime Manager
`
`// ---------------------------------------------------------------- --
`
`// SectionDataTypes
`// ---------------------------------------------------------------- --
`
`kdspNonData
`
`OXOOOOOOOO
`
`// data in section is beyond
`
`kdsp32OOF;oat
`
`kdspIEEEFloat
`
`kdspInt32
`
`kdspIntl616
`
`kdspInt8888
`
`kdspmuLaw
`
`kdspALaw
`
`// description
`
`OXOOOOOOO1
`
`// data is in 3200 float format
`
`OxOOOOOOO2
`
`// data is in Inna float format
`
`OXOOOOOOO3
`
`// data is 32bi: integer
`
`OXOOOOOOO4
`
`// data is l6bit integer packed
`
`0x00000005
`
`// data is 8bit integer packed
`
`OXOOOOOOO6
`
`// data ' muLaw format
`
`OXOOOOOOO7
`
`// data ' Alaw format
`
`kdspAppSpecificData
`
`OXOOOOFFFF
`
`// data '
`
`application—specific
`
`// ---------------------------------------------------------------- --
`
`// the processor types 'ptyp'
`// ---------------------------------------------------------------- --
`
`kdsp32lO
`
`kdsp32C
`
`'32lO'
`
`'32C '
`
`// DSP32lO hardware compatible
`
`// DSP32C hardware compatible
`
`Data Types
`
`DSPPosition:
`
`DSPCycles:
`
`unsigned '
`
`unsigned '
`
`// type for position parameter
`
`// type for processing bandwidth
`
`DSPClientRefNum:
`
`unsigned '
`
`// type for JSPClient reference number
`
`DSPIODeviceRefNum:
`
`unsigned '
`
`// type for DSPIODevice reference number
`
`DSPCPUDeviceRefNum:
`
`unsigned
`
`// type for )SPCPUDevice reference number
`
`3SPTaskRefNum:
`
`unsigned '
`
`// type for DSPTask reference number
`
`DSPModuleRefNum:
`
`unsigned
`
`// type for DSPModule reference number
`
`DSPSectionRefNum:
`
`unsigned '
`
`// type for 3SPSection reference number
`
`)SPFIFORefNum:
`
`unsigned '
`
`// type for DSPFIFO reference number
`
`DSPLinkedFIFORefNum: unsigned '
`
`// type for DSPLinkedFIFO ref number
`
`DSPSynchRefNum:
`
`unsigned '
`
`// type for TaskToSynch and SynchTasks
`// reference number
`
`pascal void (*MessageActionProc)(struct DSPMessage *theMessage);
`
`enum DSPConnectionType {
`
`kdspDirectConnection,
`
`kdspIndirectConnection,
`
`kdspHIHOConnection
`
`};
`
`Summary of the Real Time Manager
`
`Page 213 of 500
`
`Page 213 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`enum DSPTaskPriority {
`
`kdspRealTime,
`
`kdspTimeShare
`
`};
`
`enum {
`
`kdspTaskIsActive,
`
`kdspTaskIsInactive,
`
`kdspTaskIsGoingInactive,
`
`kdspTaskIsGoingActive,
`
`kdspInvalidTask
`} DSPTaskStatus;
`
`JSPCPUDeviceParamBlk
`
`*JSPCPUDeviceParamBlkPtr,
`**DSPCPUDeViceParamBlkHandle;
`
`DSPIODeviceParamBlk
`
`*DSPIODeviceParamBlkPtr,
`
`**DSPIODeviceParamBlkHandle;
`
`)SPBIODeviceParamBlk
`
`*DSPBIODeviceParamBlkPtr,
`
`**DSPBIODeviceParamB'kHand'e;
`
`3SPSIODeviceParamBlk
`
`*3SPSIODeviceParamBlkPtr,
`
`3SPClientInfoParamBlk
`
`DSPTaskInfoParamBlk
`
`DSPModuleInfoParamBlk
`
`**DSPSIODeviceParamB‘kHand‘e;
`
`*3SPClientInfoParamBlkPtr,
`**DSPClientInfoParamBlkHandle;
`
`*DSPTaskInfoParamBlkPtr,
`*3SPTaskInfoParamBlkHandle;
`
`*DSPModuleInfoParamBlkPtr,
`**DSPModuleInfoParamBlkHandle;
`
`DSPSectionInfoParamBlk
`
`*DSPSectionInfoParamBlkPtr,
`
`**DSPSectionInfoParamBlkHandle;
`
`DSPGPBModeIndicator
`
`*DSPGPBModeIndicatorPtr,
`
`*DSPGPBModeIndicatorHandle;
`
`Data Structures
`
`//
`
`// DSPFIFOAddress
`
`// ————————————————————————————————————————————————————————————————--
`
`struct DSPFIFOAddress
`
`{
`
`struct DSPFIFO *l;
`
`// logical pointer
`
`struct DSPFIFO *p;
`};
`
`// physical pointer
`
`Summary of the Real Time Manager
`
`Page214of5OO
`
`Page 214 of 500
`
`
`
`CHAPTER 4
`
`Real '|'Ime Manager
`
`// ——————————————————————————————————————————————————————————--
`
`// DSPParamBlkHeader
`
`This parameter block header is shared between the
`DSPIODeviceParamblock and the DSPCPUDeviceParamBlk. The
`
`reason we declare things this way is so that we can have
`
`routines that operate only on the common parts of the
`
`structures therefore making the code smaller, easier to
`
`write, easier to maintain, etcm
`
`pbhDeviceIndex
`
`the index for this device
`
`pbhClientPermission
`
`read/write permission for this client
`
`pbhC;ientRefNum
`
`the reference number for this client
`
`pbhC;ientName
`
`pbhCLientICON;
`
`pbhDeviceName
`
`pbhDeviceICON
`
`the name of this client
`
`handle to client's icon
`
`the device name for the io or cpu device
`
`the device icon for the io or cpu device
`
`//
`//
`
`//
`
`//
`
`//
`
`//
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`//
`
`//
`
`#define DSPDeviceParamBlkHeader\
`
`unsigned short
`
`unsigned short
`
`pbhDeviceIndex;\
`
`pbhClientPermission;\
`
`DSPClientRefNum
`
`pbhClientRefNum;\
`
`Str3;
`
`Handle
`
`Str31
`
`Handle
`
`pbhClientName;\
`
`pbhC;ientICON;\
`
`pbhDeviceName;\
`
`pbhDeviceICON;\
`
`// ————————————————————————————————————————————————————————————————--
`
`// DSPDeviceParamBlk:
`
`//
`
`struct DSPDeviceParamBlk {
`DSPDeViceParamBlkHeader
`
`};
`
`// ————————————————————————————————————————————————————————————————--
`
`// DSPCPUDeviceParamBlk:
`
`//
`//
`
`This parameter block is used for controlling a cpu device. It
`shares the DSPParamBlkHeader with the io device.
`
`// ————————————————————————————————————————————————————————————————--
`
`Summary of the Real Time Manager
`
`Page 215 of 500
`
`Page 215 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`struct DSPCPUDeviceParamBlk {
`DSPDeviceParamBlkHeader
`
`unsigned char
`
`cpuSlotNumber;
`
`// the slot number the card is in
`
`unsigned char
`
`cpuProcessorNumber;
`
`// the processor number, zero based
`
`OSType
`
`DSPCycZ
`
`DSPCyc;es
`
`DSPCycles
`
`DSPCycles
`
`cpuProcessorType;
`
`// the type of the processor
`
`cpuMaxCycles;
`
`// max processor execution cycles per
`// frame
`
`cpuAllocatedCycles;
`
`// num cycles currently allocated
`
`cpuCurRealTimeLoading;// num cycles used during the last
`// frame
`
`cpuTimeShareLoading; // num cycles it took for timeshare
`// list
`
`DSPCyc;es
`
`cpuTimeShareFreq;
`
`// how often the timeshare list is run
`
`unsigned long
`
`cpuFrameRate;
`
`// num frames per second for this cpu
`// device
`
`MessageActionProc
`};
`
`cpuClientMessageActionProc;
`
`// ————————————————————————————————————————————————————————————————--
`
`// DSPIODeviceParamBlk
`
`//
`
`This parameter block is used for controlling an io device.
`
`It shares the DSPParamBlkHeader with the cpu device.
`//
`// ————————————————————————————————————————————————————————————————--
`
`struct DSPIODeviceParamBlk {
`DSPDeviceParamBlkHeader
`
`unsigned short iopbIODeviceIndex;
`
`// index of this io device
`
`unsigned short iopbIODeviceType;
`
`// type of this io device
`
`unsigned char
`};
`
`iopbReserved[32];
`
`// data specific to the i0 device
`
`struct DSPBIODeviceParamBlk {
`DSPDeviceParamBlkHeader
`
`unsigned short iopbIODeviceIndex;
`
`// index of this io device
`
`unsigned short iopbIODeviceType;
`
`// type of this io device
`
`struct DSPMessage *bioMessageHandler;// gets called when state of bio pin
`
`unsigned char bioPinState;
`
`// 0 = logic level low,
`
`l = logic
`
`// changes
`
`unsigned char bioPinDirection;
`
`// O = input only,
`
`1 = output only
`
`unsigned char bioPinIntEnable;
`
`// O = interrupt masked,
`// enabled
`
`l = interrupt
`
`// level high
`
`unsigned char bioReserved[25];
`};
`
`// reserved space
`
`Summary of the Real Time Manager
`
`Page 216 of 500
`
`Page 216 of 500
`
`
`
`CHAPTER 4
`
`Real '|'Ime Manager
`
`struct DSPSIODeviceParamBlk {
`DSPDeviceParamBlkHeader
`
`unsigned
`
`unsigned short iopbIODeviceType;
`
`short iopbIODeviceIndex;//
`//
`
`index of this io device
`
`type of this io device
`
`unsigned long
`
`sioSampleRate;
`
`unsigned long
`
`sioSampleFormat;
`
`DSPFIFOAddress
`
`DSPFIFOAddress
`
`unsigned char
`
`sioInputFIFO;
`
`sioOutputFIFO;
`sioDMAEnable;
`
`unsigned char
`
`sioFeatures;
`
`unsigned char
`};
`
`sioReserved[6];
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`//
`
`sample rate for this io device, both
`
`input and output
`
`sample size for this io device, both
`
`input and output
`
`pass the physical ptr to your dsp code
`
`pass the physical ptr to your dsp code
`0 = off,
`1 =
`
`on, enables both input
`
`and output
`indicates if the io device can be used
`
`for standard sound etcm
`
`reserved space
`
`//
`
`//
`
`//
`
`//
`
`DSPBandwidth:
`
`is used to represent guaranteed processing
`bandwidth information.
`
`struct DSPBandwidth {
`
`DSPCycles
`
`DSPCycles
`
`bnEstimate;
`
`bnActual;
`
`unsigned long bnFlags;
`};
`
`//
`
`//
`
`//
`
`//
`
`bn
`bandwidth
`worst- case pre—runtime
`worst-
`case runtime
`
`control flags
`
`//
`
`//
`DSPMessage: used for passing messages back and forth between the
`// kernel and the driver.
`
`//
`
`struct DSPMessage {
`
`MessageActionProc
`
`msvector;
`
`// vector of routine
`
`unsigned long
`};
`
`msData[3];
`
`// application-specific data
`
`// ———————————————————————————————————--
`
`// DSPGPBModeIndicator:
`
`used for requesting more (or less) GPB when
`
`// a module is running.
`//
`
`struct DSPGPBModeIndicator
`
`{
`
`unsigned short miCurrentMode;
`
`// mode in which the module is operating
`//
`
`(only the DSP code should change this)
`
`Summary of the Real Time Manager
`
`Page 217 of 500
`
`Page 217 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`unsigned short miNextMode;
`
`// (only the Real Time Manager should
`
`// change this)
`
`};
`
`// ---------------------------------------------------------------- --
`
`// Get Info Parameter Blocks
`
`// ———————————————————————————————————————————————————————————————— --
`
`// DSPClientInfoParamB;k
`
`//
`
`this parameter block is used for getting information about a
`
`client that is signed into the DSP Manager.
`//
`// ---------------------------------------------------------------- --
`
`struct DSPClientInfoParamBlk {
`
`DSPClientRefNum
`
`ciC;ientRefNum;
`
`// returned ref num of the client
`
`unsigned short
`
`ciCLientPermission;
`
`// returned read/write permission
`// of the client
`
`Handle
`
`Str3l
`
`};
`
`ciC;ientICON;
`
`ciC;ientName;
`
`// returned icon of the client
`
`// returned name of the client
`
`// ---------------------------------------------------------------- --
`
`// DSPTaskInfoParamBlk
`
`//
`//
`
`this parameter block is used for getting information about a
`task that is installed on the DSP.
`
`// ---------------------------------------------------------------- --
`
`struct DSPTaskInfoParamBlk {
`
`DSPTaskRefNum
`
`tiRefNum;
`
`// returned reference number for this task
`
`unsigned long
`
`tiRefCon;
`
`// returned application—specific info
`
`MessageActionProc tiVector;
`
`// returned vector of task action proc
`
`unsigned long
`Str3l
`
`tiFlags;
`tiName;
`
`// returned flags for DSP task control
`// returned name of this DSP task
`
`};
`
`// ---------------------------------------------------------------- --
`
`// DSPModuleInfoParamBlk
`
`//
`//
`
`this parameter block is used for getting information about a
`module that is installed on the DSP.
`
`// ---------------------------------------------------------------- --
`
`struct DSPModuleInfoParamBlk {
`
`DSPModuleRefNum
`
`miRefNum;
`
`// returned reference number of this
`
`struct DSPBandwidth miGPB;
`
`// module
`
`// returned guaranteed processing
`// bandwidth
`
`unsigned long
`
`unsigned long
`
`miFlags;
`
`// returned module flags
`
`miNumSections; // returned number of sections in
`// module
`
`Summary of the Real Time Manager
`
`Page 218 of 500
`
`Page 218 of 500
`
`
`
`CHAPTER 4
`
`Real '|'Ime Manager
`
`Str3l
`
`miName;
`
`// returned name of DSP module
`
`unsigned long
`
`unsigned long
`};
`
`miExecutions;
`
`// returned number of executions
`
`miskipcount;
`
`// returned number of modules to skip
`
`// ---------------------------------------------------------------- --
`
`// DSPSectionInfoParamBlk
`
`//
`//
`
`this parameter block is used for getting information about a
`section that is installed on the DSP.
`
`// ---------------------------------------------------------------- --
`
`struct DSPSectionInfoParamBlk {
`
`DSPSectionRefNum siRefNum;
`
`// returned reference number for this
`
`unsigned long
`
`sisize;
`
`// section
`
`// returned size of data in actual
`// section
`
`unsigned long
`
`siFlags;
`
`// returned section flags
`
`unsigned long
`
`siType;
`
`// returned for section connection type
`
`Str3l
`
`Ptr
`
`Ptr
`
`siName;
`
`// checking
`// returned name of this section
`
`siPrimary;
`
`// returned location of section data
`
`sisecondary;
`
`// returned optional section data storage
`// location
`
`DSPSectionRefNum siPrevSection; // returned previous connection
`DSPSectionRefNum siNextSection; // returned next connection
`
`DSPFIFORefNum
`
`siFIFORefNum;
`
`// returned reference number of the FIFO
`
`};
`
`Trap Macros and Routine Selectors
`
`//==================================================================
`
`// misc dispatcher constants & macros
`//
`
`_DSPDispatch
`#define
`#define MOVEL
`
`OxABF5
`Ox303C
`
`#define DSPDispatch(select)
`
`{MOVEL,select,_DSPDispatch};
`
`//==================================================================
`
`// dispatch selectors for external routines
`// ——————————————————————————————————————————————————————————————————
`
`#define kdspGetTrapAddress
`
`#define kdspSetTrapAddress
`
`#define kdspGetIndexedCPUDevice
`
`#define kdspOpenCPUDevice
`
`Summary of the Real Time Manager
`
`Page 219 of 500
`
`Page 219 of 500
`
`
`
`CHAPTER 4
`
`Real ‘Fme Manager
`
`kdspCloseCPUDevice
`
`kdspGetIndexedCPUDeviceOption
`
`kdspsetIndexedCPUDeviceOption
`
`kdspGetIndexedIODevice
`
`kdspOpenIODevice
`
`kdspCloseIODevice
`
`kdspGetIndexedIODeviceOption
`
`kdspsetIndexedIODeviceOption
`
`kdspSignInCPUDevice
`
`kdspSignOutCPUDeVice
`
`kdspSignInIODevice
`
`kdspSignOutIODevice
`
`kdspLoadModule
`
`kdspUnloadModule
`
`kdspconnectsections
`
`kdspNewInterTaskBuffer
`
`kdspNewTask
`
`kdspDisposeTask
`
`kdspInsertTask
`
`kdspManagerVersion
`
`kdspRemoveTask
`
`kdspTaskToSynchronize
`
`kdspAddressInZone
`
`kdspSynchronizeTasks
`
`kdspSetTaskActive
`
`kdspSetTaskInactive
`
`kdspcreatezone
`
`kdspNewAddress
`
`kdspDisposeAddress
`
`kdspGetAddressSize
`
`kdspGetZoneSize
`
`kdspGetAddress
`
`kdspGetZone
`
`kdspInsertDoub;e
`
`kdspRemoveDoub;e
`
`kdspInsertSing;e
`
`kdspRemoveSing;e
`
`kdspGetSection
`
`kdspNewFIFO
`
`kdspDisposeFIFO
`
`kdspGetSectionData
`
`kdspFIFORead
`
`kdspFIFOWrite
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`#define
`
`Summary of the Real Time Manager
`
`Page 220 of 500
`
`Page 220 of 500
`
`
`
`CHAPTER 4
`
`Real '|'Ime Manager
`
`#define kdspFIFOGe:ReadCount
`
`#define kdspFIFOGetWr