The present invention relates to a method for driving I/O (input/output) devices of a storage element, more particularly relates to a method for driving I/O devices of storage element without built-in microprocessor control unit (MCU).
The conventional I/O (input/output) devices of a storage element, such as memory card reader, have a built-in microprocessor control unit (MCU). The MCU is with some microinstructions, and the communication between the conventional I/O devices of storage element and a computer is controlled by calling the microinstructions. The main function of the MCU is to compile USB instructions, in order to make the I/O devices of the storage element performing some specific functions, such as reading, writing and reporting the related information of the storage element. Besides, some storage elements are lack of a built-in MCU, such as Smart Media card, eXtreme Digital card and Memory Stick; the MCU of the I/O device builds a physical to logical translation table (PLT table) according to the capacity of the storage elements and the MCU also maintains the PLT table.
Generally, the method for driving the conventional I/O devices of the storage element is to deliver SCSI (small computer system interface) instructions to the storage element by the bus driver. Then the built-in MCU of the storage element calls specific microinstructions by demand, in order to perform the requested jobs. The condition of the method is that the I/O device must have SCSI instructions compatible MCU, and it results that the cost of the I/O devices is extremely high. In this highly competition environment of the electrical device industrial, these kinds of products will lose their attractions to the public, and the manufacturer needs to find more economical methods for reading/writing the storage elements.
Moreover, the improvement of the technical industrial is in a tremendous progress, and the capacities of the storage elements, such as memory cards or micro drives, also grow rapidly. The conventional I/O devices of storage element are under the limitation of the firmware inside the MCU, they can not fully support newer storage elements which have larger capacities. That causes users have to consider the compatibility of existed I/O devices of storage elements before buying a larger storage element. If the capacity of new storage element can not be fully supported by existed I/O device, the only choice of the user is to purchase a new I/O device that can support the new storage element, or purchase a storage element with smaller capacity in order to meet the compatibility of existed I/O device. Supposing that the firmware inside the MCU of the I/O device can be upgraded, and then the I/O device will become more flexible. However, the failure rates and the risks of firmware upgrading are considerably high, so most vendors do not encourage users to upgrade their firmware, and even more many vendors do not provide relating services.
According to aforementioned problems, one purpose of present invention is to provide a method for driving I/O (input/output) devices of a storage element. Pre-compiling the SCSI (small computer system interface) instructions by I/O device driver in computer, and finishes the task by the I/O device which is without a built-in microprocessor control unit (MCU).
Another purpose of present invention is to provide a method for driving I/O devices of the storage element. The method starts at using an I/O device driver in computer to build up a physical to logical translation table (PLT table) for the I/O device which is lack of a built-in MCU. Then the computer can retrieve the capacity information of the storage element, and the compatibility of various capacity of storage element becomes more flexible.
In view of foregoing purposes, the present invention disclosures a method for driving I/O devices of storage element. The steps of the method comprise: sending an I/O request from a user; building hardware independent SCSI instructions based on the I/O request by a storage class driver; executing the hardware independent SCSI instructions by a storage port driver and transferring the hardware independent SCSI instructions into hardware dependent instructions; delivering the hardware dependent instructions by a bus driver to the I/O device of storage element; and executing tasks according to the hardware dependent instructions by the I/O device of storage element.
In accordance with another purpose of the present invention, the present invention disclosures a method for driving a card reader, which comprises: performing an I/O request by a software application; building an I/O request by a storage class driver packet according to the I/O request, wherein the I/O request packet further comprises SCSI request blocks and command descriptor blocks; transferring the SCSI request blocks of the I/O request packet by a card reader driver into acceptable instruction formats of the card reader; delivering the acceptable instruction formats of the card reader by a USB (universal serial bus) driver in a form of frame to the card reader; and the card reader executing task according to data inside the frame.
The present invention will be readily understood by the following detailed description in conjunction with the accompanying drawings.
The present invention is described with preferred embodiments and accompanying drawings. It should be appreciated that all the embodiments are merely used for illustration. Although the present invention has been described in term of a preferred embodiment, the invention is not limited to this embodiment. It will be understood, however, to one skilled in the art, that the present invention may be practiced without some or all of these specific details. In other instances, well known process operations have not been described in detail in order not to unnecessary obscure the present invention.
Referring to
Aforementioned SRBs are then delivered to a device driver 102 of I/O devices of the storage element for further processing, and foregoing disk class driver 101 is a storage class driver. Because the I/O device of the preferred embodiment is not a SCSI device and received SRBs for device driver 102 are hardware independent SCSI instructions, the device driver 102 of I/O device of the storage element must execute and transfer them into hardware dependent instructions. Furthermore, the hardware dependent instructions will be passed to a bus driver 103, and it will be delivered to the I/O device of the storage element 104 through specific bus, subsequently. In accordance with the preferred embodiment, the specific bus is USB (universal serial bus), but other buses are also suitable in other embodiments. There is an asynchronous communication between the USB and the I/O device in a form of frame.
The direction of the data connection in
Referring to
Because the I/O device in the embodiment is lack of a built-in MCU, the SCSI instructions can not directly call the microinstructions inside firmware of the MCU, so the SCSI instructions need to be compiled into hardware executable instructions in the phase of device driver.
Referring to
Furthermore, the Inquiry 304 is used to send the information of the storage element back to the system, and the Test Unit Ready 305 is utilized to verify whether the storage element has been initialized or not. If the storage element has not been initialized, the I/O device driver initializes the storage element and returns the update information of the storage element. The Start/Stop 307 is used to notify the I/O device driver whether the storage element is ready or not. Besides, the Request Sense 308 is introduced for sending error codes in order to verify error's types; furthermore, the Read Capacity 306, the Read Data 309 and the Write Data 310 will be described in detailed in subsequent description.
Referring to
Referring to
The processing procedure of the SCSI instruction Write Data 310 is similar to the processing procedure of the Read Data 309. The difference is that the IRP sent by the device driver includes a request for writing data and a request for bulk out for Write Data 310.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention. The word “comprising” and forms of the word “comprising” as used in the description and in the claims are not meant to exclude variants or additions to the invention. Furthermore, certain terminology has been used for the purposes of descriptive clarity, and not to limit the present invention. The embodiments and preferred features described above should be considered exemplary, with the invention being defined by the appended claims.