Digital media processors are typically used for image-processing applications in electronic devices such as copiers, scanners, etc. In a typical configuration a digital media processor is controlled by a host processor which provides over-all control functions for the electronic device. The software which programs the host processor may include one or more modules to control the digital media processor. One issue that may need to be addressed by such modules is how to handle interrupt events (“interrupts”) initiated by the digital media processor or components of the digital media processor.
The system 100 includes a host processor 102, which may for example be a conventional microprocessor. The system 100 may also include a bus 104 (e.g., a PCI bus) to which the host processor 102 is coupled. In addition, the system 100 may include a digital media processor 106 which may be coupled to the host processor 102 via the bus 104. In some embodiments, the digital media processor 106 may be the model MXP5800 digital media processor available from Intel Corporation, the assignee hereof.
The system 100 may further include a memory 108 coupled to the host processor 102 to serve as program storage, working memory, etc. Still further, the system 100 may include one or more double data rate (DDR) memories 110 coupled to the digital media processor 106 to serve as working memory and/or to receive input image data and/or processed image data from the digital media processor 106. In addition the system 100 may include various input/output interfaces 112 coupled to the host processor 102 via the bus 104 and a network interface 114 coupled to the host processor 102 via the bus 104.
The architecture of the digital media processor may provide for highly parallel processing and may comprise a relatively large number of components, each of which is able to initiate interrupts. For example, the above-mentioned MXP5800 digital media processor includes eight mesh-connected image signal processors (ISPs), and each ISP includes eight processing elements, each of which may initiate an interrupt. Further, the MXP5800 includes direct memory access (DMA) units which comprise in total 32 DMA engines, each of which may initiate an interrupt. In addition, the MXP5800 includes a PCI error interrupt unit which may initiate an interrupt. Thus the MXP5800 may generate potentially 97 unique interrupts.
Direct communication with the digital media processor 106 is via a device driver software component 202. In turn, communication with the device driver software component 202 is via the operating system 204, which may be a conventional operating system (OS) such as Windows or Linux. A hardware abstraction layer (HAL) 206 mediates between the system application program 208 and the OS 204 in regard to interactions with the digital media processor 106. The HAL 206 is an application program interface (API) between the application program 208 and the device driver 202 and aids in promoting rapid development of the application program and portability of the application program to other operating systems and/or other generations of the digital media processor. Portability of the HAL 206 itself to other operating systems is enhanced by dividing the HAL 206 between a system library 210 and a portability layer 212. The HAL system library 210 may provide to the application program 208 a set of intuitive, easy to use function calls specific to the components of the digital media processor 106. The HAL portability layer 212 contains low level function calls that would need to be modified to port the system library 210 to a different operating system or to different host processor hardware. The function calls of the portability layer 212 may be called by higher level functions included in the system library 210.
Management of interrupts from components of the digital media processor 106 is among the functions performed by the HAL 206. In some embodiments, the HAL 206 provides flexibility to the designer of the application program by supporting two types of interrupt handling mechanisms. According to a first type of interrupt handling, hereinafter referred to as the “asynchronous interrupt manager”, a processing thread responds to an interrupt event by calling a callback function that proceeds contemporaneously with the processing thread that executes the application program. Thus the asynchronous interrupt manager allows execution of the application program to continue while the asynchronous interrupt manager handles the interrupt. According to a second type of interrupt handling, hereinafter referred to as the “synchronous interrupt manager”, the thread by which the application is executed is blocked during handling of the interrupt by the thread in which the synchronous interrupt manager executes. With both of these capabilities present in the HAL 206, the designer of the application program may select which type of interrupt manager is to respond to each of the various interrupts that may be initiated by components of the digital media processor. Thus the designer of the application program is given greater flexibility in interrupt handling than if only one of the two interrupt managers were supported.
At 302 in
If it is determined that the interrupt is to be handled by the synchronous interrupt manager, then further execution of the application program thread is blocked, as indicated at 306, and the interrupt is handled by the synchronous interrupt manager, as indicated at 308. As indicated by decision block 310, once the handling of the interrupt by the synchronous interrupt manager is complete, the application program thread is unblocked (312 in
If it is determined at 304 that the interrupt is to be handled by the asynchronous interrupt manager, then as indicated at 314, handling of the interrupt by the asynchronous interrupt manager proceeds, without the application thread being blocked.
Thus, over time, a first interrupt may be handled by the synchronous interrupt manager, and execution of the application may be blocked while the first interrupt is being handled. Thereafter or previously, a second interrupt may be handled by the asynchronous interrupt handler, with the second interrupt being handled in one processing thread while execution of the application continues in another processing thread.
At 402 in
At this point in the process, depending on the nature of the interrupt event that has been received, either the interrupt event is received by the synchronous interrupt manager, as indicated at 408, or the interrupt event is received by the asynchronous interrupt manager, as indicated at 410. In any case, the interrupt manager that receives the interrupt event then determines, as indicated at 412, whether a semaphore is in a “locked” condition. As used herein and in the appended claims, a “semaphore” is a flag which indicates to a processing thread whether the processing thread may proceed.
If it is determined at 412 that the semaphore is not in a locked condition, then the interrupt manager in question places the semaphore in the locked condition (414 in
Then, as indicated at 416 (
Next, and regardless of whether the interrupt manager currently operating is the synchronous or asynchronous interrupt manager, at 424 the semaphore is returned to an unlocked condition and at 426 the interrupt manager in question re-enables interrupts in the interrupt enable register. Then, at 428, if the interrupt manager in question is the synchronous interrupt manager, the synchronous interrupt manager reports the interrupt to the application program.
Considering again decision block 412 (
As used herein and in the appended claims, “digital media processor” refers to a processor that is optimized to perform image signal processing.
In embodiments discussed above, one digital media processor is included in the system 100. In other embodiments, two or more digital media processors may be included in the system and may be controlled via the software stack described above with reference to
The several embodiments described herein are solely for the purpose of illustration. The various features described herein need not all be used together, and any one or more of those features may be incorporated in a single embodiment. Therefore, persons skilled in the art will recognize from this description that other embodiments may be practiced with various modifications and alterations.