Secondary processor execution kernel framework6996699Abstract Preparing one or more secure media effect programs, generating a binary image of the programs and associated data, loading the binary image into memory of a secondary processor, and executing the programs of the binary image with the secondary processor, substantially independent from a primary processor. A binary image builder automatically maps one or more programs and data to secondary processor memory by changing encoded binary instructions of each program before execution by the secondary processor. The changes identify locations at which the programs and data will be stored in secondary processor memory, identify locations of parameters that can be updated in real time, and enable execution control to return to a secondary processor execution kernel. The secondary processor execution kernel polls flags in a main memory to determine whether to download new or updated state data and/or program code from main memory to the secondary processor memory. Claims The invention in which an exclusive right is claimed is defined by the following: Description FIELD OF THE INVENTION
FIG. 3 shows functional components of gaming system 100 in greater detail. Game console 102 includes a central processing unit (CPU) 200, and a memory controller 202 that facilitate processor access to a read-only memory (ROM) 204, a random access memory (RAM) 206, a hard disk drive 208, and portable media drive 106. CPU 200 is equipped with a level 1 cache 210 and a level 2 cache 212 to temporarily store data so as to reduce the number of memory access cycles required, thereby improving processing speed and throughput. CPU 200, memory controller 202, and various memory devices are interconnected via one or more buses, including serial and parallel buses, a memory bus, a peripheral bus, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures can include an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA (EISA) bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus. As an example of one suitable implementation, CPU 200, memory controller 202, ROM 204, and RAM 206 are integrated onto a common module 214. In this implementation, ROM 204 is configured as a flash ROM that is connected to memory controller 202 via a PCI bus and a ROM bus (neither of which are shown). RAM 206 is configured as multiple Double Data Rate Synchronous Dynamic RAMs (DDR SDRAMs) that are independently controlled by memory controller 202 via separate buses (not shown). Hard disk drive 208 and portable media drive 106 are connected to the memory controller via the PCI bus and an Advanced Technology Attachment (ATA) bus 216. A three-dimensional (3D) graphics processing unit (GPU) 220 and a video encoder 222 form a video processing pipeline for high-speed and high-resolution graphics processing. Data are carried from graphics processing unit 220 to video encoder 222 via a digital video bus (not shown). An audio processing unit 224 and an audio encoder/decoder (CODEC) 226 form a corresponding audio processing pipeline for high fidelity and stereo audio data processing. Audio data are carried between audio processing unit 224 and audio CODEC 226 via a communication link (not shown). The video and audio processing pipelines output data to an A/V port 228 for transmission to the television or other display monitor. In the illustrated implementation, video and audio processing components 220-228 are mounted on module 214. Also implemented by module 214 are a USB host controller 230 and a network interface 232. USB host controller 230 is coupled to CPU 200 and memory controller 202 via a bus (e.g., the PCI bus), and serves as a host for peripheral controllers 104a-104d. Network interface 232 provides access to a network (e.g., the Internet, home network, etc.) and may be any of a wide variety of various wire or wireless interface components, including an Ethernet card, a telephone modem interface, a Bluetooth module, a cable modem interface, an xDSL interface, and the like. Game console 102 has two dual controller support subassemblies 240a and 240b, with each subassembly supporting two game controllers 104a-104d. A front panel I/O subassembly 242 supports the functionality of power button 112 and eject button 114, as well as any light-emitting diodes (LEDs) or other indicators exposed on the outer surface of the game console. Subassemblies 240a, 240b, and 242 are coupled to module 214 via one or more cable assemblies 244. Eight function units 140a-140h are illustrated as being connectable to four controllers 104a-104d, i.e., two function units for each controller. Each function unit 140 offers additional functionality or storage on which games, game parameters, and other data may be stored. When an MU is inserted into a controller, the MU can be accessed by memory controller 202. A system power supply module 250 provides power to the components of gaming system 100. A fan 252 cools the components and circuitry within game console 102. To implement the present invention, a game software application 260 comprising machine instructions stored on a DVD or other storage media (or downloaded over the network) is loaded into RAM 206 and/or caches 210, 212 for execution by CPU 200. Portions of software application 260 may be loaded into RAM only when needed, or all of the software application (depending on its size) may be loaded into RAM 206. Software application 260 is described below in greater detail. Gaming system 100 may be operated as a stand-alone system by simply connecting the system to a television or other display monitor. In this standalone mode, gaming system 100 enables one or more users to play games, watch movies, or listen to music. However, with connectivity to the Internet or other network, which is made available through network interface 232, gaming system 100 may be further coupled to another gaming system or operated as a component of a larger network gaming community, to enable online multiplayer interaction in games that are played over the Internet or other network with players using other gaming systems. Network System FIG. 4 shows an exemplary network gaming environment 300 that interconnects multiple gaming systems 100a, . . . 100n via a network 302. Network 302 represents any of a wide variety of data communications networks and may include public portions (e.g., the Internet), as well as private portions (e.g., a private LAN). Network 302 may be implemented using any one or more of a wide variety of conventional communications configurations including both wired and wireless types. Any of a wide variety of communications protocols can be used to communicate data via network 302, including both public and proprietary protocols. Examples of such protocols include TCP/IP, IPX/SPX, NetBEUI, etc. In addition to gaming systems 100, one or more online services 304a, . . . 304s are accessible via network 302 to provide various services for the participants, such as serving and/or hosting online games, serving downloadable music or video files, hosting gaming competitions, serving streaming A/V files, enabling exchange of email or other media communications, and the like. Network gaming environment 300 may further employ a key distribution center 306 that plays a role in authenticating individual players and/or gaming systems 100 for interconnection to one another as well as to online services 304a, . . . 304s. Distribution center 306 distributes keys and service tickets to valid participants that may then be used to form game playing groups including multiple players, or to purchase services from online services 304a, . . . 304s. Network gaming environment 300 introduces another memory source available to individual gaming systems 100, i.e., online storage. In addition to optical storage disc 108, hard disk drive 208, and MU(s), gaming system 100a can also access data files available at remote storage locations via network 302, as exemplified by remote storage 308 at online service 304s. Network gaming environment 300 further includes a developer service 309 with which developers can produce media effects, updated media data, game code, and other services. Such services can be distributed between the online services and the gaming systems, and between other devices within, and outside of network gaming environment 300. Exemplary Media Processing System and Audio Configuration A preferred embodiment of the present invention comprises an audio effects binary image builder, and a DSP execution kernel for processing an audio effects binary image on audio processing unit 224 of FIG. 3. FIG. 1 illustrates a preferred system for building an audio effects binary image. A method for building an audio effects binary image is described below with regard to FIGS. 7-12. FIG. 5 illustrates a preferred architecture of audio processing unit 224 for executing a DSP execution kernel to produce audio effects according to the audio effects binary image. The audio processing unit includes a setup engine 320 that is responsible for controlling access between console system memory and other processors within the audio processing unit. Preferably, setup engine 320 performs direct memory access (DMA) processing to gather data from console system memory and to convert the data, as necessary, to signed pulse code modulation (PCM) data, which is used by other components of the audio processing unit. Setup engine 320 also handles data addressing, including loop processing for downloadable sounds (DLS) compliance. Setup engine 320 communicates with a voice processor 322 (sometimes referred to as a VP), which is a primary PCM synthesis and sub-mixing engine. Voice processor 322 and setup engine 320 are in communication with a global processor 324 (sometimes referred to as a GP). Global processor 324 is a DSP that performs audio effects processing and creates final linear PCM stereo or multichannel output. Global Processor 324 comprises a programmable DSP core 330 in communication with a global processor memory 332. Global processor memory 332 preferably includes a ROM 334 and a RAM 335. Further, RAM 335 preferably comprises a data RAM that includes an X-RAM 336 and a Y-RAM 337 for concurrent processing of two data items in a single instruction. Those skilled in the art will recognize that a reference to X-RAM 336 could alternatively reference Y-RAM 337 and vise versa The data RAM stores DSP program state data and other data needed to execute audio effect DSP programs. Global processor RAM 335 also preferably includes a program RAM 338 for storing audio effect programs and a DSP execution kernel. Program RAM 338 is sometimes referred to as P-RAM. Global processor 324 and setup engine 320 communicate with an encode processor 326. Encode processor 326 provides real time Dolby digital and Dolby surround encoding. Encode processor 326 also monitors peak and root mean square (RMS) levels for individual audio streams as well as downmix for stereo output. In general, audio data, such as audio data provided in a software game, flows from the console system memory to setup engine 320, to voice processor 322, to global processor 324, to encode processor 326, and ultimately to one or more speakers. During the flow of audio data through the gaming system, one or more audio effects may be applied to the audio data by global processor 324. Audio effects include reverberation, filtering, distortion, echo, amplitude modulation, chorus, mixing, and other conventional or custom audio effects. Such effects are implemented by software loaded from console system memory and executed by global processor 324. Global processor 324 applies the software instructions to process the audio data in voice processor 322 and provides the resultant output to encode processor 326. FIG. 6 illustrates the logical flow described above in the form of a sample audio configuration for a computer game. Audio data sources 350, sometimes referred to as voices, are selectively routed to logical voice processor mixbins 360. For example, a game developer may choose to route recorded or live input audio data from voice one 352 to a front left speaker voice processor mixbin 362 and to a front right speaker voice processor mixbin 364. Similarly, audio data from a voice two 354 may be routed to an audio effect (FX) send zero voice processor mixbin 366. If the game developer does not wish to apply any audio effect to some of the audio data, the game developer may route the selected audio data directly to one of a plurality of global processor mixbins 370. For example, audio data stored in a low frequency encoding (LFE) speaker voice processor mixbin 365 may be routed directly to a corresponding LFE speaker global processor mixbin 375. Preferably, voice processor mixbins 360 and global processor mixbins 370 correspond to the same physical memory space. Thus, a direct routing simply indicates that no change is made to the audio data associated with LFE speaker voice processor mixbin 365. Alternatively, the game developer may choose to mix audio data from multiple locations. For example, audio data from front left speaker voice processor mixbin 362 may be mixed with audio data from FX send zero voice processor mixbin 366 and routed to front left speaker global processor mixbin 372. Again, voice processor mixbins 360 and global processor mixbins 370 represent the same physical memory space. Thus, mixing, or other processing, simply changes the audio data stored in a memory location associated with both sets of logical mixbins. If the game developer wishes to apply one or more audio effects, the global processor uses audio data from selected voice processor mixbins as input to one or more audio effect programs 380, and routes the corresponding output to predefined global processor mixbins. For example, the game developer may choose to apply a reverberation program 382 to audio data associated with FX send zero voice processor mixbin 366. In this example, reverberation program 382 complies with interactive 3D audio rendering guidelines, level two (I3DL2). The sample audio configuration of FIG. 6 illustrates that the global processor executes reverberation program 382 and mixes the output with audio data from front left speaker voice processor mixbin 362. The mixed result is routed to front left speaker global processor mixbin 372. Effectively, the mixbin memory location is overwritten with the mixed audio data. Multiple audio effects can be chained or applied in a sequence, such as the sequence illustrated by a chain 384. Chain 384 comprises an infinite impulse response, second order (IIR2) filter program 386 and a distortion program 388. IIR2 filter program 386 is applied to audio data associated with FX send two voice processor mixbin 368. Because there are multiple audio effects applied in chain 384, a temporary mixbin 390 is used to temporarily store intermediate output. Preferably, temporary mixbin 390 is associated with a different physical memory space than the memory space associated with voice processor mixbins 360 and global voice processor mixbins 370. The intermediate output stored in temporary mixbin 390 is then used as input to distortion program 388. The output of distortion program 388 is also the output of the entire chain 384 and is routed to a global processor mixbin, such as one of FX send 19 global processor mixbins 378. Overall Process FIG. 7 is a flow diagram illustrating overall logic for developing audio effect programs, building an audio effects binary image of the audio effect programs, and executing the audio effect programs with a DSP execution kernel. In general, an audio effect developer creates one or more audio effect programs at a primary step 400. At a second primary step 410, a game developer may create chains of audio effects or otherwise develop an audio configuration for a game. Finally, at a third primary step 420, a user invokes a DSP execution kernel to load and execute the audio effect programs in connection with executing a computer game. In more detail, an audio effect developer may utilize a development system, such as that shown in FIG. 1, to create, assemble, and link one or more individual audio effect programs, at a step 402. Preferably, the audio effect developer writes the audio effect programs in an assembly language suitable for creating machine instructions to control operation of a DSP. The audio effect developer then assembles the audio effect programs with an appropriate DSP assembler, such as a widely available Motorola Corp. DSP assembler program. The assembler preferably produces an individual binary file for each audio effect program. Also for each audio effect program, the assembler preferably produces a memory layout header file, independent of any other audio effect program. In addition to the assembled binary and header files, this embodiment of the invention requires the audio effect developer to create a small initialization file that specifies certain DSP resource requirements, some audio effect parameter information, some I/O information, and simple settings to be used by a binary image builder. A sample assembly language program and a sample initialization file are provided in Appendix A in regard to an amplitude modulation audio effect. At a step 404, the audio effect developer scrambles the binary code of each individual audio effect to produce a scrambled binary file. A variety of well known encoding and/or encryption techniques may be used to secure each binary file, including public-private key encryption. Scrambling each individual audio effect provides some protection against copying and preparation of derivative works for the audio effect developer, who may be independent of a game developer that wishes to use one or more proprietary audio effects in a computer game or other application. At a step 412, the game developer creates a configuration of audio effects, such as the configuration described above with regard to audio effect programs 380 in FIG. 6. Preferably, the audio effects configuration specifies one or more chains of audio effects, wherein each chain specifies one or more audio effects to be applied. Correspondingly, the audio effects configuration is sometimes referred to herein as a "chains configuration." The chains configuration is preferably implemented as a separate initialization file, which identifies the audio effects and I/O routing for each chain. The game developer may manually write the chains configuration file or employ an appropriate graphics user interface, such as a DSP chains builder interface described below with regard to FIGS. 8 and 9. A sample chains configuration file is provided in Appendix B. At a step 414, the game developer invokes an audio effects binary image builder (different from the DSP chains builder user interface mentioned above). The binary image builder validates the chains configuration and creates a binary image of all of the audio effect programs and initialization data, as defined by the chains configuration. The resulting binary image comprises all of the audio effect programs scrambled binary code and data, arranged in execution order of the chains configuration and stored in a form that replicates the global processor RAM blocks. Effectively, the binary image predefines DSP RAM for efficient sequential execution of the audio effect programs by the DSP core of the global processor. By predefining the memory layout for sequential execution, interrupt handling, memory management, and other overhead is minimized. With overhead minimized, an efficient DSP execution kernel can be used. To assist in memory layout, the audio effects binary image builder also creates a description header file, which describes the memory mapping of the resulting binary image. The description header is used in a manner similar to a standard C-file header. Further details regarding the audio effects binary image builder and its outputs are described below with regard to FIGS. 10-12. A sample description header file is also included in Appendix B. At a step 416, the game developer compiles the description header into the overall game code and adds the binary image to the overall set of game files. The game developer also adds a sound subsystem library that includes the efficient DSP execution kernel. The game developer may also optionally add a different header file that maps individual parameters of the audio effect programs to DSP RAM, so that the game may change the audio effect parameter values in real-time during execution of the game and audio effect programs. By predefining this parameter map, the game can control audio effect parameter values without interrupt handling. Instead, the game simply pokes a new parameter value to a predefined location in DSP RAM holding the parameter value. The DSP then uses the new parameter value the next time that the DSP reads the predefined DSP RAM location. A sample parameter map header is provided as Appendix C. Once a user receives a complete set of game files and initiates a game on a game console, the game software initializes the sound subsystem, at a step 422. The game sound subsystem triggers the DSP core of the global processor to copy the DSP execution kernel from the sound subsystem library into the DSP RAM and begin running the DSP execution kernel. At a step 424, the game software further instructs the sound subsystem to copy the binary image from the game files to a scratch memory space of the game console memory. The scratch memory space is a predefined area of console system memory that is accessible to the DSP. The sound subsystem also sets a number of command flags that the DSP execution kernel regularly polls. When the DSP execution kernel detects the set command flags, the DSP execution kernel instructs the DSP core, at a step 426, to load the binary image from the console scratch memory into the RAM of the global processor. Finally, the DSP execution kernel begins executing the audio effects programs of the binary image. Exemplary Audio Effects DSP Chains Builder and Binary Image Builder FIG. 8 is a screen print illustrating a DSP chains builder user interface that a game developer may use to create and edit a configuration of audio effects programs. For commercial simplicity, the DSP chains builder user interface is sometimes referred to as DSPBuilder 440. Preferably, the game developer uses traditional drag and drop techniques to insert, manipulate, and connect graphical representations of voice processor mixbins 442, audio effect programs 444, and global processor mixbins 446. To assist in development, DSPBuilder 440 preferably provides details about individual audio effect programs and the overall configuration of audio effect programs. For example, an I3DL2 24K reverb program 450a is depicted with its specific inputs 452 and specific outputs 454. Additional details include required resources 456, such as a number of DSP cycles, the size of DSP RAM, and the length of scratch space in memory. From the individual required resources, DSPBuilder 440 also provides a total 460 of required resources for the entire configuration of audio effects. FIG. 9 is another screen print of DSPBuilder 440 illustrating multiple effect programs in a chain. Audio data originates from an I3DL2 24K send mixbin 470 and is routed to an I3DL2 24K reverb program 450b. A front left output of reverb program 450b is routed to a crosstalk front left mixbin 472. In this case, crosstalk front left mixbin 472 acts as a temporary mixbin. As shown at the left side of FIG. 9, crosstalk front left mixbin 472 is routed to a crosstalk cancellation program 452. A front left output of crosstalk cancellation program 452 is routed to a front left speaker mixbin 474. Other audio effect programs may be inserted into the chain in a similar manner with conventional menu functions. For example, clicking a right mouse button may cause DSPBuilder 440 to display a list of editing functions 462, and an additional list of audio effects 464. When satisfied with the configuration of audio effects, the game developer preferably invokes another function of DSPBuilder 440 to generate a chains configuration initialization file, such as the example shown in Appendix B. The game developer then invokes an audio effects binary image builder to generate the binary image of the audio effects configuration and to generate the corresponding description header. FIG. 10 is a flow diagram illustrating logic used by the audio effects binary image builder to first validate the configuration of audio effects. At a step 480, the image builder parses the chains configuration initialization file for a chain of audio effects. Recall that a chain may comprise a single audio effect. At a decision step 482, the binary image builder determines whether multiple audio effects are defined in the current chain. If multiple effects are defined in the current chain, the binary image builder determines, at a step 484, a number of temporary mixbins required for the inputs and/or outputs of the audio effects in the current chain. After the number of temporary mixbins is determined, or if no temporary mixbins are required for the current chain, the binary image builder accesses an audio effect initialization file (e.g., effect.ini). The audio effect initialization files for each audio effect in all of the chains are identified in the chains configuration initialization file. At a step 486, the binary image builder parses the current audio effect initialization file for resources required by the audio effect, as defined by the audio effect developer when creating the audio effect initialization file. For example, the binary image builder searches for the number of DSP cycles required to execute the audio effect, the number of inputs to the audio effect, the number of outputs from the audio effect, the amount of scratch space required in memory, the number of parameters for the audio effect, and other resources required by the audio effect. At a decision step 488, the binary image builder determines whether a running total for each of the required resources exceeds the resources available from the DSP. If one of the running totals exceeds the corresponding available resources of the DSP, the binary image builder processes an error at a step 490. The game developer must then modify the configuration of audio effects to bring the overall configuration of audio effects within the resource limitations of the DSP. If the current running totals of required resources do not exceed the resource limitations of the DSP, the binary image builder adds the resources required by the current audio effect to the corresponding running totals, at a step 492. Those skilled in the art will recognize that an alternative approach is to subtract the resources required by the current audio effect from the associated total resources available for the DSP. In that approach, decision step 488 would instead determine whether a running total of available resources is less than zero. In any case, at a step 494, the binary image builder validates inputs and outputs of the current audio effect. Validation includes ensuring that inputs to the audio effect are connected to a mixbin or other source of audio data if the audio effect requires such input. Similarly, the binary image builder ensures that outputs from the audio effect are connected to a temporary or permanent mixbin. Those skilled in the art will recognize that a variety of other validations may be performed. If the inputs and outputs of the current audio effect cannot be successfully validated, the binary image builder processes an error for the game developer to correct. After successful validation of the current audio effect is complete, the binary image builder determines, at a decision step 496, whether another audio effect exists in the current chain. If another audio effect exists in the current chain, control returns to step 486 to parse a next audio effect initialization file and perform the validations described above. Once all of the audio effects in the current chain have been validated, the binary image builder determines, at a decision step 498, whether another chain of audio effects exists in the audio configuration (i.e., as indicated in the chains configuration initialization file). If another chain exists, control returns to step 480 to obtain the needed information from the chains configuration initialization file and validate the audio effects of the next chain as described above. Once the configuration of audio effects has been validated, the binary image builder generates the binary image according to logic illustrated in FIG. 11. Specifically, at a step 500, the binary image builder obtains the scrambled binary file of a first audio effect in a chain (e.g., effect.scr). Based on information from the corresponding audio effect initialization file (e.g., effect.ini) and the chains configuration initialization file (e.g., chainsconfig.ini), the binary image builder determines, at a step 502, the memory resources required by the audio effect. The binary image builder also determines a sequential location in DSP RAM to store state data and binary program code for the current audio effect. Effectively, the binary image builder determines a pointer offset from a predefined location in DSP RAM for the audio effect state data and another pointer offset from the state data for the binary machine code of the audio effect program. At a step 504, the binary image builder unscrambles the scrambled binary machine code of the audio effect. With the machine code unscrambled, the binary image builder will later be able to modify pointer values. The binary image builder then places the audio effect state data into a binary image held in memory of the game developer's system, at a step 506. The state data are placed at a location of the binary image that is associated with the location determined at step 502 for the state data in DSP RAM. Specifically, the state data location in the binary image corresponds to a location in DSP X-RAM. Similarly, the binary image builder places the binary machine code of the audio effect program into a location of the binary image that corresponds to a location of DSP P-RAM, which was also determined at step 502. Because the binary image replicates storage locations of the DSP RAM, the binary image provides a mapping from a scratch space of console system memory to DSP RAM. This mapping sequentially packs the state data of each audio effect into the DSP X-RAM, and packs the binary machine code of each audio effect program into the DSP P-RAM. By consolidating all of the program machine code together and all of the state data together, the DSP core can sequentially execute the program instructions and sequentially refer to corresponding state data. Preferably, the DSP core will simply execute each instruction in order, without any breaks between audio effect programs and without having to determine the location of each successive instruction. This sequencing, minimizes the need for DSP branching, which often requires interrupt handing and memory management overhead. Branching may occur within an audio effect as defined by its program instructions. However, no branching is required between audio effects, so the DSP execution kernel need not be involved in transferring control from one audio effect to another audio effect. However, because the state data and the binary machine code of an audio effect program have been relocated, the binary machine code of the program must be modified to point to the new location of the state data. Thus, at a step 508, the binary image builder modifies a first op code of the current audio effect program, so that the first op code points to the new location in DSP X-RAM where the audio effect state data will be stored. To enable this modification, each audio effect program must contain a predefined instruction as the first line of the audio effect program. Specifically, the first line of each audio effect program must comprise the following move instruction. move #>$40, r5 The binary image builder moves a new base pointer from register r5 into address 40. Those skilled in the art will recognize that the exact instruction format and register number may differ, depending on the secondary processor used and its corresponding assembly language. In this exemplary embodiment, the new base pointer points to the location in DSP X-RAM where the state data are to be stored. Preferably, the above instruction is provided in an effects entry point macro that is defined in a utility header, which is included in each audio effect program. Once the first op code of the audio effect program block is modified, the binary image builder determines, at a decision step 510, whether the current audio effect program was previously determined to require one or more temporary mixbins. The determination was made at step 484 of FIG. 10. If one or more temporary mixbins are required, the binary image builder reserves a portion of DSP X-RAM, at a step 512 of FIG. 11. For each temporary mixbin required, the binary image builder reserves a predefined number of words of DSP X-RAM. At a step 514, the binary image builder then modifies the corresponding I/O pointers of the audio effect program to point to the reserved DSP X-RAM locations associated with the required temporary mixbins. After accounting for temporary mixbins, or determining that the current audio effect program does not require any temporary mixbins, the binary image builder places the DSP X-RAM address and length of the state data (and any required temporary mixbins) in a command block of the binary image, at a step 516. Similarly, the binary image builder places the DSP P-RAM address and length of the audio effect program code in the command block in the binary image. The command block is stored at a predefined location in the binary image corresponding to a predefined location in the DSP X-RAM, so that the DSP execution kernel will always know where to find the address of each block of audio effect program code and the address of each corresponding block of state data. The information in the command block is used for coordinating data transfers between the DSP RAM and the scratch space of the console system memory. At a step 518, the binary image builder rescrambles the current audio effect in the binary image. This rescrambling does not alter the length of the program code, and thus, does not affect the P-RAM address and length determined above. At a decision step 520, the binary image builder determines whether another audio effect exists in the current chain. If another audio effect is defined for the current chain, control returns to step 502 to process a next audio effect into the binary image. When all audio effects of the current chain have been processed, the binary image builder determines, at a decision step 522, whether another chain exists in the configuration of audio effects. If another chain is defined, control returns to step 500 to process another chain of audio effects into the binary image. Once all chains of audio effects have been processed into the binary image, the binary image builder changes a final "no op" instruction into a "return" instruction, at a step 524. This return instruction will cause the DSP core to transfer execution control back to the DSP execution kernel after all audio effects in the program block have executed. The DSP execution kernel can then determine whether any command flags were set and reinitiate execution of the audio effects in the binary image at the next frame. To enable the binary image builder to add the return instruction, regardless of which audio effect program is last in the program block, each audio effect program must include a no op instruction as its last instruction. When an audio effect is not the last effect in the program block, the no op instruction enables the DSP core to execute the next audio effect program placed in DSP P-RAM, without returning control to the DSP execution kernel. However, as indicated above, control must be returned to the DSP execution kernel after the very last audio effect program has completed execution. Therefore, the no op instruction of the very last audio effect program is changed to a return instruction. Rather than changing the final no op instruction, those skilled in the art will recognize that a return instruction could alternatively be added after the final no op instruction. At a step 526, the binary image builder writes out the binary image to a file, which is then included with other game files. As discussed above, the binary image builder also generates and writes a binary image description header file, at a step 528, to be included with the game files. The description header includes public parameter values, scratch offsets, scratch lengths, and other standard header info from each audio effect initialization file. As part of these write steps, the entire binary image and/or description header may also be scrambled, encrypted, or otherwise secured as another layer of protection for the audio effects and the entire configuration of audio effects. FIG. 12 illustrates the exemplary structure of a binary image 530 resulting from the above process. The lowest memory addresses of binary image 530 comprise a blank block 532. Blank block 532 is a predefined pad area that is preferably filled with zeros. The pad area represents an area of the scratch space in console system memory that is reserved for a copy of the DSP execution kernel. Binary image 530 is loaded into the same predefined location of scratch space in the console system memory, as that used for a copy of the DSP execution kernel. The copy of the DSP execution kernel is maintained in the scratch space in the event that the DSP core encounters an execution problem and must be reinitialized. Thus, blank block 532 ensures that the copy of the DSP execution kernel is not overwritten when the binary image is loaded into the scratch space. Following blank block 532 is a command block 534. Command block 534 begins at a predefined location of binary image 530. As indicted above, the beginning of command block 534 corresponds to a predefined location in scratch space of consol system memory. Also as indicated above, the scratch space is an area of console system memory that is reserved for exclusive use by the DSP, and replicates the DSP RAM. Specifically, the predefined location in scratch space for command block 534 corresponds to a predefined location in DSP X-RAM. Command block 534 comprises pointers and lengths for state data blocks of binary image 530 to be loaded into DSP X-RAM. Similarly, command block 534 includes pointers and lengths for audio effect programs of binary image 530 to be loaded into DSP P-RAM. The state data of each audio effect in the configuration of audio effects are stored in a states block 536. States block 536 begins at a predefined relative offset from the beginning of command block 534. As above, the predefined relative offset of states block 536 corresponds to a predefined relative offset from the beginning of DSP X-RAM. Directly after the end of states block 536 is a programs block 538. Programs block 538 comprises all of the machine code for the audio effect programs included in the configuration of audio effects. Because states block 536 may vary in length from one binary image to another binary image, programs block 538 does not begin at a predefined offset. Instead, programs block 538 begins at a relative offset from the beginning of command block 534, wherein that relative offset is determined during generation of the binary image so as to be located just after the end of states block 536. The relative offset of programs block 538 is mapped to a predefined offset from the beginning of DSP P-RAM. The predefined offset in DSP P-RAM falls after the area of DSP P-RAM that is used to store the DSP execution kernel. Although the binary image replicates portions of DSP RAM, it is the DSP execution kernel that actually copies and maps the binary image data and program code between the scratch space of console system memory and DSP RAM. Exemplary DSP Execution Kernel The above discussion explains a preferred embodiment of the present invention that enables a developer to generate a binary image of audio effects on a development system such as a PC. The following discussion is directed to another aspect of the present invention for a preferred embodiment employed for loading and executing the audio effect programs of the binary image on a DSP in a game console under the direction of an efficient DSP execution kernel. To begin, FIG. 13 is a flow diagram illustrating logic for loading the DSP execution kernel into DSP RAM of the game console. At a step 540, the game console loads controlling game code to the console system memory. At a step 542, the game code initializes a sound subsystem. The sound subsystem obtains the DSP execution kernel from a sound subsystem library that was included with the game files. At a step 544, the sound subsystem loads the DSP execution kernel to the predefined location in console system memory referred to as the scratch space. Preferably, the sound subsystem utilizes an application programming interface (API), such as Microsoft Corporation's DirectSoundCreate API. Once a DSP execution kernel is loaded into the scratch space of console system memory, the sound subsystem instructs the DSP to boot, at a step 546. The DSP is hard wired to execute a boot routine stored in a DSP ROM. The DSP boot routine is a basic input/output system (BIOS) that is appropriate for the particular DSP hardware. As with most BIOSs, the DSP boot routine is hard coded to obtain further instructions from a predefined location in memory. Here the DSP boot routine is hard coded to obtain further instructions from the predefined location in console system memory referred to as the scratch space. Thus, at a step 548, the DSP boot routine downloads the DSP execution kernel from the scratch space of console system memory into a predefined beginning location of DSP P-RAM. While the DSP is downloading the DSP execution kernel, the game code may be loading the binary image file into the scratch space of console system memory. FIG. 14 is a flow diagram illustrating logic for loading the binary image file into scratch space of console system memory. At a step 550, the game obtains the binary image file and the description header from among the other game files and copies the binary image file to a convenient location of console system memory. At a step 552, the game instructs the sound subsystem to copy or move the binary image to the predefined location of console system memory referred to as the scratch space. Preferably, the sound subsystem places the binary image in the scratch space via an API such as Microsoft Corporation's DownloadEffectsImage APT. With the binary image in scratch space, the game instructs the sound subsystem to unscramble each audio effect of the binary image, at a step 554. The sound subsystem uses information stored in the binary image description header to locate the program code of each audio effect in the binary image. After unscrambling each audio effect, the sound subsystem sets a number of command flags, at a step 556. The command flags are located at predefined locations in the scratch space that the DSP execution kernel regularly polls. Setting the command flags indicates to the DSP execution kernel that the DSP execution kernel should load portions of, or all of, the binary image to DSP RAM. For example, one command flag indicates that the DSP execution kernel should load the programs block from the binary image into the DSP P-RAM. Similarly, another command flag indicates that the DSP should load the states block from the binary image to the DSP X-RAM. FIG. 15 is a flow diagram illustrating logic for loading portions of, or all of, the binary image into DSP RAM. At a step 560, the DSP execution kernel polls the command flags. Preferably, the DSP execution kernel polls the command flags at the beginning of each DSP execution frame. At a decision step 562, the DSP execution kernel determines whether a state flag is set. If the state flag is set, the DSP execution kernel sets a state status flag to pending, at a step 564. The status flag provides an indication to the primary processor of the game console that a portion of the scratch space is in use so that the primary processor of the game console will not overwrite the scratch space. For example, as discussed above the game may modify one or more parameters of one or more audio effects during execution of the game. To make the parameter changes take affect, the primary processor of the game console pokes new values to the scratch space of console system memory where the states block is stored. By setting the state status flag to pending, the DSP execution kernel prevents the primary processor from poking the new parameter values to the scratch space while the DSP core is downloading the states block of the binary image to the DSP RAM. After the state status flag is set, the DSP execution kernel maps the state information of the audio effects from the scratch space to the DSP X-RAM, at a step 566. To map the information, the DSP execution kernel preferably uses a virtual address interface. The audio processing unit preferably provides an interface that maintains virtual addresses in the console system memory. The virtual addresses point to addresses in DSP RAM. By having virtual access to the DSP RAM, the game can modify audio effect parameters in real time. Once the DSP execution kernel begins mapping audio effect state information, or if the state flag was not set, the DSP execution kernel determines, at a decision step 568, whether a program flag is set. If the program flag is set, the DSP execution kernel sets a program status flag to pending, at a step 570. In a manner similar to that described above, the DSP execution kernel then maps the audio effects program code from the scratch space to the DSP P-RAM, at a step 572. When the desired code and state information are loaded into DSP RAM, the DSP execution kernel resets the status flags back to "free," at a step 574. In response, the primary processor of the game console resets the command flags to free, so that the DSP execution kernel does not attempt to redownload the same information. At a step 576, the DSP execution kernel jumps to the fixed location in DSP P-RAM that holds the audio effects program code and begins to execute the audio effects program. At a decision step 578, the DSP execution kernel determines whether the current DSP execution frame is complete. If the DSP execution frame is not complete, control returns to step 576 to continue executing the audio effects program. Once a DSP execution frame is complete, control returns to a step 560, at which time the DSP execution kernel again polls the command flags and repeats the above downloading process if either command flag is set. FIG. 16 is a flow diagram illustrating further detailed logic for the game to modify audio effect parameter values in real time. At a step 580, the game calls an API, such as Microsoft Corporation's SetEffectsData APL to modify one or more audio effect parameter values. The game may modify parameter values in response to an event in the game, at predefined points in the game, or for other reasons. At a step 582, the game API refers to the binary image description header for the location of audio effect parameters that the game wishes to modify. Specifically, the binary image description header identifies the parameter locations in the audio effect program code that is stored in the scratch space of the console system memory. These parameter locations will be available in the binary image description header if the parameters are public parameters. For private parameters of audio effects, such as private parameters of proprietary audio effects developed by an independent audio effect developer, the game may additionally or alternatively refer to an optional parameter map header that may be provided with the game files. As indicated above, a sample parameter map header is provided in Appendix C. Knowing the locations of the desired parameters in the program code stored in the scratch space, at a step 584, the API then writes the updated parameter values to the scratch space locations. It will be recalled that the parameter value locations in scratch space are virtual addresses of the DSP X-RAM. At a step 586, the game then sets the state flag to inform the DSP that new parameter values are available. As discussed above, and as shown by a step 588, the DSP downloads and uses the updated parameter values at the next DSP execution frame. To ensure that an audio effect uses updated parameter values, entry point code of each audio effect program preferably includes the following instructions to initialize the audio effect.
The above entry point code instructs the DSP core to check whether an audio effect state flag is set. If an audio effect state flag is already set, then the audio effect is already initialized and can branch immediately to the main portion of the audio effect code, which is labeled by ComputeFX. This technique enables the audio effect to use previous parameter values, rather than rereading parameter values at each frame. However, if the audio effect is not initialized, the code instructs the DSP core to set an initialization bit, which causes the audio effect to reinitialize and use the new parameter value. Although the present invention has been described in connection with the preferred form of practicing it, those of ordinary skill in the art will understand that many modifications can be made thereto within the scope of the claims that follow. Accordingly, it is not intended that the scope of the invention in any way be limited by the above description, but instead be determined entirely by reference to the claims that follow.
|
Same subclass Same class Consider this |
|||||||||||||||||||||||||
