Communication between object oriented components and procedural device drivers

Abstract: A method of and apparatus for bridging communications between an object oriented component and a procedural programmed device driver are disclosed. Both the object oriented component and the procedural programmed device driver are both part of a data processing system. Both the method and apparatus isolate the object oriented component from the device drivers, specifically the active device driver, by encapsulating the specific device driver information associated with that particular device driver and then transporting requests or commands from the object oriented component to the specific device driver when interfacing with the device driver. The object oriented component generates an interface object that allows for opening communication or closing communication to the device driver as well as initializing the device using the information within the device driver and for controlling the device via the device driver. A transport object is also generated, which allows the transporting of data from the object oriented selected device driver to the object oriented component. This transport object also allows data flow to be controlled between the component and the selected device driver.

Description: The present invention relates in general to data processing systems having both object oriented applications and procedural programmed applications, and more particularly, to data processing systems wherein object oriented operating systems interface with procedural device drivers. Object oriented programming has become an important new programming technology. Object oriented programming has greatly simplified software programming by providing software reusability and extensibility, which leads to improved programmer productivity as compared to conventional software programming. Even so, object oriented technology has not effectively penetrated major commercial software products to date. In particular, designers of operating systems have hesitated to embrace the new technology. Information on one object oriented programming language, a C++ may be found in the publication Bjarne Stroustrup, "The C++ programming language" 1991, Addison-Wesley, Reading, MA, USA XPO02022663. Nevertheless, object oriented programming (OOP) is beginning to obtain acceptance in the industry. Unfortunately, one problem facing object oriented programming with respect to procedural programming is that most of today's existing software is comprised mostly of procedural code, which, by its nature, is quite monolithic in its design and not up to the flexible requirements of the object oriented software. Furthermore, the strict procedural approach is further entrenched into today's software from the top down (from applications through the operating system into the device drivers), which make moving to OOP much more difficult. In many cases, the operating system and its device drivers have to be rewritten to the standards of OOP in order for an object oriented software component to be implemented. Another way to implement object oriented components is to design a hybrid OO component where it reverts back to a procedural mode when it needs to interface with other existing procedural software components, such as operating systems or device drivers or both. This hybrid model of OO and procedural is counterproductive to the advantages that OOP has to offer. Furthermore, the overall integrity of the software is now at risk. Device driver design (procedural and object oriented) is discussed in Proc. 5th Ann. Embedded Systems Conf., Vol. 2, 5 October 1993, San Francisco, USA, Miller Freeman, pages 437-454, XP000613123 Tuggle, E: "Advanced topics in device driver design. However, there is no discussion in this article of interfacing between object oriented software components and procedural device drivers. Accordingly, what is needed is a design and implementation that neither forces a rewrite of existing procedural device drivers nor does it force the OO software component into a hybrid mode. According to one aspect of the invention there is provided an apparatus as defined in the appended claim 1 for bridging communications between an object oriented component and a procedural programmed device driver in a data processing system. According to a second aspect there is provided a method as defined in the appended claim 4 for bridging communications between an object oriented component and a procedural program device driver in a data processing system. Thus in at least a preferred embodiment there is provided a data processing system using object oriented operating systems that interface via object oriented components with procedural device drivers. As will be described in detail below in one embodiment, a method of and apparatus for bridging communications between an object oriented component and a procedural programmed device driver are disclosed. Both the object oriented component and the procedural programmed device driver are both part of a data processing system. Both the method and apparatus isolate the object oriented component from the device drivers, specifically the active device driver, by encapsulating the specific device driver information associated with that particular device driver and then transporting requests or commands from the object oriented component to the specific device driver when interfacing with the device driver. The object oriented component generates an interface object that allows for opening communication or closing communication to the device driver as well as initializing the device using the information within the device driver and for controlling the device via the device driver. A transport object is also generated, which allows the transporting of data from the object oriented selected device driver to the object oriented component. This transport object also allows data flow to be controlled between the component and the selected device driver. In an alternative embodiment, the method for bridging communication between the object oriented component and the programmed device driver creates the object oriented component within an object oriented subsystem. Next, the system constructs an interface object and then constructs a transport object within the object oriented subsystem. Then communication is established between the device driver and the object oriented component via the interface and the transport objects. The interface object allows the data types to be set from the object oriented subsystem and for component attributes of the device driver as well. Both the transport object and the interface object allow commands to be performed from the oriented subsystem by the device driver as well as allowing data to be transmitted between the object oriented subsystem and the device driver. Thus, in at least a preferred embodiment of the invention there is provided a general OOP device driver interface to bridge OOP components with procedural programmed components regardless of the base software running the data processing system. Embodiments of the present invention will now be described, by way of example only, with reference to the accompanying drawings in which: Figure 1 depicts in accordance with a preferred embodiment of the present invention a hardware environment upon which is implemented the present invention; Figure 2 illustrates a block diagram of a system that provides a bridge between object oriented software components and procedural device drivers; Figure 3 depicts DDInterface class as a base class that other OO components interface with in order to gain communication to the procedural device drivers; Figure 4 depicts the operation of DDInterface class according to an embodiment of the present invention; Figure 5 depicts a block diagram of the steps in accessing procedural device drivers; Figure 6 is a block diagram depicting the abstract classes and their respective roles to the procedural device drivers; Figure 7 depicts a block diagram of how the base classes DDInterface and DDTransport are subclassed to achieve platform independence; Figure 8 depicts a block diagram of the base classes DDInterface and DDTransport being subclassed to achieve portability on another platform. The present invention utilizes the techniques inherent in object oriented design and programming (OOD & P) such as encapsulation of both data and code within the invented classes. These classes have an OO interface for other software components to communicate to it and to contain the necessary procedural interfaces for it to communicate with other procedural components, such as, for example, device drivers. Although it appears to be a hybrid solution, significantly, it stands independent of other OO components needing to communicate with the procedural components. The invention provides for a generic, self contained interface between two programming models, namely OOD & P and procedural programming. Additionally, the present invention makes use of many of the concepts of object oriented design and programming as taught in U.S. Patent No. 5,361,350, entitled, "Object Oriented Method Management System and Software for Managing Class Method Names in a Computer System". The invention is preferably practiced in the context of an operating system resident on microcomputers such as personal computers and work stations. A representative hardware environment is depicted in Figure 1 , which illustrates a typical hardware configuration of a workstation in accordance with the subject invention having a central processing unit 10 , such as a conventional microprocessor, and a number of other units interconnected via a system bus 12 . The workstation shown in Figure 1 includes a Random Access Memory (RAM) 14 , Read Only Memory (ROM) 16, an I/O adapter 18 for connecting peripheral devices such as disk units 20 to the bus, a user interface adapter 22 for connecting a keyboard 24 , a mouse 26 , a speaker 28 , a microphone 32 , and/or other user interface devices such as a touch screen device (not shown) to the bus, a communication adapter 34 for connecting the workstation to a data processing network and a display adapter 36 for connecting the bus to a display device 38 . The workstation has resident thereon the OS/2 base operating system and the computer software making up this invention which is included as a toolkit. ROM 16 may further comprise additional ROM units, such as, for example, an on board chip ROM, a compact disk ROM. Additionally, instead of OS/2, the operating system may be selected from the types such as AIX, which is available from International Business Machines Corporation, Windows, DOS, NT, which are products available from Microsoft, Inc., Taligent O/S, available from Taligent Corporation, as well as-the various UNIX operating systems provided by various software companies. Additionally, the present invention is also capable of operating on larger minicomputers, such as, AS/400 workstation systems, also manufactured by International Business Machines Corporation, and larger mainframe computer systems. (OS/2, AS/400 and AIX are trade marks of IBM Corporation). Figure 2 illustrates a block diagram of a system that provides a bridge between object oriented software components 50 that need to communicate to procedural device drivers 52 . An object oriented generic device interface 54 is provided as this bridge. Interface 54 allows the OO software to retain all of its advantages while allowing communication to exist between the OO software components and the device drivers. This allows OOP to be compatible with existing procedural code based device drivers. Additionally, the invention, by using OOP within itself, provides a front door for device drivers that are not OOP, to make the transition to OOP down the road. In object oriented component 50 , the OO code remains isolated from the procedural code in the procedural device drivers 52 . In procedural device drivers 52 , the procedural code remains intact and isolated from OO code in component 50 . The OO component 50 attempts to make OO method calls to procedural device drivers, but since these calls are incompatible because the device drivers 52 attempt to make call backs upon receipt of procedural calls, a bridge is required. This bridge is achieved or provided in OO generic device interface 54. Device interface 54 uses OOP methods to wrap around the procedural code from the device drivers, thus allowing communication to occur between OO component 50 and procedural device drivers 52. Device interface 54 further comprises OO classes named DDInterface and DDTransport . Each class has OO characteristics, such as data encapsulation, containment, and independent roles that, together, build the bridge between OOP and procedural software models. In addition, these classes may be subclassed to achieve special characteristics that are necessary for specific devices or platforms. These classes perform the roles of: 1) providing an OO interface for other OO components, 2) isolating other OO components from the procedural device drivers, 3) encapsulating device specific information, thus providing device independence, 4) manipulating the object data type and attributes, 5) controlling the data flow to/from the procedural device driver, and 6) maintaining the "state" of the data flow. DDInterface class is a base class that other OO components interface with in order to gain communication to the procedural device drivers. In addition, DDInterface has OO methods that contain procedural code to access the device drivers. This class provides the functions outlined in the block diagram of Figure 3. One function, shown in block 302 , opens communication to the device driver from object oriented component using DeviceOpen (). Another function is shown in block 304 and provides closing communication to the device driver using DeviceClose (). The DeviceInit function shown in block 306 is that of initializing the device, via the device driver, while the Device-Control () function in block 308 is that of controlling the device via the device driver. In block 310, the DeviceLoad () function is that of loading microcode into the device, via the device driver. Blocks 302-310 communicate with the entry port of the procedural device driver through the architect interface of the computer system, typically these are, for example, the DOS IOCTL, input/output control, or Mach's IPC, interprocess communication. In block 312 , the internal methods of providing constructor and destructor operations on the object data are provided. In block 314 , data manipulation methods, such as SetDataType () and SetControlAttributes () functions are also provided. In block 316 , data flow methods such as the function send buffer to device and send buffer from device are depicted. In block 318 , the transport method, which includes functions device start, device stop, device pause, is operational to provide transport of the object data to the device driver via the DDTransport of the invention. The operation of DDInterface class is further depicted in the block diagram of Figure 4 , which is based upon the C++ code provided in the appendix to the present description. The DDTransport class is a base class that the DDInterface class interfaces with in order to send certain requests or commands, or both, to the procedural device drivers. In addition, DDTransport class has the ability, or necessary methods, to communicate with other device drivers other than the device driver with which DDInterface is presently communicating. The DDTransport class provides the functions outlined in the block diagram of Figure 4 . The DDTransport class performs various functions and methods that include internal methods 402 , transporting methods 404 , and data control operations 406 . Within the internal methods 402 include DeviceOpen, Device-Close, and StateControl with the object data along with a pointer to incoming request packets. Transporting data methods 404 include GetBuffer-fromDevice ()-and SendBuffertoDevice () functions similar to those in the DDInterface diagram of Figure 3. Data control methods 406 include important functions TransportStart () and TransportStop () that are used to control the transportation of data from object to device driver. All three methods connect at an entry point for the procedural device driver using either the IOCTL or IPC architect communication. The implementation and operation of both the DDTransport and DDInterface classes are further depicted in the flow diagram of Figure 5. Figure 5 depicts a block diagram of the steps implemented in accessing procedural device drivers. In block 502 , the object oriented (00) subsystem creates an object that it wants to manipulate, in this case an audio object. In block 504 , the DDInterface object is constructed from within the object oriented subsystem. Next, in block 506 , the data type and attributes are set from the object oriented subsystem as the DDInterface audio object. In block 508 , the DDInterface constructs the DDTransport object and establishes device driver communication. At this stage, the object data and state are set. In block 510 , the object oriented subsystem requests to play the audio object for example, which in reality is a request to do an action with the object, such as play and audio or video object, or the like. In block 512 , the DDInterface receives data buffer from the OO subsystem and calls DDTransport to start the device. Specifically, the DDInterface issues a start command and a send data command. Next, in block 514, DDTransport sends data buffer to the device driver and then, in block 516, decides whether more data is to be sent until such a time that the OO subsystem requests a "stop" in block 518. If no "stop" has been issued and there is more data to send, the system returns to block 514 . If there is no more data to send or if the audio object has sent a "stop" request, the system then proceeds to block 520. In block 520, both the DDInterface and DDTransport update their states in their state control methods. Next, in block 522, the system then waits for the next command and if one is received returns to block 510 . Any type of command is possible such as another "play", or a data type change request, or a request to destroy, or otherwise modify the data. In block 524 , the OO subsystem is finished with the audio object, which is then destroyed. In block 526 , the DDInkerface destructor is activated, which terminates any pending transfers, closes the device driver, and terminates itself. Then, in block 528 , the DDTransport closes the device driver and then terminates itself when activating the DDTransport destructor function. The operation of DDTransport class is based upon the C++ program code in the appendix under the DDTransport title. Both DDInterface class and DDTransport class are classes designed to be derived to each device or platform specifics. Specifically, these classes must be derived to be utilized since this is the nature of being an abstract class. It is in this process of deriving, or subclassing, where the present invention provides its flexibility over that of the prior art. Figures 6-8 depict the progression of how these abstract classes transform into specific implementations to provide bridging between OOP components and procedural device drivers. Figure 6 is a block diagram depicting the abstract classes and their respective roles to the procedural device drivers. The DDInterface object allows the OO subsystem to communicate with it, yet it prevents the OO subsystem from having to know about or even be aware of how the request is to be honored and what drivers are able to honor that request. Specifically, the OO subsystem can use any device that DDInterface object can communicate with while retaining full device independence. This system while providing device independence, also provides platform independence. Figure 7 depicts a block diagram of how the base classes DDInterface and DDTransport can be subclassed to achieved platform independence. This allows an entire OO subsystem to be ported over to another operating system platform. In the example of Figure 7 , the OS platform using OS/2 DDInterface and OS/2 DDTransport , requires two device drivers to handle a given request from on OS subsystem. OS/2 DDInterface is used as the bridge between the OO subsystem and the device driver, but now a second device driver is present to handle data transfers. OS/2 DDTransport serves to provide communication with the second device driver. No changes were required on the OO subsystem to function in this two device driver OS/2 platform. Only the DDInterface and DDTransport classes were subclassed to operated on this platform. At the ring three level, the DOS DEV IOCLTs for both the OS/2 DDInterface and OS/2 DDTransport provide the functions of opening and closing the device driver. At the ring zero level, separated from ring 3 by the dashed line in Figure 7, the functions of initializing, controlling, and loading from the device driver by the OS/2 DDInterface is represented while the functions of read/write, start/stop/pause, for the second device driver are handled by the OS/2 DDTransport subclass. The first device driver is audio/video device driver, which communicates with the second device driver, which is an OS/2 stream handler device driver. Figure 8 depicts a block diagram of the base classes DDInterface and DDTransport being subclassed to achieve portability on another platform, which is a Microkernel based OS (µK). The derived classes are µK DDInterface and µK DDTransport which are built to the protocol specifics of the microkernel OS. The OO subsystem again requires no modification in its port to this platform. This example includes only a single device driver, which is audio/video device driver. At the user level, µK DDInterface provides the functions under Mach Interface Generator (MIG) calls of opening and closing the device driver while the µK DDTransport subclass provides the function of performing read/write calls to the device driver. At the kernel level, the µK DDInterface provides the functions of initializing and controlling the device via the device driver, and loading microcode into the device via the device driver. Data transfer method calls are sent from µK DDInterface subclass to µK DDTransport subclass. while the invention has been particularly shown and described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the scope of the invention as defined by the appended claims. APPENDIX

