JP5489437B2 - Device driver creation method, creation apparatus, and program - Google Patents

Device driver creation method, creation apparatus, and program Download PDF

Info

Publication number
JP5489437B2
JP5489437B2 JP2008229088A JP2008229088A JP5489437B2 JP 5489437 B2 JP5489437 B2 JP 5489437B2 JP 2008229088 A JP2008229088 A JP 2008229088A JP 2008229088 A JP2008229088 A JP 2008229088A JP 5489437 B2 JP5489437 B2 JP 5489437B2
Authority
JP
Japan
Prior art keywords
endian
device driver
dependent
layer
conversion function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2008229088A
Other languages
Japanese (ja)
Other versions
JP2010061584A (en
Inventor
晃生 中川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2008229088A priority Critical patent/JP5489437B2/en
Publication of JP2010061584A publication Critical patent/JP2010061584A/en
Application granted granted Critical
Publication of JP5489437B2 publication Critical patent/JP5489437B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、複数システムで共通的に使用することが可能であるデバイスドライバの作成方法及び作成装置、並びにプログラムに関する。 The present invention relates to a device driver creation method, creation apparatus, and program that can be commonly used in a plurality of systems.

従来、デバイスドライバは、搭載されるシステムのハードウェア特性を考慮して構築する。そのため、あるハードウェア向けに作成したデバイスドライバを他のハードウェア上で駆動させることは切替えが困難であった。これに対し、例えば、特許文献1に記載の技術では、デバイスドライバはDDI(Device Driver Interface)に対してデータの読み書きを要求し、DDIがバス及びデバイスのエンディアンを考慮してエンディアン変換を行っている。また、UNIX(登録商標)等のOS(Operation System)ではエンディアン変換関数ntohl()等を用いている。これらの方法によりデバイスドライバは、搭載されるシステムのエンディアンを考慮せずに済むようになっている。   Conventionally, a device driver is constructed in consideration of hardware characteristics of a system to be mounted. For this reason, it is difficult to switch a device driver created for a piece of hardware on another piece of hardware. On the other hand, for example, in the technology described in Patent Document 1, the device driver requests data reading / writing from a DDI (Device Driver Interface), and the DDI performs endian conversion in consideration of the endian of the bus and the device. Yes. Further, an OS (Operation System) such as UNIX (registered trademark) uses an endian conversion function ntohl (). With these methods, the device driver does not need to consider the endian of the installed system.

特開平9−212444号公報JP-A-9-212444

しかしながら、特許文献1に記載の技術では、DDIを介してハードウェアにアクセスするため、DDIによるエンディアンの判断処理が冗長な負荷となってしまう。また、PCIバス等を用いるシステムでは、PCIバス等のエンディアンと、CPUやOSのエンディアンとが異なる場合がある。さらに、UNIX等で用いられるntohl()等は、扱うシステムのエンディアン特性が複雑になると、実装が煩雑になり、エンディアン特性が異なるシステム間でのデバイスドライバの流用が困難になってしまう。また、エンディアン変換処理が複数実施されて冗長な負荷となってしまう可能性がある。   However, in the technique described in Patent Document 1, since hardware is accessed via DDI, endian determination processing by DDI becomes a redundant load. In a system using a PCI bus or the like, the endian of the PCI bus or the like may be different from the endian of the CPU or OS. Further, ntohl () and the like used in UNIX and the like become complicated when the endian characteristics of the system to be handled become complicated, and it becomes difficult to divert the device driver between systems having different endian characteristics. In addition, a plurality of endian conversion processes may be performed, resulting in a redundant load.

本発明は前述の問題点に鑑み、エンディアン特性が異なるシステム間で共通的に使用することが可能であり、かつ冗長な負荷を省き最適化が可能であるデバイスドライバを作成できるようにすることを目的としている。   In view of the above-described problems, the present invention provides a device driver that can be used in common among systems having different endian characteristics and can be optimized by eliminating redundant loads. It is aimed.

本発明のデバイスドライバの作成方法は、ハードウェアのエンディアンに応じて処理を切替えるデバイスドライバの作成方法であって、エンディアン変換機能を利用するために、デバイスドライバソースにバスのエンディアン特性に関するシステム依存エンディアンヘッダをインクルードすることにより、システム依存エンディアン変換関数を呼び出す呼び出しステップと、前記バスのエンディアン特性に基づいて、前記呼び出されたシステム依存エンディアン変換関数を基本形エンディアン変換関数へと置換する置換ステップと、MPUのエンディアン特性に基づいて、前記置換された基本形エンディアン変換関数に対応する変換処理を選択する選択ステップと、前記選択される変換処理を用いて、前記デバイスのエンディアンを変換する変換ステップとを有することを特徴とする。 The device driver creation method of the present invention is a device driver creation method that switches processing according to the endian of the hardware. In order to use the endian conversion function, a system-dependent endian relating to the endian characteristic of the bus is used as the device driver source. A call step for calling a system-dependent endian conversion function by including a header; a replacement step for replacing the called system-dependent endian conversion function with a basic type endian conversion function based on the endian characteristics of the bus; A selection step for selecting a conversion process corresponding to the replaced basic type endian conversion function based on the endian characteristics of the device, and converting the endian of the device using the selected conversion process And having a conversion step.

本発明によれば、エンディアン特性が異なるシステム間でのデバイスドライバの流用が可能となる。また、複雑なエンディアン特性をもつシステムにおいても、冗長なエンディアン変換処理を省き、処理を最適化することが可能となる。   According to the present invention, it is possible to divert a device driver between systems having different endian characteristics. Further, even in a system having complicated endian characteristics, redundant endian conversion processing can be omitted and processing can be optimized.

(第1の実施形態)
以下、本発明の実施形態について図面を参照しながら説明する。
図1は、本実施形態のデバイスドライバの代表的な階層構造を示す図である。
図1において、デバイスドライバ層1は、デバイスドライバヘッダ4と、デバイスドライバソース5とから構成される。そして、システム依存層2は、システム依存エンディアン変換ヘッダ7と、システム依存エンディアン変換ソース8とから構成される。さらに、MPU(OS)層3は、基本形エンディアン変換ヘッダ10と、基本形エンディアン変換ソース11とから構成される。
(First embodiment)
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a diagram showing a typical hierarchical structure of the device driver of this embodiment.
In FIG. 1, the device driver layer 1 includes a device driver header 4 and a device driver source 5. The system-dependent layer 2 includes a system-dependent endian conversion header 7 and a system-dependent endian conversion source 8. Further, the MPU (OS) layer 3 includes a basic type endian conversion header 10 and a basic type endian conversion source 11.

また、デバイスドライバ層1とシステム依存層2とのインターフェースとして、システム依存エンディアン変換関数6が用いられている。さらに、システム依存層2とMPU(OS)層3とのインターフェースとして、基本形エンディアン変換関数9が用いられている。   A system-dependent endian conversion function 6 is used as an interface between the device driver layer 1 and the system-dependent layer 2. Further, a basic type endian conversion function 9 is used as an interface between the system dependent layer 2 and the MPU (OS) layer 3.

デバイスドライバ層1は、エンディアン変換機能を利用するデバイスドライバモジュールを示し、夫々一意となるようなモジュール名をプリフィックスとするシステム依存エンディアン変換関数6を用いる。ここで、システム依存エンディアン変換関数6の内部処理に関しては実装せず、システム依存エンディアン変換ヘッダ7をインクルードする。   The device driver layer 1 indicates a device driver module that uses an endian conversion function, and uses a system-dependent endian conversion function 6 having a unique module name as a prefix. Here, the internal processing of the system-dependent endian conversion function 6 is not implemented, and the system-dependent endian conversion header 7 is included.

システム依存層2は、デバイスドライバ層1が利用するシステム依存エンディアン変換関数6の内容を構築システムに適用させる階層を示している。システムの構築者は、構築するシステムにおいて、システム依存エンディアン変換関数6をMPU(OS)層3が提供する基本形エンディアン変換関数9を用いてシステム依存エンディアン変換ヘッダ7とシステム依存エンディアン変換ソース8とに構築する。また、システム依存層2を構築する際は、基本形エンディアン変換ヘッダ10をインクルードする。   The system-dependent layer 2 indicates a hierarchy for applying the contents of the system-dependent endian conversion function 6 used by the device driver layer 1 to the construction system. In the system to be built, the system builder uses the basic type endian conversion function 9 provided by the MPU (OS) layer 3 to convert the system dependent endian conversion function 6 into a system dependent endian conversion header 7 and a system dependent endian conversion source 8. To construct. Further, when constructing the system dependence layer 2, the basic type endian conversion header 10 is included.

MPU(OS)層3は、構築システムのMPU(OS)が採用するエンディアンからビックエンディアン、リトルエンディアン夫々へ変換する基本形エンディアン変換関数9を提供する。そして、基本形エンディアン変換関数9は、基本形エンディアン変換ヘッダ10と基本形エンディアン変換ソース11とに構築する。   The MPU (OS) layer 3 provides a basic type endian conversion function 9 for converting from endian to big endian and little endian adopted by the MPU (OS) of the construction system. The basic type endian conversion function 9 is constructed in a basic type endian conversion header 10 and a basic type endian conversion source 11.

図2は、基本形エンディアン変換関数の一覧を示す図である。以降の説明では、複数種類のビット数に対応する表現でインターフェースの説明を行うが、16ビット、32ビット、64ビット等の各ビット幅に対応した基本形エンディアン変換関数を用意する。   FIG. 2 is a diagram showing a list of basic type endian conversion functions. In the following description, the interface will be described in terms of expressions corresponding to a plurality of types of bits, but a basic endian conversion function corresponding to each bit width such as 16 bits, 32 bits, 64 bits, etc. is prepared.

hostToBe()21は、引数で与えられる値をMPU(OS)の表現からビックエンディアンに変換する機能を持つ関数である。hostToLe()22は、引数で与えられる値をMPU(OS)の表現からリトルエンディアンへ変換する機能を持つ関数である。beToHost()23は、引数で与えられる値をビックエンディアンからMPU(OS)の表現に変換する機能を持つ関数である。leToHost()24は引数で与えられる値をリトルエンディアンからMPU(OS)の表現に変換する機能を持つ関数である。   The hostToBe () 21 is a function having a function of converting the value given by the argument from the MPU (OS) representation to the big endian. The hostToLe () 22 is a function having a function of converting the value given by the argument from the MPU (OS) representation into little endian. beToHost () 23 is a function having a function of converting a value given by an argument from a big endian into an MPU (OS) representation. leToHost () 24 is a function having a function of converting a value given by an argument from a little endian into an MPU (OS) expression.

なお、本実施形態ではC言語による記述を用いるが、開発システムによっては実行効率、開発効率等の目的でアセンブラやC++など他の開発言語を用いることも可能である。また、デバイスドライバヘッダ4、システム依存エンディアン変換ソース8、基本形エンディアン変換ソース11等は、開発システムに応じて省略が可能であるものとする。   In this embodiment, a description in C language is used. However, depending on the development system, other development languages such as an assembler and C ++ can be used for the purpose of execution efficiency and development efficiency. The device driver header 4, the system-dependent endian conversion source 8, the basic type endian conversion source 11, and the like can be omitted depending on the development system.

次に、本実施形態のデバイスドライバの階層構造の一例を図3に示す。図3に示すシステムは、開発デバイスがリトルエンディアン、バス等のシステム依存部分がビックエンディアン、MPU(OS)がビックエンディアンの特性を持つ。   Next, an example of the hierarchical structure of the device driver of this embodiment is shown in FIG. The system shown in FIG. 3 has the characteristics that the development device is little endian, the system-dependent portion such as a bus is big endian, and the MPU (OS) is big endian.

図3において、デバイスドライバ層31、システム依存層32、及びMPU(OS)層33の3層構造となっている。そして、デバイスドライバソース34、システム依存エンディアン変換関数35、システム依存エンディアン変換ヘッダ36、基本形エンディアン変換関数37、及び基本形エンディアン変換ヘッダ38から構成される。   In FIG. 3, the device driver layer 31, the system dependent layer 32, and the MPU (OS) layer 33 have a three-layer structure. A device driver source 34, a system-dependent endian conversion function 35, a system-dependent endian conversion header 36, a basic type endian conversion function 37, and a basic type endian conversion header 38 are included.

図4は、デバイスドライバソース34の抜粋内容41を示す図である。
図4において、「sys_endian.h」は、システム依存エンディアン変換ヘッダ36を示している。また、システム依存エンディアン変換関数35として「usb_leToHost32()」を呼び出している。
FIG. 4 is a diagram showing an excerpt content 41 of the device driver source 34.
In FIG. 4, “sys_endian.h” indicates the system-dependent endian conversion header 36. Further, “usb_leToHost32 ()” is called as the system-dependent endian conversion function 35.

図5は、システム依存エンディアン変換ヘッダ36の内容51を示す図である。
図5において、「convert_endian.h」は、基本形エンディアン変換ヘッダ38を表す。また、「usb_leToHost32()」を基本形エンディアン変換関数37である「leToHost32()」を用いて構築している。
FIG. 5 is a diagram showing the contents 51 of the system-dependent endian conversion header 36.
In FIG. 5, “convert_endian.h” represents a basic type endian conversion header 38. Further, “usb_leToHost32 ()” is constructed using “leToHost32 ()” which is the basic type endian conversion function 37.

図6は、基本形エンディアン変換ヘッダ38の内容61を示す図である。
図6においては、基本形エンディアン変換関数37の実体を定義している。ここで、「CPU_BIG_ENDIAN」は、開発環境で定義するマクロであり、MPUがビックエンディアンの場合に「CPU_BIG_ENDIAN」のマクロを定義する。本実施形態では、MPUがビックエンディアンのため、「CPU_BIG_ENDIAN」のマクロが定義されているものとする。結果的に、「usb_leToHost32()」からバイトスワップ処理が発生する。
FIG. 6 shows the contents 61 of the basic endian conversion header 38.
In FIG. 6, the entity of the basic type endian conversion function 37 is defined. Here, “CPU_BIG_ENDIAN” is a macro defined in the development environment. When the MPU is big endian, a macro of “CPU_BIG_ENDIAN” is defined. In this embodiment, since the MPU is big endian, a macro of “CPU_BIG_ENDIAN” is defined. As a result, byte swap processing occurs from “usb_leToHost32 ()”.

次に、図7のフローチャートを参照しながら、本実施形態の「usb_leToHost32()」が呼び出された後の関数置換の流れを説明する。 まず、「usb_leToHost32」をシステム依存エンディアン変換ヘッダ36で置換する(ステップS1A)。その結果、「leToHost32」とする(ステップS2A)。次に、「leToHost32()」を基本形エンディアン変換ヘッダ38で相互変換する(ステップS3A)。その結果、「byteSwap32」とする(ステップS4A)。よって、結果的にはバイトスワップ処理を行うことになる。   Next, the flow of function replacement after “usb_leToHost32 ()” of the present embodiment is called will be described with reference to the flowchart of FIG. First, “usb_leToHost32” is replaced with the system-dependent endian conversion header 36 (step S1A). As a result, “leToHost32” is set (step S2A). Next, “leToHost32 ()” is mutually converted by the basic type endian conversion header 38 (step S3A). As a result, “byteSwap32” is set (step S4A). As a result, byte swap processing is performed.

以上のように本実施形態によれば、デバイスドライバをデバイスドライバ層、システム依存層、MPU(OS)層の3層構成とし、エンディアン特性が異なるシステム間でのデバイスドライバの流用が可能となる。また、複雑なエンディアン特性をもつシステムにおいても、冗長なエンディアン変換処理を省き、処理を最適化することが可能となる。   As described above, according to the present embodiment, the device driver has a three-layer configuration of the device driver layer, the system dependence layer, and the MPU (OS) layer, and the device driver can be used between systems having different endian characteristics. Further, even in a system having complicated endian characteristics, redundant endian conversion processing can be omitted and processing can be optimized.

(第2の実施形態)
次に、第2の実施形態として、開発対象のデバイスは第1の実施形態と同じであるが、開発システムが異なる例について説明する。このシステムでは、開発デバイスがリトルエンディアン、バス等のシステム依存部分がビックエンディアン、MPU(OS)がリトルエンディアンの特性を持つ。
(Second Embodiment)
Next, as a second embodiment, an example in which the development target device is the same as that in the first embodiment but the development system is different will be described. In this system, a development device has a little endian characteristic, a system dependent part such as a bus has a big endian characteristic, and an MPU (OS) has a little endian characteristic.

図8は、本実施形態のデバイスドライバの階層構造の一例を示す図である。
図8において、デバイスドライバ層81、システム依存層82、及びMPU(OS)層83の3層構造となっている。そして、デバイスドライバソース84、システム依存エンディアン変換関数85、システム依存エンディアン変換ヘッダ86、基本形エンディアン変換関数87、及び基本形エンディアン変換ヘッダ88から構成されている。
FIG. 8 is a diagram showing an example of the hierarchical structure of the device driver of this embodiment.
In FIG. 8, the device driver layer 81, the system dependent layer 82, and the MPU (OS) layer 83 have a three-layer structure. A device driver source 84, a system-dependent endian conversion function 85, a system-dependent endian conversion header 86, a basic type endian conversion function 87, and a basic type endian conversion header 88 are included.

ここで、本実施形態のデバイスドライバソース84には、第1の実施形態のデバイスドライバソース34がそのまま流用可能となる。そのため、デバイスドライバソース84の抜粋内容については、図4を参照しながら説明を行う。   Here, the device driver source 34 of the first embodiment can be used as it is for the device driver source 84 of the present embodiment. Therefore, the contents extracted from the device driver source 84 will be described with reference to FIG.

図4において、「sys_endian.h」はシステム依存エンディアン変換ヘッダ86を示している。また、システム依存エンディアン変換関数85として「usb_leToHost32」を呼び出している。   In FIG. 4, “sys_endian.h” indicates a system-dependent endian conversion header 86. Further, “usb_leToHost32” is called as the system-dependent endian conversion function 85.

また、本実施形態のシステム依存エンディアン変換ヘッダ86には、第1の実施形態のシステム依存エンディアン変換ヘッダ36がそのまま流用可能となる。そのため、システム依存エンディアン変換ヘッダ86の内容については、図5を参照しながら説明を行う。   Further, the system-dependent endian conversion header 86 of the first embodiment can be used as it is for the system-dependent endian conversion header 86 of the present embodiment. Therefore, the contents of the system-dependent endian conversion header 86 will be described with reference to FIG.

図5において、「convert_endian.h」は基本形エンディアン変換ヘッダ88を表している。また、「usb_leToHost32()」を基本形エンディアン変換関数87である「leToHost32()」を用いて構築している。   In FIG. 5, “convert_endian.h” represents a basic type endian conversion header 88. Further, “usb_leToHost32 ()” is constructed using “leToHost32 ()” which is the basic type endian conversion function 87.

さらに、本実施形態の基本形エンディアン変換ヘッダ88には、第1の実施形態の基本形エンディアン変換ヘッダ38がそのまま流用可能となる。そのため、基本形エンディアン変換ヘッダ88の内容については、図6を参照しながら説明を行う。   Further, the basic type endian conversion header 38 of the first embodiment can be used as it is for the basic type endian conversion header 88 of the present embodiment. Therefore, the contents of the basic type endian conversion header 88 will be described with reference to FIG.

図6においては、基本形エンディアン変換関数87の実体を定義している。ここで、「CPU_BIG_ENDIAN」は開発環境で定義するマクロであり、MPUがビックエンディアンの場合に「CPU_BIG_ENDIAN」のマクロを定義する。本実施形態では、MPUがリトルエンディアンのため、「CPU_BIG_ENDIAN」のマクロは定義されていないものとする。結果的に、「usb_leToHost32()」からバイトスワップ処理は発生しない。   In FIG. 6, the entity of the basic type endian conversion function 87 is defined. Here, “CPU_BIG_ENDIAN” is a macro defined in the development environment, and when the MPU is big endian, a macro of “CPU_BIG_ENDIAN” is defined. In this embodiment, since the MPU is little endian, the “CPU_BIG_ENDIAN” macro is not defined. As a result, byte swap processing does not occur from “usb_leToHost32 ()”.

次に、図9のフローチャートを参照しながら、本実施形態の関数置換の流れを説明する。
まず、「usb_leToHost32()」をシステム依存エンディアン変換ヘッダ86で置換する(ステップS1B)。その結果、「leToHost32()」とする(ステップS2B)。次に、「leToHost32()」を基本形エンディアン変換ヘッダ88で置換する(ステップS3B)。その結果、無処理とする(ステップS4B)。このため、結果的にはバイトスワップ処理を行わないことになる。
Next, the function replacement flow of this embodiment will be described with reference to the flowchart of FIG.
First, “usb_leToHost32 ()” is replaced with the system-dependent endian conversion header 86 (step S1B). As a result, “leToHost32 ()” is set (step S2B). Next, “leToHost32 ()” is replaced with the basic endian conversion header 88 (step S3B). As a result, no processing is performed (step S4B). As a result, byte swap processing is not performed.

以上のように本実施形態によれば、デバイスドライバをデバイスドライバ層、システム依存層、MPU(OS)層の3層構成とし、エンディアン特性が異なるシステム間でのデバイスドライバの流用が可能となる。また、複雑なエンディアン特性をもつシステムにおいても、冗長なエンディアン変換処理を省き、処理を最適化することが可能となる。   As described above, according to the present embodiment, the device driver has a three-layer configuration of the device driver layer, the system dependence layer, and the MPU (OS) layer, and the device driver can be used between systems having different endian characteristics. Further, even in a system having complicated endian characteristics, redundant endian conversion processing can be omitted and processing can be optimized.

(第3の実施形態)
次に、第3の実施形態として、開発対象のデバイスは第1及び第2の実施形態と同じであるが、開発システムが異なる他の例について説明する。このシステムでは、開発デバイスがリトルエンディアン、バス等のシステム依存部分が特殊エンディアン、MPU(OS)がビックエンディアンの特性を持つ。
(Third embodiment)
Next, as a third embodiment, another example in which the development target device is the same as that in the first and second embodiments but the development system is different will be described. In this system, the development device has little endian, the system-dependent portion such as a bus has special endian, and the MPU (OS) has big endian characteristics.

図10は、本実施形態のデバイスドライバの階層構造の一例を示す図である。
図10において、デバイスドライバ層101、システム依存層102及びMPU(OS)層103の3層構造となっている。そして、デバイスドライバソース104、システム依存エンディアン変換関数105、システム依存エンディアン変換ヘッダ106、及びシステム依存エンディアン変換ソース107を有する。さらに、基本形エンディアン変換関数108、及び基本形エンディアン変換ヘッダ109を有する。ここで、特殊エンディアンとは、基本形エンディアン変換関数108だけでは変換できない特殊なエンディアン変換が必要なものを指す。
FIG. 10 is a diagram showing an example of the hierarchical structure of the device driver of this embodiment.
In FIG. 10, the device driver layer 101, the system dependent layer 102, and the MPU (OS) layer 103 have a three-layer structure. A device driver source 104, a system-dependent endian conversion function 105, a system-dependent endian conversion header 106, and a system-dependent endian conversion source 107 are included. Furthermore, a basic type endian conversion function 108 and a basic type endian conversion header 109 are provided. Here, the special endian means a thing that requires special endian conversion that cannot be converted only by the basic endian conversion function 108.

図11は、特殊エンディアンの変換前バイト配列111及び変換後バイト配列112を示す図である。ここで、本実施形態のデバイスドライバソース104には、第1の実施形態のデバイスドライバソース34がそのまま流用可能となる。そのため、デバイスドライバソース104の抜粋内容については、図4を参照しながら説明を行う。   FIG. 11 is a diagram showing a special endian byte array 111 before conversion and a byte array 112 after conversion. Here, the device driver source 34 of the first embodiment can be used as it is for the device driver source 104 of the present embodiment. Therefore, the contents extracted from the device driver source 104 will be described with reference to FIG.

図4において、「sys_endian.h」は、システム依存エンディアン変換ヘッダ106を示している。また、システム依存エンディアン変換関数105として「usb_leToHost32()」を呼び出している。   In FIG. 4, “sys_endian.h” indicates the system-dependent endian conversion header 106. In addition, “usb_leToHost32 ()” is called as the system-dependent endian conversion function 105.

図12は、システム依存エンディアン変換ヘッダ106の内容121を示す図である。
図12において、「convert_endian.h」は、基本形エンディアン変換ヘッダ109のことである。また、「usb_leToHost32()」を特殊エンディアン変換「specialLeToHost32()」を用いて構築している。また、「specialLeToHost32()」は、システム依存エンディアン変換ソース107にて実装する。
FIG. 12 is a diagram showing the contents 121 of the system-dependent endian conversion header 106.
In FIG. 12, “convert_endian.h” is a basic type endian conversion header 109. Also, “usb_leToHost32 ()” is constructed using special endian conversion “specialLeToHost32 ()”. “SpecialLeToHost32 ()” is implemented by the system-dependent endian conversion source 107.

図13は、そのシステム依存エンディアン変換ソース107にて実装されている実装例131をに示す図である。
図13において、「xxxSwap()」として特殊エンディアン変換を行った後、基本形エンディアン変換関数108である「leToHost32()」を呼び出して整合性を取っている。
FIG. 13 is a diagram showing an implementation example 131 implemented by the system-dependent endian conversion source 107.
In FIG. 13, after special endian conversion is performed as “xxxSwap ()”, “leToHost32 ()” which is the basic endian conversion function 108 is called to ensure consistency.

また、本実施形態の基本形エンディアン変換ヘッダ109には、第1の実施形態の基本形エンディアン変換ヘッダ38がそのまま流用可能となる。そのため、基本形エンディアン変換ヘッダ109の内容については、図6を参照しながら説明を行う。   Further, the basic endian conversion header 38 of the first embodiment can be used as it is for the basic endian conversion header 109 of the present embodiment. Therefore, the contents of the basic type endian conversion header 109 will be described with reference to FIG.

図6においては、基本形エンディアン変換関数108の実体を定義している。ここで、「CPU_BIG_ENDIAN」は、開発環境で定義するマクロであり、MPUがビックエンディアンの場合に「CPU_BIG_ENDIAN」のマクロを定義する。本実施形態では、MPUがビックエンディアンのため、「CPU_BIG_ENDIAN」のマクロが定義されているものとする。結果的に、「usb_leToHost32()」からバイトスワップ処理が発生する。   In FIG. 6, the entity of the basic type endian conversion function 108 is defined. Here, “CPU_BIG_ENDIAN” is a macro defined in the development environment. When the MPU is big endian, a macro of “CPU_BIG_ENDIAN” is defined. In this embodiment, since the MPU is big endian, a macro of “CPU_BIG_ENDIAN” is defined. As a result, byte swap processing occurs from “usb_leToHost32 ()”.

次に、図14のフローチャートを参照しながら、本実施形態の関数置換の流れを説明する。
図14において、「usb_leToHost32()」をシステム依存エンディアン変換ヘッダ106で置換する(ステップS1C)。その結果、「specialLeToHost32()」とする(ステップS2C)。次に、「specialLeToHost32()」内の「xxxSwap()」を実行して特殊エンディアン変換を行う(ステップS3C)。
Next, the function replacement flow of this embodiment will be described with reference to the flowchart of FIG.
In FIG. 14, “usb_leToHost32 ()” is replaced with the system-dependent endian conversion header 106 (step S1C). As a result, “specialLeToHost32 ()” is set (step S2C). Next, “xxxSwap ()” in “specialLeToHost32 ()” is executed to perform special endian conversion (step S3C).

続いて、「leToHost32()」を基本形エンディアン変換ヘッダ109で置換する(ステップS4C)。その結果、「byteSwap32()」とする(ステップS5C)。このため、結果的にはバイトスワップ処理を行うことになる。   Subsequently, “leToHost32 ()” is replaced with the basic endian conversion header 109 (step S4C). As a result, “byteSwap32 ()” is set (step S5C). As a result, byte swap processing is performed.

以上のように本実施形態によれば、デバイスドライバをデバイスドライバ層、システム依存層、MPU(OS)層の3層構成とし、エンディアン特性が異なるシステム間でのデバイスドライバの流用が可能となる。また、複雑なエンディアン特性をもつシステムにおいても、冗長なエンディアン変換処理を省き、処理を最適化することが可能となる。   As described above, according to the present embodiment, the device driver has a three-layer configuration of the device driver layer, the system dependence layer, and the MPU (OS) layer, and the device driver can be used between systems having different endian characteristics. Further, even in a system having complicated endian characteristics, redundant endian conversion processing can be omitted and processing can be optimized.

(本発明に係る他の実施形態)
前述した本発明の実施形態におけるデバイスドライバの作成方法の各ステップは、コンピュータのRAMやROMなどに記憶されたプログラムが動作することによって実現できる。このプログラム及び前記プログラムを記録したコンピュータ読み取り可能な記録媒体は本発明に含まれる。
(Other embodiments according to the present invention)
Each step of the device driver creation method in the above-described embodiment of the present invention can be realized by operating a program stored in a RAM or ROM of a computer. This program and a computer-readable recording medium recording the program are included in the present invention.

また、本発明は、例えば、システム、装置、方法、プログラムもしくは記録媒体等としての実施形態も可能であり、具体的には、複数の機器から構成されるシステムに適用してもよいし、また、一つの機器からなる装置に適用してもよい。   Further, the present invention can be implemented as, for example, a system, apparatus, method, program, or recording medium. Specifically, the present invention may be applied to a system including a plurality of devices. The present invention may be applied to an apparatus composed of a single device.

なお、本発明は、前述した実施形態の機能を実現するソフトウェアのプログラム(実施形態では図7、9、14に示すフローチャートに対応したプログラム)を、システムまたは装置に直接、または遠隔から供給する場合も含む。そして、そのシステムまたは装置のコンピュータが前記供給されたプログラムコードを読み出して実行することによっても達成される場合を含む。   In the present invention, a software program (in the embodiment, a program corresponding to the flowcharts shown in FIGS. 7, 9, and 14) for realizing the functions of the above-described embodiments is supplied directly or remotely to a system or apparatus. Including. This includes the case where the system or the computer of the apparatus is also achieved by reading and executing the supplied program code.

したがって、本発明の機能処理をコンピュータで実現するために、前記コンピュータにインストールされるプログラムコード自体も本発明を実現するものである。つまり、本発明は、本発明の機能処理を実現するためのコンピュータプログラム自体も含まれる。   Accordingly, since the functions of the present invention are implemented by computer, the program code installed in the computer also implements the present invention. In other words, the present invention includes a computer program itself for realizing the functional processing of the present invention.

その場合、プログラムの機能を有していれば、オブジェクトコード、インタプリタにより実行されるプログラム、OSに供給するスクリプトデータ等の形態であってもよい。   In that case, as long as it has the function of a program, it may be in the form of object code, a program executed by an interpreter, script data supplied to the OS, and the like.

プログラムを供給するための記録媒体としては、例えば、フレキシブルディスク、ハードディスク、光ディスク、光磁気ディスクなどがある。さらに、MO、CD−ROM、CD−R、CD−RW、磁気テープ、不揮発性のメモリカード、ROM、DVD(DVD−ROM、DVD−R)などもある。   Examples of the recording medium for supplying the program include a flexible disk, a hard disk, an optical disk, and a magneto-optical disk. Further, there are MO, CD-ROM, CD-R, CD-RW, magnetic tape, nonvolatile memory card, ROM, DVD (DVD-ROM, DVD-R) and the like.

その他、プログラムの供給方法としては、クライアントコンピュータのブラウザを用いてインターネットのホームページに接続する方法がある。そして、前記ホームページから本発明のコンピュータプログラムそのもの、もしくは圧縮され自動インストール機能を含むファイルをハードディスク等の記録媒体にダウンロードすることによっても供給できる。   As another program supply method, there is a method of connecting to a homepage on the Internet using a browser of a client computer. The computer program itself of the present invention or a compressed file including an automatic installation function can be downloaded from the homepage by downloading it to a recording medium such as a hard disk.

また、本発明のプログラムを構成するプログラムコードを複数のファイルに分割し、それぞれのファイルを異なるホームページからダウンロードすることによっても実現可能である。つまり、本発明の機能処理をコンピュータで実現するためのプログラムファイルを複数のユーザに対してダウンロードさせるWWWサーバも、本発明に含まれるものである。   It can also be realized by dividing the program code constituting the program of the present invention into a plurality of files and downloading each file from a different homepage. That is, a WWW server that allows a plurality of users to download a program file for realizing the functional processing of the present invention on a computer is also included in the present invention.

また、その他の方法として、本発明のプログラムを暗号化してCD−ROM等の記録媒体に格納してユーザに配布し、所定の条件をクリアしたユーザに対し、インターネットを介してホームページから暗号化を解く鍵情報をダウンロードさせる。そして、その鍵情報を使用することにより暗号化されたプログラムを実行してコンピュータにインストールさせて実現することも可能である。   As another method, the program of the present invention is encrypted, stored in a recording medium such as a CD-ROM, distributed to users, and encrypted from a homepage via the Internet to users who have cleared predetermined conditions. Download the key information to be solved. It is also possible to execute the encrypted program by using the key information and install the program on a computer.

また、コンピュータが、読み出したプログラムを実行することによって、前述した実施形態の機能が実現される。さらに、そのプログラムの指示に基づき、コンピュータ上で稼動しているOSなどが、実際の処理の一部または全部を行い、その処理によっても前述した実施形態の機能が実現され得る。   Further, the functions of the above-described embodiments are realized by the computer executing the read program. Furthermore, based on the instructions of the program, an OS or the like running on the computer performs part or all of the actual processing, and the functions of the above-described embodiments can be realized by the processing.

さらに、その他の方法として、まず記録媒体から読み出されたプログラムが、コンピュータに挿入された機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに書き込まれる。そして、そのプログラムの指示に基づき、その機能拡張ボードや機能拡張ユニットに備わるCPUなどが実際の処理の一部または全部を行い、その処理によっても前述した実施形態の機能が実現される。   As another method, the program read from the recording medium is first written in a memory provided in a function expansion board inserted into the computer or a function expansion unit connected to the computer. Then, based on the instructions of the program, the CPU or the like provided in the function expansion board or function expansion unit performs part or all of the actual processing, and the functions of the above-described embodiments are also realized by the processing.

本発明の第1の実施形態のデバイスドライバの代表的な階層構造を示す図である。It is a figure which shows the typical hierarchical structure of the device driver of the 1st Embodiment of this invention. 基本形エンディアン変換関数の一覧表を示す図である。It is a figure which shows the list of a basic form endian conversion function. 本発明の第1の実施形態のデバイスドライバの階層構造の一例を示す図である。It is a figure which shows an example of the hierarchical structure of the device driver of the 1st Embodiment of this invention. 本発明の第1の実施形態のデバイスドライバ層のソースコード(抜粋)の内容を示す図である。It is a figure which shows the content of the source code (extract) of the device driver layer of the 1st Embodiment of this invention. 本発明の第1の実施形態のシステム依存エンディアン変換ヘッダの内容を示す図である。It is a figure which shows the content of the system dependence endian conversion header of the 1st Embodiment of this invention. 本発明の第1の実施形態の基本形エンディアン変換ヘッダの内容を示す図である。It is a figure which shows the content of the basic form endian conversion header of the 1st Embodiment of this invention. 本発明の第1の実施形態の関数置換の処理手順の一例を示すフローチャートである。It is a flowchart which shows an example of the process sequence of the function substitution of the 1st Embodiment of this invention. 本発明の第2の実施形態のデバイスドライバの階層構造の一例を示す図である。It is a figure which shows an example of the hierarchical structure of the device driver of the 2nd Embodiment of this invention. 本発明の第2の実施形態の関数置換の処理手順の一例を示すフローチャートである。It is a flowchart which shows an example of the process procedure of the function substitution of the 2nd Embodiment of this invention. 本発明の第3の実施形態のデバイスドライバの階層構造の一例を示す図である。It is a figure which shows an example of the hierarchical structure of the device driver of the 3rd Embodiment of this invention. 本発明の第3の実施形態の特殊エンディアンを説明するための図である。It is a figure for demonstrating the special endian of the 3rd Embodiment of this invention. 本発明の第3の実施形態のシステム依存エンディアン変換ヘッダの内容を示す図である。It is a figure which shows the content of the system dependence endian conversion header of the 3rd Embodiment of this invention. 本発明の第3の実施形態のシステム依存エンディアン変換ソース(抜粋)の内容を示す図である。It is a figure which shows the content of the system dependence endian conversion source (extract) of the 3rd Embodiment of this invention. 本発明の第3の実施形態の関数置換の処理手順の一例を示すフローチャートである。It is a flowchart which shows an example of the process sequence of the function substitution of the 3rd Embodiment of this invention.

符号の説明Explanation of symbols

1 デバイスドライバ層
2 システム依存層
3 MPU(OS)層
4 デバイスドライバヘッダ
5 デバイスドライバソース
6 システム依存エンディアン変換関数
7 システム依存エンディアン変換ヘッダ
8 システム依存エンディアン変換ソース
9 基本形エンディアン変換関数
10 基本形エンディアン変換ヘッダ
11 基本形エンディアン変換ソース
1 Device Driver Layer 2 System Dependent Layer 3 MPU (OS) Layer 4 Device Driver Header 5 Device Driver Source 6 System Dependent Endian Conversion Function 7 System Dependent Endian Conversion Header 8 System Dependent Endian Conversion Source 9 Basic Endian Conversion Function 10 Basic Endian Conversion Header 11 Basic endian conversion source

Claims (5)

ハードウェアのエンディアンに応じて処理を切替えるデバイスドライバの作成方法であって、
エンディアン変換機能を利用するために、デバイスドライバソースにバスのエンディアン特性に関するシステム依存エンディアンヘッダをインクルードすることにより、システム依存エンディアン変換関数を呼び出す呼び出しステップと、
前記バスのエンディアン特性に基づいて、前記呼び出されたシステム依存エンディアン変換関数を基本形エンディアン変換関数へと置換する置換ステップと、
MPUのエンディアン特性に基づいて、前記置換された基本形エンディアン変換関数に対応する変換処理を選択する選択ステップと、
前記選択される変換処理を用いて、前記デバイスのエンディアンを変換する変換ステップとを有することを特徴とするデバイスドライバの作成方法。
A method of creating a device driver that switches processing according to the endian of the hardware,
Invoking the system-dependent endian conversion function by including a system-dependent endian header related to the endian characteristics of the bus in the device driver source to use the endian conversion function;
A replacement step of replacing the called system-dependent endian conversion function with a basic endian conversion function based on the endian characteristics of the bus;
A selection step of selecting a conversion process corresponding to the replaced basic type endian conversion function based on an endian characteristic of the MPU;
And a conversion step of converting the endian of the device using the selected conversion process .
前記基本形エンディアン変換関数は、引数で与えられる値を、MPUの表現に変換する機能を持つことを特徴とする請求項1記載のデバイスドライバの作成方法。2. The device driver creation method according to claim 1, wherein the basic endian conversion function has a function of converting a value given by an argument into an MPU expression. 前記デバイスドライバは、少なくともデバイスドライバ層、システム依存層、MPU層の階層を有し、The device driver has at least a device driver layer, a system-dependent layer, and an MPU layer,
前記呼び出しステップは、前記デバイスドライバ層で行われ、The calling step is performed in the device driver layer,
前記置換ステップは、前記システム依存層で行われ、The replacing step is performed in the system dependent layer;
前記選択ステップは、前記MPU層で行われることを特徴とする請求項1記載のデバイスドライバの作成方法。The device driver creation method according to claim 1, wherein the selection step is performed in the MPU layer.
請求項1記載のデバイスドライバの作成方法の各ステップをコンピュータにて実施させるためのプログラム。   A program for causing a computer to execute the steps of the device driver creation method according to claim 1. ハードウェアのエンディアンに応じて処理を切替えるデバイスドライバの作成装置であって、A device driver creation device that switches processing according to hardware endian,
エンディアン変換機能を利用するために、デバイスドライバソースにバスのエンディアン特性に関するシステム依存エンディアンヘッダをインクルードすることにより、システム依存エンディアン変換関数を呼び出す呼び出し手段と、In order to use the endian conversion function, by including a system dependent endian header related to the endian characteristics of the bus in the device driver source, a calling means for calling a system dependent endian conversion function,
前記バスのエンディアン特性に基づいて、前記呼び出されたシステム依存エンディアン変換関数を基本形エンディアン変換関数へと置換する置換手段と、Replacement means for replacing the called system-dependent endian conversion function with a basic endian conversion function based on the endian characteristics of the bus;
MPUのエンディアン特性に基づいて、前記置換された基本形エンディアン変換関数に対応する変換処理を選択する選択手段と、Selection means for selecting a conversion process corresponding to the replaced basic type endian conversion function based on an endian characteristic of the MPU;
前記選択される変換処理を用いて、前記デバイスのエンディアンを変換する変換手段とを有することを特徴とするデバイスドライバの作成装置。A device driver creation apparatus, comprising: conversion means for converting the endian of the device using the selected conversion process.
JP2008229088A 2008-09-05 2008-09-05 Device driver creation method, creation apparatus, and program Expired - Fee Related JP5489437B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008229088A JP5489437B2 (en) 2008-09-05 2008-09-05 Device driver creation method, creation apparatus, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008229088A JP5489437B2 (en) 2008-09-05 2008-09-05 Device driver creation method, creation apparatus, and program

Publications (2)

Publication Number Publication Date
JP2010061584A JP2010061584A (en) 2010-03-18
JP5489437B2 true JP5489437B2 (en) 2014-05-14

Family

ID=42188277

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008229088A Expired - Fee Related JP5489437B2 (en) 2008-09-05 2008-09-05 Device driver creation method, creation apparatus, and program

Country Status (1)

Country Link
JP (1) JP5489437B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002063031A (en) * 2000-08-18 2002-02-28 Fainaaku Kk Architecture switching-reconstruction coping processor
GB0309056D0 (en) * 2003-04-22 2003-05-28 Transitive Technologies Ltd Block translation optimizations for program code conversion
US20070299863A1 (en) * 2006-04-27 2007-12-27 Qualcomm Incorporated Portable object serialization

Also Published As

Publication number Publication date
JP2010061584A (en) 2010-03-18

Similar Documents

Publication Publication Date Title
US8190653B2 (en) Automatic file conversion to a target format
JP2009520268A5 (en)
JP2006178947A (en) Language-neutral and language-specific installation packages for software setup
KR100928382B1 (en) Migration apparatus which convert database of mainframe system into database of open system and method for thereof
US20090303519A1 (en) Printing controller, gui display method, printer driver, and recording medium
CN101553779B (en) Migration apparatus which convert application program of mainframe system into application program of open system and method for thereof
JP5489437B2 (en) Device driver creation method, creation apparatus, and program
JP5157534B2 (en) Behavioral synthesis apparatus and program
US6742180B1 (en) System and method providing seamless transition of operating system environment
JP5228546B2 (en) Behavioral synthesis apparatus and program
KR101099491B1 (en) Method for analyzing power consumption
JP2006285754A (en) Program source code automatic generation system
US20090193330A1 (en) Method of accessing files with XML documents of windows format under Linux
US7620649B2 (en) Method, apparatus, and program for data management
US20060129984A1 (en) Multi-language software executing method and system thereof
JP2009032016A (en) Database selective migration system
JP2011134269A (en) Apparatus and method for processing information, program, and recording medium
JPH1011271A (en) Version down inputting system
JP5726106B2 (en) Embedded system controller
JP5985098B1 (en) program
JP4201206B2 (en) CGI program creation method, recording medium recording program according to the method, and CGI program creation device
JP2006277560A (en) Software development support device, design document generation program and design document generating method
JP2006048640A (en) Software difference extraction application system, difference extraction device, difference application device and program
JP4561211B2 (en) Data retention method of business integration server
US20100115533A1 (en) Request content extraction method and apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110905

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130624

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130702

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20130902

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140128

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140225

R151 Written notification of patent or utility model registration

Ref document number: 5489437

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

LAPS Cancellation because of no payment of annual fees