CN108205503B - Hardware drive compatible method and terminal - Google Patents

Hardware drive compatible method and terminal Download PDF

Info

Publication number
CN108205503B
CN108205503B CN201611168866.9A CN201611168866A CN108205503B CN 108205503 B CN108205503 B CN 108205503B CN 201611168866 A CN201611168866 A CN 201611168866A CN 108205503 B CN108205503 B CN 108205503B
Authority
CN
China
Prior art keywords
operating system
api
driver
hardware
target hardware
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.)
Active
Application number
CN201611168866.9A
Other languages
Chinese (zh)
Other versions
CN108205503A (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.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp Ltd
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 Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN201611168866.9A priority Critical patent/CN108205503B/en
Publication of CN108205503A publication Critical patent/CN108205503A/en
Application granted granted Critical
Publication of CN108205503B publication Critical patent/CN108205503B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a hardware drive compatible method and a terminal, wherein the method comprises the following steps: detecting target hardware by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a calling function of the first operating system; and further, calling a driver of the target hardware, and driving the target hardware by calling an Application Programming Interface (API) compatible with the second operating system in the first operating system by using the driver. Therefore, in the application, the entry function of the driver of the target hardware is the callable function of the first operating system and the API corresponding to the target hardware is arranged in the terminal, so that the terminal can directly call the driver of the target hardware to directly drive the target hardware.

Description

Hardware drive compatible method and terminal
Technical Field
The embodiment of the invention relates to a terminal technology, in particular to a hardware drive compatibility method and a terminal.
Background
In general, when a hardware is shipped, an original driver of the hardware is usually configured; due to the particularity of the Linux operating system (free use, free propagation, and arbitrary modification of source codes thereof), the original drivers configured when the hardware is shipped from the factory are Linux-compatible drivers.
When a terminal running a vxWorks operating system needs to add a certain hardware, if an original driver of the hardware is compatible with a Linux operating system but not compatible with the vxWorks operating system, the prior art generally modifies the original driver of the hardware (for example, a relevant part of the original driver for calling an API provided by the Linux operating system needs to be modified), and transplants the modified driver into the vxWorks operating system, so that the terminal can control the hardware through the modified driver. However, in the prior art, the workload of modifying the original driver is large, so that the migration of the driver takes a lot of time.
Disclosure of Invention
The embodiment of the invention provides a hardware drive compatibility method and a terminal, which reduce the migration time of a driver and improve the hardware drive compatibility efficiency.
In a first aspect, an embodiment of the present invention provides a hardware drive compatibility method, including:
detecting target hardware by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a calling function of the first operating system;
calling a driver of the target hardware;
driving the target hardware by calling an Application Programming Interface (API) in the first operating system by adopting the driver; wherein the API is an API compatible with the second operating system.
In one possible design, the first operating system is a vxWorks operating system, and the second operating system is a Linux operating system.
In one possible design, the method further includes:
updating the original driver compatible with the second operating system to obtain an updated driver, wherein an entry function of the updated driver is a function that can be called by the first operating system;
and storing the updated driver and the association relationship between the updated driver and the hardware.
In one possible design, the method further includes:
adding the API in the first operating system.
In one possible design, the adding the API in the first operating system includes:
if the first operating system comprises a first API, the second operating system comprises a second API, and the functions of the first API and the second API meet preset conditions, adjusting the first API in the first operating system according to the second API in the second operating system to obtain an API compatible with the second operating system; or,
if the second operating system comprises a third API and the first operating system does not comprise the third API, adding a fourth API in the first operating system according to the third API in the second operating system; wherein the functions of the fourth API include: all or part of the functions of the third API; or,
if the second operating system comprises a fifth API, the first operating system does not comprise the fifth API, and the function of the fifth API is not used for driving hardware, adding a sixth API in the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API.
According to the hardware drive compatibility method provided by the first aspect, target hardware is detected by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a function that can be called by the first operating system; further, calling a driver of the target hardware; furthermore, a driver is adopted to drive the target hardware through an API corresponding to the target hardware. Therefore, in the application, the entry function of the driver of the target hardware is the callable function of the first operating system and the API corresponding to the target hardware is arranged in the terminal, so that the terminal can directly call the driver of the target hardware and directly drive the target hardware through the API corresponding to the target hardware.
In a second aspect, an embodiment of the present invention provides a terminal, including:
the detection module is used for detecting target hardware by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a calling function of the first operating system;
the calling module is used for calling the driver of the target hardware;
the driving module is used for driving the target hardware by calling an Application Programming Interface (API) in the first operating system by adopting the driving program; wherein the API is an API compatible with the second operating system.
In one possible design, the first operating system is a vxWorks operating system, and the second operating system is a Linux operating system.
In one possible design, the terminal further includes:
the updating module is used for updating the original driver compatible with the second operating system to obtain an updated driver, wherein an entry function of the updated driver is a function that can be called by the first operating system;
and the storage module is used for storing the updated driving program and the association relation between the updated driving program and the hardware.
In one possible design, the terminal further includes:
and the adding module is used for adding the API in the first operating system.
In one possible design, the adding module is specifically configured to:
if the first operating system comprises a first API, the second operating system comprises a second API, and the functions of the first API and the second API meet preset conditions, adjusting the first API in the first operating system according to the second API in the second operating system to obtain an API compatible with the second operating system; or,
if the second operating system comprises a third API and the first operating system does not comprise the third API, adding a fourth API in the first operating system according to the third API in the second operating system; wherein the functions of the fourth API include: all or part of the functions of the third API; or,
if the second operating system comprises a fifth API, the first operating system does not comprise the fifth API, and the function of the fifth API is not used for driving hardware, adding a sixth API in the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API.
The beneficial effects of the terminal provided by the second aspect and the possible embodiments of the second aspect may refer to the beneficial effects brought by the possible embodiments of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic flowchart illustrating a first embodiment of a hardware driver compatibility method according to the present application;
FIG. 2 is a schematic diagram of an application scenario of the hardware driver compatibility method according to the present application;
FIG. 3 is a flowchart illustrating a second embodiment of a hardware driver compatibility method according to the present application;
fig. 4 is a schematic structural diagram of a first embodiment of the terminal of the present application;
fig. 5 is a schematic structural diagram of a second embodiment of the terminal of the present application;
fig. 6 is a schematic structural diagram of a third embodiment of the terminal of the present application;
fig. 7 is a schematic structural diagram of a fourth embodiment of the terminal of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flowchart of a first embodiment of the hardware-driven compatibility method, and fig. 2 is a schematic application scenario diagram of the hardware-driven compatibility method. As shown in fig. 2, the terminal is installed with a first operating system, an application programming interface API (API compatible with the second operating system) that the driver of the target hardware needs to call and a driver transplanted with the target hardware (driver compatible with the second operating system and entry function of the driver of the target hardware is a function that the first operating system can call). Alternatively, the first operating system may be a vxWorks operating system, or other operating system compatible with the vxWorks operating system, such as a channel operating system (Delta OS), a Reworks operating system (reworks), or the like. Alternatively, the second operating system may be a Linux operating system. As shown in fig. 1, the method of this embodiment may include:
and S101, detecting target hardware by adopting a first operating system.
In this step, the terminal runs the first operating system, and the terminal detects whether new target hardware is added to the terminal through the first operating system, and optionally, the terminal detects whether new target hardware is added to the terminal in the starting process of the first operating system. Optionally, a manner of detecting whether a new target hardware is added in the terminal in the process of starting the first operating system by the terminal may refer to a detection manner in the prior art, which is not limited in the embodiment of the present application. Optionally, the driver of the target hardware is a driver compatible with the second operating system, and the entry function of the driver of the target hardware is a function that can be called by the first operating system, so that the terminal directly calls the driver of the target hardware when the target hardware is detected. Alternatively, the target hardware includes, but is not limited to: audio equipment, display card equipment.
And S102, calling a driver of the target hardware.
In this step, when the terminal detects the target hardware, the terminal may directly call the driver of the target hardware because the entry function of the driver of the target hardware is the function that can be called by the first operating system.
S103, driving target hardware by calling an Application Programming Interface (API) in a first operating system by adopting a driver; wherein the API is compatible with the second operating system.
In this step, the terminal uses a driver of the target hardware, and drives the target hardware by calling an Application Programming Interface (API) compatible with the second operating system, which is set in the first operating system, so as to achieve the purpose of controlling the target hardware. Optionally, the API that the driver of the target hardware set in the first operating system needs to call is an API compatible with the second operating system (i.e., the API implements the same or similar function as the API provided in the second operating system and corresponding to the target hardware). The second operating system compatible APIs in the first operating system include one or more of: the system comprises a timer interface, a memory management interface, an atomic lock interface, a spin lock interface and a firmware interface; of course, the API may also include other interfaces, such as a reader/writer lock interface, a wait/work queue interface, a Peripheral Component Interconnect (PCI) bus interface, an Inter-Integrated Circuit (I2C) bus interface, and the like, which is not limited in this embodiment.
In the embodiment of the application, target hardware is detected by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a function which can be called by the first operating system; further, calling a driver of the target hardware; further, the target hardware is driven by calling the API compatible with the second operating system in the first operating system by adopting the driver. Therefore, in the application, the entry function of the driver of the target hardware is the callable function of the first operating system and the API compatible with the second operating system is arranged in the terminal, so that the terminal can directly call the driver of the target hardware to directly drive the target hardware, and compared with the prior art, the method does not need to modify a large number of original drivers of the hardware, reduces the transplanting time of the driver and improves the hardware driving compatibility efficiency; meanwhile, the problem of performance loss caused by excessive clipping of the original driving program in the transplanting process in the prior art can be avoided.
Fig. 3 is a flowchart illustrating a second embodiment of the hardware driver compatibility method according to the present application. On the basis of the above embodiment, as shown in fig. 3, the method further includes:
s301, updating the original driver compatible with the second operating system to obtain an updated driver, wherein the entry function of the updated driver is the call function of the first operating system.
In this step, optionally, an original driver of at least one hardware is obtained in advance, and optionally, the at least one hardware includes: a target hardware; wherein the original driver of each hardware is a driver compatible with the second operating system; further, in order that the terminal running the first operating system can control the hardware, at least one original driver (i.e. a driver compatible with the second operating system) of the hardware is updated, so that the entry function of each updated driver is a function that can be called by the first operating system.
S302, storing the updated driving program and the association relationship between the updated driving program and the hardware.
In order to facilitate that a subsequent terminal may directly call the driver of the target hardware when detecting the target hardware, optionally, in this step, each updated driver and an association relationship between each updated driver and the corresponding hardware are stored, for example, a correspondence relationship between the updated driver 1 and the hardware 1, a correspondence relationship between the updated driver 2 and the hardware 2, and the like.
For example: in step S101, the terminal detects a target hardware (e.g., hardware 1) by using a first operating system, and further determines a driver (e.g., updated driver 2) corresponding to the target hardware according to an association relationship between each stored updated driver and the corresponding hardware; in step S102, since the updated entry function of the driver 2 is a function that can be called by the first operating system, the terminal can directly call the driver of the target hardware.
In this embodiment, an original driver compatible with the second operating system is updated to obtain an updated driver, where an entry function of the updated driver is a function that can be called by the first operating system; further, the updated driver and the association relationship between the updated driver and the hardware are stored, so that when the subsequent terminal detects the target hardware, the driver corresponding to the target hardware is determined according to the association relationship between the updated driver and the hardware, and the driver of the target hardware can be directly called. Therefore, in the embodiment, the entry function of the original driver of the hardware is updated, so that the updated entry function of the driver is the function that can be called by the first operating system, the original driver of the hardware does not need to be modified greatly, and the migration time of the driver is reduced.
Optionally, on the basis of the foregoing embodiments, the method further includes:
an API is added to the first operating system.
In this embodiment, in order to reduce modifications to the original driver of the target hardware as much as possible, an API that the driver of the target hardware needs to call is added in the first operating system (optionally, the API that the driver needs to call is an API compatible with the second operating system, that is, the function of the API that the driver of the target hardware needs to call is the same as or similar to that provided in the second operating system), so that the driver of the target hardware that the second operation is compatible with (the entry function of the driver is a function that the first operating system can call), the API that the driver of the target hardware in the first operating system needs to call can be directly called, thereby achieving the purpose of controlling the target hardware. The fact that the API of the target hardware added in the first operating system and the API corresponding to the target hardware provided in the second operating system have the same or similar functions means that: assuming that the input of the API of the target hardware in the first operating system and the API of the target hardware in the second operating system are the same, the output of the API of the target hardware in the first operating system and the API of the target hardware in the second operating system are also the same.
Optionally, adding the API in the first operating system includes the following realizations:
the first realizable way: if the first operating system comprises the first API and the second operating system comprises the second API, and the functions of the first API and the second API meet the preset conditions, the first API in the first operating system is adjusted according to the second API in the second operating system, and the API compatible with the second operating system is obtained.
In this implementation manner, if the first operating system includes the first API and the second operating system includes the second API, and the functions of the first API and the second API meet a preset condition (for example, the functions are the same or similar), the function and the data structure of the first API in the first operating system are respectively adjusted according to the function and the data structure of the second API in the second operating system, so as to obtain the API compatible with the second operating system. For example, the source code is seen in the following structure:
Figure BDA0001183135240000081
the following description will be given by taking an example of an interface for implementing atomic operations as an example:
Figure BDA0001183135240000082
the second realizable way: if the second operating system comprises the third API and the first operating system does not comprise the third API, adding a fourth API in the first operating system according to the third API in the second operating system; wherein the functions of the fourth API include: all or part of the functionality of the third API.
In this implementation, if the second operating system includes the third API and the first operating system does not include the third API (or the first operating system does not include an API having the same function or a similar function to the third API), a fourth API is added to the first operating system according to the function and application scenario of the third API in the second operating system, where the function of the fourth API includes: all or part of the functionality of the third API (optionally, part of the functionality is core functionality of the third API). The core function of the third API refers to a function for driving hardware.
For example, if the functionality of the fourth API includes all of the functionality of the third API, the source code may look to the following structure:
Figure BDA0001183135240000083
an example of an interface for implementing memory allocation by page is described as follows:
Figure BDA0001183135240000084
Figure BDA0001183135240000091
for example, if the functionality of the fourth API includes the core functionality of the third API, the source code may look to the following structure:
Figure BDA0001183135240000092
the third way of realization: if the second operating system comprises a fifth API, the first operating system does not comprise the fifth API, and the function of the fifth API is not used for driving hardware, adding a sixth API in the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API.
In this implementation, if the fifth API is included in the second operating system, the fifth API is not included in the first operating system (or the API having the same function or a similar function to the fifth API is not included in the first operating system), and the function of the fifth API is not used to drive hardware (that is, the function of the fifth API is not a core function), a sixth API is added to the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API (i.e., retains the function interface, but does not retain the function of the fifth API). For example, the source code is seen in the following structure:
Figure BDA0001183135240000093
Figure BDA0001183135240000101
of course, "add API in the first operating system" may also be implemented in other ways, which is not limited in this embodiment of the present application.
Optionally, in the above embodiments of the present application, the first operating system is a vxWorks operating system, and the second operating system is a Linux operating system; of course, the second operating system may also be another operating system compatible with the original driver configured in the factory of the hardware, and the first operating system may also be another operating system incompatible with the original driver of the hardware, which is not limited in this embodiment of the application.
Fig. 4 is a schematic structural diagram of a first embodiment of the terminal of the present application. As shown in fig. 4, the terminal 40 provided in the present embodiment includes:
a detection module 401, configured to detect target hardware by using a first operating system, where a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a function that can be called by the first operating system;
a calling module 402, configured to call a driver of the target hardware;
a driver module 403, configured to drive the target hardware by calling an application programming interface API in the first operating system by using the driver; wherein the API is an API compatible with the second operating system.
Optionally, the first operating system is a vxWorks operating system, and the second operating system is a Linux operating system.
On the basis of the embodiment shown in fig. 4, fig. 5 is a schematic structural diagram of a second embodiment of the terminal of the present application. Referring to fig. 5, the terminal further includes:
an updating module 404, configured to update an original driver compatible with the second operating system, and obtain an updated driver, where an entry function of the updated driver is a function that can be called by the first operating system;
a storage module 405, configured to store the updated driver and an association relationship between the updated driver and hardware.
On the basis of the embodiment shown in fig. 4, fig. 6 is a schematic structural diagram of a third embodiment of the terminal of the present application. Referring to fig. 6, the terminal further includes:
an adding module 406, configured to add the API in the first operating system.
Optionally, the adding module 406 is specifically configured to:
if the first operating system comprises a first API, the second operating system comprises a second API, and the functions of the first API and the second API meet preset conditions, adjusting the first API in the first operating system according to the second API in the second operating system to obtain an API compatible with the second operating system; or,
if the second operating system comprises a third API and the first operating system does not comprise the third API, adding a fourth API in the first operating system according to the third API in the second operating system; wherein the functions of the fourth API include: all or part of the functions of the third API; or,
if the second operating system comprises a fifth API, the first operating system does not comprise the fifth API, and the function of the fifth API is not used for driving hardware, adding a sixth API in the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API.
The terminal provided in any of the above embodiments may be configured to execute the technical solution in any of the above embodiments of the hardware-driven compatible method of the present invention, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 7 is a schematic structural diagram of a fourth embodiment of the terminal of the present application. As shown in fig. 7, the terminal 70 provided in the present embodiment may include a processor 701 and a memory 702. Wherein, the memory 702 is used for storing execution instructions, and the processor 701 is used for executing the execution instructions in the memory 702 to make the terminal execute the following operations:
detecting target hardware by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a calling function of the first operating system;
calling a driver of the target hardware;
driving the target hardware by calling an Application Programming Interface (API) in the first operating system by adopting the driver; wherein the API is an API compatible with the second operating system.
Optionally, the first operating system is a vxWorks operating system, and the second operating system is a Linux operating system.
Optionally, the terminal is further configured to perform the following operations:
updating the original driver compatible with the second operating system to obtain an updated driver, wherein an entry function of the updated driver is a function that can be called by the first operating system;
and storing the updated driver and the association relationship between the updated driver and the hardware.
Optionally, the terminal is further configured to perform the following operations:
adding the API in the first operating system.
Optionally, the adding the API in the first operating system includes:
if the first operating system comprises a first API, the second operating system comprises a second API, and the functions of the first API and the second API meet preset conditions, adjusting the first API in the first operating system according to the second API in the second operating system to obtain an API compatible with the second operating system; or,
if the second operating system comprises a third API and the first operating system does not comprise the third API, adding a fourth API in the first operating system according to the third API in the second operating system; wherein the functions of the fourth API include: all or part of the functions of the third API; or,
if the second operating system comprises a fifth API, the first operating system does not comprise the fifth API, and the function of the fifth API is not used for driving hardware, adding a sixth API in the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API.
The terminal of this embodiment may be configured to implement the technical solution of any embodiment of the hardware-driven compatible method of the present invention, and the implementation principle and the technical effect are similar, which are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (8)

1. A hardware driver compatibility method, comprising:
detecting target hardware by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a calling function of the first operating system;
calling a driver of the target hardware;
driving the target hardware by calling an Application Programming Interface (API) in the first operating system by adopting the driver; wherein the API is compatible with the second operating system;
the method further comprises the following steps: updating the original driver compatible with the second operating system to obtain an updated driver, wherein an entry function of the updated driver is a function that can be called by the first operating system;
and storing the updated driver and the association relationship between the updated driver and the hardware.
2. The method of claim 1, wherein the first operating system is a vxWorks operating system and the second operating system is a Linux operating system.
3. The method of claim 1, further comprising:
adding the API in the first operating system.
4. The method of claim 3, wherein adding the API in the first operating system comprises:
if the first operating system comprises a first API, the second operating system comprises a second API, and the functions of the first API and the second API meet preset conditions, adjusting the first API in the first operating system according to the second API in the second operating system to obtain an API compatible with the second operating system; or,
if the second operating system comprises a third API and the first operating system does not comprise the third API, adding a fourth API in the first operating system according to the third API in the second operating system; wherein the functions of the fourth API include: all or part of the functions of the third API; or,
if the second operating system comprises a fifth API, the first operating system does not comprise the fifth API, and the function of the fifth API is not used for driving hardware, adding a sixth API in the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API.
5. A terminal, comprising:
the detection module is used for detecting target hardware by adopting a first operating system, wherein a driver of the target hardware is a driver compatible with a second operating system, and an entry function of the driver of the target hardware is a calling function of the first operating system;
the calling module is used for calling the driver of the target hardware;
the driving module is used for driving the target hardware by calling an Application Programming Interface (API) in the first operating system by adopting the driving program; wherein the API is compatible with the second operating system;
the terminal further comprises:
the updating module is used for updating the original driver compatible with the second operating system to obtain an updated driver, wherein an entry function of the updated driver is a function that can be called by the first operating system;
and the storage module is used for storing the updated driving program and the association relation between the updated driving program and the hardware.
6. The terminal of claim 5, wherein the first operating system is a vxWorks operating system and the second operating system is a Linux operating system.
7. The terminal of claim 5, further comprising:
and the adding module is used for adding the API in the first operating system.
8. The terminal according to claim 7, wherein the adding module is specifically configured to:
if the first operating system comprises a first API, the second operating system comprises a second API, and the functions of the first API and the second API meet preset conditions, adjusting the first API in the first operating system according to the second API in the second operating system to obtain an API compatible with the second operating system; or,
if the second operating system comprises a third API and the first operating system does not comprise the third API, adding a fourth API in the first operating system according to the third API in the second operating system; wherein the functions of the fourth API include: all or part of the functions of the third API; or,
if the second operating system comprises a fifth API, the first operating system does not comprise the fifth API, and the function of the fifth API is not used for driving hardware, adding a sixth API in the first operating system according to the fifth API in the second operating system; wherein the sixth API does not have the function of the fifth API.
CN201611168866.9A 2016-12-16 2016-12-16 Hardware drive compatible method and terminal Active CN108205503B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611168866.9A CN108205503B (en) 2016-12-16 2016-12-16 Hardware drive compatible method and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611168866.9A CN108205503B (en) 2016-12-16 2016-12-16 Hardware drive compatible method and terminal

Publications (2)

Publication Number Publication Date
CN108205503A CN108205503A (en) 2018-06-26
CN108205503B true CN108205503B (en) 2020-11-06

Family

ID=62602060

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611168866.9A Active CN108205503B (en) 2016-12-16 2016-12-16 Hardware drive compatible method and terminal

Country Status (1)

Country Link
CN (1) CN108205503B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101285A (en) * 2018-07-19 2018-12-28 郑州云海信息技术有限公司 One kind driving convenient download system and method based on server of cloud platform
CN110716874B (en) * 2019-09-25 2023-08-22 北京计算机技术及应用研究所 Domestic operating system hardware compatibility testing method
CN114780154B (en) * 2022-04-19 2024-01-30 北京航天发射技术研究所 Method compatible with hardware states of master control boards of different manufacturers

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1731347A (en) * 2004-08-06 2006-02-08 梁肇新 Linux-based Windows software compatible layer architecture
CN101005420A (en) * 2006-12-18 2007-07-25 广州市高科通信技术股份有限公司 Embedded system cross platform realizing method for complex access device
CN102520990A (en) * 2011-12-01 2012-06-27 太仓市同维电子有限公司 Cross-platform compatible general application device supporting embedded system and loading method thereof
CN102819443A (en) * 2012-08-07 2012-12-12 北京经纬恒润科技有限公司 Method and device for compatible operation of PCI (peripheral component interconnection) hardware applications
CN103268238A (en) * 2013-05-15 2013-08-28 山东超越数控电子有限公司 Method for achieving drive of universal serial bus (USB) camera on basis of ReWorks operation system
CN103678099A (en) * 2012-09-10 2014-03-26 国网电力科学研究院 Method and device for achieving communications of hardware platform and software platform

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1808763A1 (en) * 2005-12-13 2007-07-18 Neoware, Inc. A procedure for booting a first computer using the operating system of a second computer
CN102012887B (en) * 2010-11-30 2013-02-13 广东星海数字家庭产业技术研究院有限公司 Multi-hardware compatible card swiping driving system
CN102902638B (en) * 2011-07-26 2015-04-22 北大方正集团有限公司 Hardware equipment control method and device
CN105159696A (en) * 2015-07-09 2015-12-16 北京君正集成电路股份有限公司 Method and apparatus for realizing hardware drive independent of Linux kernel

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1731347A (en) * 2004-08-06 2006-02-08 梁肇新 Linux-based Windows software compatible layer architecture
CN101005420A (en) * 2006-12-18 2007-07-25 广州市高科通信技术股份有限公司 Embedded system cross platform realizing method for complex access device
CN102520990A (en) * 2011-12-01 2012-06-27 太仓市同维电子有限公司 Cross-platform compatible general application device supporting embedded system and loading method thereof
CN102819443A (en) * 2012-08-07 2012-12-12 北京经纬恒润科技有限公司 Method and device for compatible operation of PCI (peripheral component interconnection) hardware applications
CN103678099A (en) * 2012-09-10 2014-03-26 国网电力科学研究院 Method and device for achieving communications of hardware platform and software platform
CN103268238A (en) * 2013-05-15 2013-08-28 山东超越数控电子有限公司 Method for achieving drive of universal serial bus (USB) camera on basis of ReWorks operation system

Also Published As

Publication number Publication date
CN108205503A (en) 2018-06-26

Similar Documents

Publication Publication Date Title
US9081709B2 (en) Virtualizable and forward-compatible hardware-software interface
CN114020482A (en) Method and apparatus for data writing
US9600369B2 (en) Operating system recovery method and apparatus, and terminal device
CN108205503B (en) Hardware drive compatible method and terminal
CN103890728A (en) Method for hot transfer of virtual machine and server
EP2905700B1 (en) Operating system recovery method, apparatus and terminal device
CN110083399B (en) Applet running method, computer device and storage medium
CN107368353B (en) Method and device for realizing hot addition of virtual machine memory
CN113990354B (en) Audio control method, device, equipment and storage medium based on Linux
US10564889B2 (en) Method and apparatus for processing data based on physical host
CN104104705B (en) The cut-in method and equipment of distributed memory system
CN103677870A (en) System upgrading method and system upgraded by means of method
US20190317906A1 (en) Techniques for dynamically adjusting the manner in which i/o requests are transmitted between a computing device and a storage device
CN107908957B (en) Safe operation management method and system of intelligent terminal
CN114691300A (en) Hot migration method of virtual machine instance
CN112912743A (en) Computing power control method, device, equipment and storage medium
EP3193253A1 (en) Method, apparatus and system for displaying names of virtual machine
US9569241B2 (en) Sharing devices assigned to virtual machines using runtime exclusion
CN110908644B (en) Configuration method and device of state node, computer equipment and storage medium
CN110430318B (en) Mobile terminal WIFI calling control method, mobile terminal and storage medium
US10725791B2 (en) Operating system boot up optimizations
CN111143265B (en) Data transmission method and device based on virtual machine
US20160085709A1 (en) Data Card, and Data Card Switching Method and Apparatus
US11741233B2 (en) Overriding sub-system identifiers with protected variable values
CN112269649A (en) Method, device and system for realizing asynchronous execution of host task

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing

Patentee after: Loongson Zhongke Technology Co.,Ltd.

Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing

Patentee before: LOONGSON TECHNOLOGY Corp.,Ltd.

CP01 Change in the name or title of a patent holder