Claims: Apparatus for bridging communications between an object oriented component created within an object oriented subsystem and a procedural programmed device driver in a data processing system, the apparatus comprising: an interface object (DDInterface) constructed from within said object oriented subsystem, that couples said object oriented component to said device driver, comprising means for isolating said object oriented component from said device driver; said isolating means including procedural code (302, 304, 306, 308) to open, initialize, control and close said device driver; a transport object (DDTransport), constructed within said object oriented subsystem, and controlled, by said interface object, for encapsulating device specific information and including means (404) for transporting data from said object oriented component to said device driver and means (406) for controlling data flow between said object oriented component and said device driver. Apparatus according to claim 1, wherein said interface object further comprises: means for loading microcode from said object oriented component into said device via said device driver. Apparatus as claimed in claim 2, wherein said transport object further comprises means for opening communication to other device drivers. A method for bridging communications between an object oriented component and a procedural program device driver in a data processing system, the method comprising the steps of: creating said object oriented component within an object oriented subsystem that is to be manipulated by said data processing system; constructing an interface object (DDInterface) from within said object oriented subsystem, that couples said object oriented component to said device driver, comprising means for isolating said object oriented component from said device driver; said isolating means including procedural code (302, 304, 306, 308) to open, initialize, control and close said device driver; constructing by said interface object a transport object (DDTransport) within said object oriented subsystem controlled by said interface object, for encapsulating device specific information and including means (404) for transporting data from said object oriented component to said device driver and means (406) for controlling data flow between said object oriented component and said device driver. A method as claimed in claim 4 comprising, after said step of constructing said interface object, the steps of: setting a data type from said object oriented subsystem; and setting component attributes from said object oriented subsystem. A method as claimed in claim 4 or claim 5 comprising the further step of: requesting to perform a command from said object oriented subsystem. A method as claimed in claim 4 comprising the further steps of: receiving data at said interface object from said subsystem; and calling said transport object to start said device. A method as claimed in claim 4 comprising the further step of: sending a data buffer from said transport object to said device driver. A method as claimed in claim 8 comprising the further step of: updating the state of both the interface object and the transport object. A method as claimed in claim 9 comprising the further steps of: ending the use of said created object oriented component; invoking a destructor function for said interface object; and invoking a destructor for said transport object.

Inventors: DINALLO CHRIS A, DINALLO, CHRIS A.
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1996
Main classification: G06F9
IPC codes: G06F9, G06F13