Module initialization method, hardware driving system and related equipment

Through the use of hardware module timing list and module identification, the problem of changing the initialization sequence of hardware modules requires a large amount of code to be changed, which improves the portability of electronic devices and reduces CPU performance consumption.

CN119003012APending Publication Date: 2024-11-22VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411101199.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In electronic devices, the initialization order of hardware modules requires a large amount of code to be changed, resulting in low system portability and high CPU performance consumption.

Method used

Through the hardware module timing list, use module identifiers to indicate the initialization sequence, decouple the initialization interface, and adjust the order only in the timing list to adapt to changes and avoid code modifications.

Benefits of technology

Improves the system portability of electronic devices and reduces CPU performance consumption, avoiding stability and power consumption abnormalities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003012A_ABST
    Figure CN119003012A_ABST
Patent Text Reader

Abstract

The invention discloses a module initialization method, a hardware driving system and related equipment, and belongs to the technical field of terminals. The module initialization method provided by the embodiment of the invention can comprise the steps that the electronic equipment can obtain a hardware module time sequence list, the hardware module time sequence list comprises at least one first module identifier, and each first module identifier is used for indicating a first hardware module of a hardware module of the electronic equipment; the arrangement sequence of the at least one first module identifier in the hardware module time sequence list is associated with the initialization sequence of at least one first hardware module; therefore, the electronic equipment can call each first interface corresponding to each first module identifier according to the arrangement sequence of the at least one first module identifier, and each first interface is used for initializing one first hardware module corresponding to each first interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of terminal technology, and specifically relates to a module initialization method, a hardware drive system and related equipment. Background Art

[0002] Typically, multiple modules are provided in an electronic device, such as a camera module, an audio module, a display module, etc. Taking a camera module as an example, the camera module includes multiple hardware modules, and a calling sequence for calling the initialization interface corresponding to each hardware module is pre-edited in the executable program of the Linux system. The calling sequence is the same as the default initialization sequence of the multiple hardware modules. In this way, when the Linux system processes image data, it can call the initialization interface in the hardware driver of each hardware module in sequence through the executable program in accordance with the calling sequence, so that the multiple hardware modules can be initialized according to the default initialization sequence.

[0003] However, since the multiple initialization interfaces are interdependent during the initialization of the multiple hardware modules, when the electronic device upgrades the system, if the hardware modules included in the camera module change, a large amount of code in the executable program may need to be modified to adjust the pre-compiled call sequence in the executable program, so that the executable program can call the initialization interface in the hardware driver of each hardware module in turn according to the adjusted call sequence, so that the multiple hardware modules can be initialized according to the new default initialization sequence. Therefore, the portability of the electronic device system is low. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a module initialization method, a hardware driver system and related devices, which can improve the portability of the system of the electronic device.

[0005] In a first aspect, an embodiment of the present application provides a module initialization method, the method comprising: an electronic device can obtain a hardware module timing list, the hardware module timing list includes at least one first module identifier, each first module identifier is used to indicate a first hardware module of a hardware module of the electronic device, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of at least one first hardware module; thereby, the electronic device can call each first interface corresponding to each first module identifier respectively according to the arrangement order of the at least one first module identifier, and each first interface is used to initialize a first hardware module corresponding to each first interface.

[0006] In the second aspect, an embodiment of the present application provides a hardware driver system, which includes: a hardware module and a core layer, wherein the hardware module includes at least one first hardware module, and the core layer includes a hardware module timing list, wherein the hardware module timing list includes at least one first module identifier, each first module identifier is used to indicate a first hardware module, and the arrangement order of at least one first module identifier in the hardware module timing list is associated with the initialization order of at least one first hardware module. The core layer is used to obtain the hardware module timing list, and according to the arrangement order of at least one first module identifier, each first interface corresponding to each first module identifier is called respectively, and each first interface is used to initialize a first hardware module corresponding to each first interface.

[0007] In a third aspect, an embodiment of the present application provides a module initialization device, which includes: an acquisition module and a processing module. Among them, the acquisition module is used to obtain a hardware module timing list, and the hardware module timing list includes at least one first module identifier, each first module identifier is used to indicate a first hardware module of the hardware module of the module initialization device, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of at least one first hardware module. The processing module is used to call each first interface corresponding to each first module identifier according to the arrangement order of at least one first module identifier in the hardware module timing list obtained by the acquisition module, and each first interface is used to initialize a first hardware module corresponding to each first interface.

[0008] In a fourth aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0009] In a fifth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0010] In a sixth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the steps of the method described in the first aspect.

[0011] In a seventh aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the method described in the first aspect.

[0012] In an embodiment of the present application, the electronic device may first obtain a hardware module timing list, which includes at least one first module identifier, each first module identifier is used to indicate a first hardware module of the hardware module of the electronic device, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of the at least one first hardware module. Then the electronic device may call each first interface corresponding to each first module identifier respectively according to the arrangement order of the at least one first module identifier, and each first interface is used to initialize a first hardware module corresponding to each first interface. Since at least one first module identifier is included in the hardware module timing list, and the arrangement order of the at least one first module identifier is associated with the initialization order of the at least one first hardware module, the initialization order of the at least one first hardware module can be determined according to the arrangement order of the at least one first module identifier, without having to determine the initialization order of the at least one first hardware module through the calling order of the initialization interface (i.e., the first interface) corresponding to each first hardware module pre-edited in the executable program. In this way, the first interfaces corresponding to the various first hardware modules can be decoupled. Therefore, in the case of upgrading the electronic device system, if the first hardware module included in the hardware module changes, it is only necessary to adjust the arrangement order of the first module identifier in the hardware module timing list, so that the at least one first hardware module can be initialized according to the new initialization order without modifying the code in the executable program. Therefore, the portability of the electronic device system can be improved.

[0013] Furthermore, on the one hand, since the arrangement order of at least one module identifier in the hardware module timing list can be directly adjusted when the initialization order of at least one hardware module changes, without modifying any code, it is possible to avoid introducing new problems due to a large number of changes to the executable program initcall section and the code of the initialization interface or resetting the initialization priority of at least part of module_init, thereby avoiding various stability and power consumption anomalies. On the other hand, since the initialization order of at least one hardware module can be determined based on the arrangement order of the at least one module identifier, there is no need to run an additional process to detect each hardware module, so the performance consumption of the CPU can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is one of the timing diagrams for initializing multiple hardware modules of a camera module in the related art;

[0015] Figure 2 This is the second timing diagram of initializing multiple hardware modules of a camera module in the related art;

[0016] Figure 3A This is the third timing diagram of initializing multiple hardware modules of a camera module in the related art;

[0017] Figure 3B This is the fourth timing diagram of initializing multiple hardware modules of a camera module in the related art;

[0018] Figure 4 This is the fifth timing diagram of initializing multiple hardware modules of a camera module in the related art;

[0019] Figure 5 This is one of the flowcharts of the module initialization method provided in the embodiment of the present application;

[0020] Figure 6 This is the second flowchart of the module initialization method provided in the embodiment of the present application;

[0021] Figure 7 This is one of the system framework diagrams of the electronic device provided in the embodiment of the present application;

[0022] Figure 8 It is a schematic diagram of the timing of driver installation of a module of the module initialization method provided in an embodiment of the present application;

[0023] Fig. 9 This is the third flowchart of the module initialization method provided in the embodiment of the present application;

[0024] Fig.10 This is the fourth flowchart of the module initialization method provided in the embodiment of the present application;

[0025] Fig.11 This is the second schematic diagram of the system framework of the electronic device provided in the embodiment of the present application;

[0026] Fig.12 It is a schematic diagram of the timing of driver installation of a hardware module of the module initialization method provided in an embodiment of the present application;

[0027] Fig.13 is a schematic diagram of the system framework of the hardware drive system provided in an embodiment of the present application;

[0028] Fig.14 It is a structural schematic diagram of a module initialization device provided in an embodiment of the present application;

[0029] Fig.15 This is one of the hardware structure diagrams of the electronic device provided in the embodiment of the present application;

[0030] Fig.16 This is the second schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0032] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0033] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".

[0034] The module initialization method, hardware drive system and related equipment provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0035] The module initialization method provided in the embodiment of the present application can be applied to the scenario of initializing the hardware module of the hardware module of the electronic device.

[0036] At present, multiple hardware modules are provided in electronic devices, such as camera modules, audio modules, display modules, etc. Taking the camera module as an example, the camera module includes multiple hardware modules, such as Figure 1As shown, for example, a sensor (Sensor), an optical sensor (CMOS Image Sensor, CIS), a sensor front engine (Sensor Front Engine, SFE), an image front end processing (Image Front End, IFE), and an image back-end processing module (Image Processing Back-End, IPE), and a calling order for calling the initialization interface corresponding to each hardware module is pre-edited in the executable program of the Linux system, and the calling order is the same as the default initialization order of the multiple hardware modules, and the default initialization order is the order in which the multiple hardware modules process the image data (for example, the order of Sensor, CIS, SFE, IFE and IPE). In this way, when the Linux system processes the image data, the Linux kernel of the electronic device can call each initialization interface in the hardware driver of each hardware module in sequence through the executable program according to the calling order, for example, through each common entry function module_init of the executable program initcallsection, each initialization interface corresponding to the driver of each hardware module is called respectively, that is, first calling the initialization interface 1 corresponding to the Sensor through module_init 1, then calling the initialization interface 2 corresponding to the CIS through module_init2, and then calling the initialization interface 3 corresponding to the CIS through module_init 3 calls the initialization interface 3 corresponding to SFE, then calls the initialization interface 4 corresponding to IFE through module_init4, and then calls the initialization interface 5 corresponding to IPE through module_init 5, so that Sensor, CIS, SFE, IFE and IPE can be initialized according to the default initialization order.

[0037] Specifically, the related technologies mainly include the following three processing methods:

[0038] Method 1: Use hard code, such as Figure 2As shown, the drivers of all hardware modules are encapsulated into one driver, which includes all drivers of multiple hardware modules of the camera module, so that the Linux kernel can directly call the initialization interface corresponding to the driver through the module_init of the executable program initcall section, so as to initialize each hardware module in sequence in the order of Sensor, CIS, SFE, IFE and IPE. However, this will lead to a high degree of coupling of each initialization interface. In this way, when the camera module is upgraded and the hardware modules included in the camera module change (such as adding a hardware module or deleting a hardware module), it may be necessary to make a lot of changes to the executable program initcall section and the code of the initialization interface, which may introduce new problems and various stability and power consumption anomalies, thereby causing a lot of manpower consumption and uncertainty.

[0039] Method 2: Set the initialization priority for each module_init, such as Figure 3A As shown, the initialization priority of the module_init 1 can be set to 1, the initialization priority of the module_init 2 can be set to 2, the initialization priority of the module_init 3 can be set to 3, the initialization priority of the module_init4 can be set to 4, and the initialization priority of the module_init 5 can be set to 5. In this way, the Linux kernel can first call module_init 1, then call module_init 2, then call module_init 3, then call module_init4, and finally call module_init 5 according to the initialization priorities of module_init 1 to module_init 5, so as to initialize each hardware module in the order of Sensor, CIS, SFE, IFE and IPE. However, in this way, when the camera module is upgraded and the hardware modules included in the camera module are changed (for example, a new hardware module is added or a hardware module is deleted), it is necessary to reset the initialization priority of at least part of the module_init, such as Figure 3BAs shown, for example, after the camera module is upgraded, a RawNR module is added. The electronic device can call the initialization interface 6 corresponding to the RawNR module by calling module_init 6. At this time, the priority of module_init 6 needs to be set to 4, and the initialization priority of module_init4 and module_init 5 needs to be reset. This may require a lot of changes to the executable program initcallsection and the code of the initialization interface, resulting in various problems in method 1.

[0040] Method 3: Use additional processes for detection, such as Figure 4 As shown, four additional processes can be run, such as process 1 to process 4, so that before initializing CIS, process 1 can be used to check whether the initialization of Sensor is completed, and when it is determined that the initialization of Sensor is completed, the Linux kernel can call the initialization interface 2 corresponding to CIS through module_init 2 to initialize CIS. In addition, before initializing SFE, process 2 can be used to check whether the initialization of CIS is completed, and when it is determined that the initialization of CIS is completed, the Linux kernel can call the initialization interface 3 corresponding to SFE through module_init 3 to initialize SFE. In addition, before initializing IFE, process 3 can be used to check whether the initialization of SFE is completed, and when it is determined that the initialization of SFE is completed, the Linux kernel can call the initialization interface 4 corresponding to IFE through module_init4 to initialize IFE. In addition, before initializing IPE, process 4 can be used to check whether the initialization of IFE is completed, and when it is determined that the initialization of IFE is completed, the Linux kernel can call the initialization interface 5 corresponding to IPE through module_init 5 to initialize IPE. However, since the Linux kernel needs to detect each hardware module through an additional thread, when the number of the above-mentioned multiple hardware modules is large, it may cause a large performance consumption of the central processing unit (CPU). In addition, when the camera module is upgraded and the hardware modules included in the camera module are changed (for example, a new hardware module is added or a hardware module is deleted), the code segment corresponding to each process needs to be modified, resulting in various problems in method 1.

[0041] In summary, in the related art, since the multiple module_init (i.e., module_init 1 to module_init 5) corresponding to the above-mentioned multiple hardware modules (i.e., Sensor, CIS, SFE, IFE, and IPE) are initialized in the process, the multiple initialization interfaces are interdependent, so in the case of upgrading the electronic device system, if the hardware modules included in the camera module change, it may be necessary to modify a large amount of code in the executable program to adjust the pre-compiled calling sequence in the executable program, so that the executable program can call the initialization interface in the hardware driver of each hardware module in turn according to the adjusted calling sequence, so that the multiple hardware modules can be initialized according to the new default initialization sequence. Therefore, the portability of the electronic device system is low.

[0042] However, in an embodiment of the present application, a hardware module timing list is pre-created in the electronic device, and the hardware module timing list includes at least one module identifier, each module identifier is used to indicate a hardware module of a hardware module of the electronic device, and the arrangement order of the at least one module identifier in the hardware module timing list is associated with the initialization order of the at least one hardware module. In this way, the electronic device can first obtain the hardware module timing list, and then call each initialization interface corresponding to each module identifier according to the arrangement order of the at least one module identifier, and each initialization interface is used to initialize a hardware module corresponding to each first interface. It can be understood that since at least one module identifier is included in the hardware module timing list, and the arrangement order of the at least one module identifier is associated with the initialization order of the at least one hardware module, the initialization order of the at least one hardware module can be determined based on the arrangement order of the at least one module identifier, without the need to determine the initialization order of the at least one hardware module through the calling order of the initialization interface corresponding to each hardware module pre-edited in the executable program. In this way, the initialization interfaces corresponding to the various hardware modules can be decoupled. Therefore, in the case of an electronic device upgrading system, if the hardware modules included in the hardware module change, it is only necessary to adjust the arrangement order of the module identifiers in the hardware module timing list, so that the at least one hardware module can be initialized according to the new initialization order without modifying the code in the executable program. Therefore, the portability of the electronic device system can be improved.

[0043] Moreover, compared with the above-mentioned methods 1 to 3, on the one hand, since the arrangement order of at least one module identifier in the hardware module timing list can be directly adjusted when the initialization order of at least one hardware module changes, without modifying any code, it is possible to avoid introducing new problems due to a large number of changes to the executable program initcallsection and the code of the initialization interface or resetting the initialization priority of at least part of module_init, thereby avoiding various stability and power consumption anomalies. On the other hand, since the initialization order of at least one hardware module can be determined based on the arrangement order of the at least one module identifier, there is no need to run an additional process to detect each hardware module, so the performance consumption of the CPU can be reduced.

[0044] It should be noted that the camera module is used as an example to illustrate the problems existing in the related art. It should be understood that the above problems also exist in other modules (such as audio modules, display modules, etc.), and the embodiments of this application will not be described in detail here.

[0045] In the embodiment of the present application, the execution subject of the above module initialization method can be a hardware module initialization device, or an electronic device, or a functional module in an electronic device, or a kernel in an electronic device. The following takes an electronic device as an example to illustrate the module initialization method provided in the embodiment of the present application.

[0046] Figure 5 A flowchart of a module initialization method provided in an embodiment of the present application is shown. Figure 5 As shown, the module initialization method provided in the embodiment of the present application may include the following steps 101 and 102.

[0047] Step 101: The electronic device obtains a hardware module timing list.

[0048] In an embodiment of the present application, the above-mentioned hardware module timing list includes at least one first module identifier, each first module identifier is used to indicate a first hardware module of a hardware module of an electronic device, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of at least one first hardware module.

[0049] In some embodiments of the present application, the above hardware module timing list can be called SubModule_slotlist. Of course, the hardware module timing list can also be called other lists, which is not limited in the embodiments of the present application.

[0050] In some embodiments of the present application, the hardware module may be any one of the following: a camera module, an audio module, a display module. Of course, the hardware module may also be other modules in the electronic device, which is not limited in the embodiments of the present application.

[0051] In some embodiments of the present application, when the hardware module is a camera module, the at least one first hardware module may include at least one of the following: Senor, CIS, IPE, IFE, SFE. Of course, the at least one first hardware module may also include other hardware modules, which are not limited in the embodiments of the present application.

[0052] In some embodiments of the present application, the at least one first module identifier may include at least one of the following: an ID of the first hardware module, a name of the first hardware module, a media access control (MAC) address of the first hardware module, etc.

[0053] In the embodiment of the present application, the above initialization sequence may satisfy any of the following: being pre-configured, being pre-set, being agreed upon by a protocol, being obtained from other electronic devices, or being obtained from a server.

[0054] In a possible implementation, when the initialization sequence is obtained from other electronic devices, the electronic device may obtain the initialization sequence each time the electronic device is powered on (or when the hardware module of the module of the electronic device needs to be initialized).

[0055] In another possible implementation, when the initialization sequence is obtained from a server, the electronic device may obtain the initialization sequence each time the electronic device is powered on (or when the hardware module of a module of the electronic device needs to be initialized).

[0056] In some embodiments of the present application, the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of the at least one first hardware module, which can be understood as: the arrangement order of the at least one first module identifier in the hardware module timing list is the same as the initialization order of the at least one first hardware module, or the arrangement order of the at least one first module identifier in the hardware module timing list is opposite to the initialization order of the at least one first hardware module.

[0057] In some embodiments of the present application, a kernel of the electronic device may call a specified interface, so that the kernel may obtain a hardware module timing list through the specified interface.

[0058] The following is an example of a specific scheme for an electronic device to obtain a hardware module timing list.

[0059] In some embodiments of the present application, Figure 5 ,like Figure 6 As shown, before the above step 101, the module initialization method provided in the embodiment of the present application may further include the following step 201, and the above step 101 may be specifically implemented by the following step 101a.

[0060] Step 201: The electronic device determines a module identifier that matches a first module identifier from at least one module identifier in a module list.

[0061] In an embodiment of the present application, each module identifier of the above-mentioned at least one module identifier is used to indicate a module of the electronic device, each module identifier corresponds to a third interface, each third interface is used to initialize each hardware module of the module corresponding to each third interface, and the above-mentioned first module identifier is used to indicate a hardware module.

[0062] In some embodiments of the present application, the module list may be referred to as HostDev List. Of course, the module list may also be referred to as other names, which are not limited in the embodiments of the present application.

[0063] In some embodiments of the present application, the at least one module identifier may include at least one of the following: a module name, a module ID, etc. Of course, the at least one module identifier may also include other identifiers, which are not limited in the embodiments of the present application.

[0064] In some embodiments of the present application, the third interface is used to run the driver of the module corresponding thereto, so that the driver can drive the module to initialize each hardware module contained therein. The driver of the module can be called the host driver. Of course, the driver of the module can also be called other names, which are not limited in the embodiments of the present application.

[0065] In some embodiments of the present application, when any module of an electronic device is registered to the operating system of the electronic device, the electronic device can install the driver of any module in the device driver layer of the kernel, and add the module identifier corresponding to the module and the third interface corresponding to the module in the module list in the core layer of the kernel, so that when all modules of the electronic device are registered to the operating system of the electronic device, at least one driver is included in the device driver layer, and at least one module identifier and at least one third interface can be included in the module list in the core layer of the kernel.

[0066] Among them, the above operating system can be a Linux system or other systems, and the embodiments of the present application are not limited here.

[0067] The electronic device may add the module identifier corresponding to the one module and the third interface corresponding to the one module to the module list through an interface of the core layer of the kernel of the electronic device.

[0068] For example, Figure 7 and Figure 8 As shown, the kernel of the electronic device includes a device driver layer and a core layer, so that when a module of the electronic device (such as a camera module) is registered to the operating system of the electronic device, the electronic device can install the driver of the camera module (such as CameraHost Dev Driver) in the device driver layer of the kernel, and add the name of the CameraHostDevDriver and the third interface init_inf corresponding to the CameraHostDev Driver to the module list in the core layer (such as HostDev List) through the host_inf interface of the core layer. And, when another module of the electronic device (such as a display module) is registered to the operating system of the electronic device, the electronic device can install the driver of the camera module (such as Display Host Dev Driver) in the device driver layer of the kernel, and add the name of the Display Host DevDriver and the third interface init_inf corresponding to the DisplayHostDev Driver to the module list in the core layer (such as HostDev List) through the host_inf interface of the core layer. Furthermore, when another module of the electronic device (such as a display module) is registered to the operating system of the electronic device, the electronic device can install the driver of the camera module (such as an Audio HostDev Driver) in the device driver layer of the kernel, and add the name of the Audio Host Dev Driver and the third interface init_inf corresponding to the Audio HostDev Driver to the module list in the core layer (such as Host Dev List) through the host_inf interface of the core layer.

[0069] In some examples, after the electronic device adds the module identifier corresponding to the above-mentioned one module and the third interface corresponding to the one module in the above-mentioned module list, it can also add the module identifiers and first information corresponding to all hardware modules in the one module in the module list, and the first information is used to indicate whether the one module has been initialized, so that in subsequent steps, the kernel can accurately determine all the hardware modules in the one module according to the module identifiers corresponding to all the hardware modules in the one module, and accurately determine whether the one module has been initialized according to the first information.

[0070] The kernel may add a first code segment to the module list to add the module identifier corresponding to the module, the third interface, the module identifiers corresponding to all hardware modules in the module, and whether the module has been initialized. The first code segment is as follows:

[0071] Host dev

[0072] init_inf; / / Initialize the interface

[0073] Sub_module; / / All hardware modules in the current host

[0074] has_inited; / / Whether the current host has been initialized

[0075] }

[0076] It can be understood that in this example, the module list includes a module identifier corresponding to at least one module of the electronic device, a third interface corresponding to at least one module, a module identifier corresponding to hardware included in at least one module, and first information corresponding to at least one module.

[0077] In some embodiments of the present application, when the electronic device is in working state, each time it is powered on (or the hardware module of the module of the electronic device needs to be initialized), the kernel of the electronic device can obtain a module list and a first module identifier corresponding to the hardware module to be initialized from the kernel, and determine a module identifier that matches the first module identifier from at least one module identifier in the module list.

[0078] In some embodiments of the present application, the core of the electronic device may determine a module identifier that is the same as the first module identifier from at least one module identifier.

[0079] Step 101a: The electronic device calls a third interface corresponding to a module identifier that matches the first module identifier to obtain a hardware module timing list.

[0080] In some embodiments of the present application, the electronic device may first determine a third interface corresponding to a module identifier that matches the first module identifier, and then call the third interface.

[0081] It can be seen that since a module list is also stored in the electronic device, when it is necessary to initialize each hardware of each module of the electronic device, the electronic device can directly determine the third interface for initializing each hardware module of each module from the module list, and directly call the third interface without the electronic device spending a long time searching. Therefore, the waiting time required before initializing each hardware module of each module can be reduced, thereby improving the initialization efficiency of each hardware module of each module.

[0082] In some embodiments of the present application, Figure 5 ,like Fig. 9 As shown, before the above step 101, the module initialization method provided in the embodiment of the present application may further include the following step 301.

[0083] Step 301: When at least one first hardware module is registered to the operating system of the electronic device, the electronic device sequentially adds each first module identifier corresponding to each first hardware module to the hardware module timing list according to the initialization order.

[0084] In some embodiments of the present application, the electronic device may first perform step 201 and then perform step 301. Of course, the electronic device may also first perform step 301 and then perform step 201, or may perform step 301 while performing step 201, which is not limited in the embodiments of the present application.

[0085] In some embodiments of the present application, the above-mentioned initialization sequence is stored in the kernel of the electronic device, so that the electronic device can first obtain the initialization sequence from the kernel, and then add each first module identifier corresponding to each first hardware module in the hardware module timing list in sequence according to the initialization sequence.

[0086] In some examples, the above initialization sequence includes sorting information of at least one first hardware module, so that the kernel of the electronic device can first add the first module identifier corresponding to the first hardware module whose sorting information is the first in the hardware module timing list, and add the first module identifier corresponding to the first hardware module whose sorting information is the second in the hardware module timing list, and so on, until each first module identifier corresponding to each first hardware module is in the hardware module timing list.

[0087] It can be understood that in this example, after each first module identifier is added to the hardware module timing list, the arrangement order of the at least one first module identifier in the hardware module timing list may be the same as the initialization order of the at least one first hardware module.

[0088] It should be noted that, in the above step 301, the example of adding the first module identifier corresponding to each first hardware module of the hardware module in the hardware module timing list of the electronic device is used for explanation. It should be understood that, for the case where the electronic device adds the module identifier corresponding to each hardware module of other modules in the hardware module timing list, the electronic device can also add each module identifier corresponding to each hardware module in the hardware module timing list in sequence according to other initialization sequences of at least one hardware module of other modules when each hardware module of other modules is registered to the operating system of the electronic device. The embodiments of the present application will not be repeated here.

[0089] It can be seen that, since at least one first hardware module is registered to the operating system of the electronic device, the electronic device can directly add each first module identifier corresponding to each first hardware module in the hardware module timing list in sequence according to the initialization order of the at least one first hardware module. In this way, the arrangement order of at least one first module identifier in the hardware module timing list can be consistent with the initialization order of at least one first hardware module. In the subsequent steps, the electronic device can directly call each first interface corresponding to each first module identifier in accordance with the initialization order of the at least one first hardware module, so as to initialize each first hardware module in sequence according to the initialization order. Therefore, it can avoid the situation that the order of calling multiple first interfaces is different from the initialization order as in the related art, so as to avoid the situation that the order of at least one first hardware module is different from the initialization order.

[0090] Step 102: The electronic device calls each first interface corresponding to each first module identifier according to the arrangement order of at least one first module identifier.

[0091] In the embodiment of the present application, each of the at least one first interface is used to initialize a first hardware module corresponding to each first interface.

[0092] In some embodiments of the present application, the electronic device may first determine the first interface corresponding to the first first module identifier in the at least one first module identifier in the hardware module timing list, and then call the first interface corresponding to the first first module identifier to initialize the first hardware module corresponding to the first first module identifier. Then the electronic device may determine the first interface corresponding to the second first module identifier in the at least one first module identifier, and then call the first interface corresponding to the second first module identifier to initialize the first hardware module corresponding to the second first module identifier, and so on, until the first interface corresponding to the last first module identifier in the at least one first module identifier is determined, and then the first interface corresponding to the last first module identifier in the at least one first module identifier is called to initialize the first hardware module corresponding to the last first module identifier.

[0093] It can be understood that since the electronic device can call each first interface corresponding to each first module identifier according to the arrangement order of at least one first module identifier in the hardware module timing list, without the need to pre-edit the calling order of each first interface (i.e., initialization interface) in the executable program, the various first interfaces can be decoupled from each other, so that when the initialization order of at least one first hardware module changes, it is only necessary to modify the arrangement order of at least one first module identifier in the hardware module timing list without modifying a large amount of code in the executable program.

[0094] The following is an example to illustrate a specific solution for the electronic device to determine the first interface corresponding to the first module identifier.

[0095] In some embodiments of the present application, Figure 5 ,like Fig.10 As shown, the above step 102 can be specifically implemented through the following steps 102a to 102c.

[0096] Step 102a: The electronic device determines, according to the arrangement order of the at least one first module identifier, a second module identifier that matches the third module identifier from the at least one second module identifier in the hardware module list.

[0097] In an embodiment of the present application, each of the at least one second module identifier is used to indicate a hardware module of a module of an electronic device, each second module identifier corresponds to a second interface, and each second interface is used to initialize a hardware module corresponding to each second interface, and the third module identifier is any one of the at least one first module identifier.

[0098] In some embodiments of the present application, the above hardware module list may be referred to as a SubModule list. Of course, the hardware module list may also be referred to as other names, which are not limited in the embodiments of the present application.

[0099] In some embodiments of the present application, the at least one second module identifier may include at least one of the following: an ID of a hardware module, a name of a hardware module, a MAC address of a hardware module, etc.

[0100] In some embodiments of the present application, the second interface is used to run the driver of the corresponding hardware module, so that the driver can drive the hardware module to initialize. The driver of the hardware module can be called a hardware module driver (SubDev Driver). Of course, the driver of the hardware module can also be called other names, which are not limited in the embodiments of the present application.

[0101] In some embodiments of the present application, when calling the third interface corresponding to the module identifier that matches the first module identifier, the kernel of the electronic device can also obtain a hardware module list from the kernel. In this way, when the electronic device wants to call the first interface corresponding to the third module identifier, the kernel of the electronic device directly obtains the third module identifier from the hardware module sequence list, so that the electronic device can determine the second module identifier that matches the third module identifier from at least one second module identifier in the hardware module list.

[0102] In some embodiments of the present application, the kernel of the electronic device may determine a second module identifier that is identical to the third module identifier from at least one second module identifier.

[0103] In some embodiments of the present application, before the above step 102a, the module initialization method provided by the embodiment of the present application may further include the following step 401.

[0104] Step 401: When any first hardware module is registered to the operating system of the electronic device, the electronic device adds a first module identifier and a first interface corresponding to any first hardware module to a hardware module list.

[0105] In some embodiments of the present application, when any first hardware module of an electronic device is registered to the operating system of the electronic device, the electronic device can install a sub-driver of the any first hardware module in the device driver layer of the kernel, and add a first module identifier corresponding to the any first hardware module and a first interface corresponding to the any first hardware module to the hardware module list in the core layer of the kernel, so that when all first hardware modules of the hardware module of the electronic device are registered to the operating system of the electronic device, at least one sub-driver is included in the device driver layer, and the hardware module list in the core layer of the kernel can include at least one first module identifier and at least one first interface.

[0106] It should be noted that the order in which the at least one first hardware module is registered to the operating system of the electronic device may be the same as or different from the initialization order.

[0107] For example, Fig.11 and Fig.12As shown, the kernel of the electronic device includes a device driver layer and a core layer, so that when a hardware module (such as a sensor) of a module (such as a camera module) of the electronic device is registered with the operating system of the electronic device, the electronic device can install the driver of the sensor (such as a sensorsubdev driver) in the device driver layer of the kernel, and add the first module identifier and the first interface corresponding to the sensor to the hardware module list in the core layer through the subdev_inf interface of the core layer; and when another hardware module (such as a CIS) is registered with the operating system of the electronic device, the electronic device can install the driver of the CIS (such as a CISsubdev driver) in the device driver layer of the kernel, and add the first module identifier and the first interface corresponding to the CIS to the hardware module list in the core layer through the subdev_inf interface of the core layer; and when another hardware module (such as an SFE) is registered with the operating system of the electronic device, the electronic device can install the driver of the SFE (such as an SFE driver) in the device driver layer of the kernel. SubDevDriver), and through the subdev_inf interface of the core layer, add the first module identifier and the first interface corresponding to the SFE to the hardware module list in the core layer; and when another hardware module (for example, IFE) is registered to the operating system of the electronic device, the electronic device can install the driver program of the IFE (for example, IFE SubDevDriver) in the device driver layer of the kernel, and add the first module identifier and the first interface corresponding to the IFE to the hardware module list in the core layer through the subdev_inf interface of the core layer; and, when another hardware module (for example, IFE) is registered to the operating system of the electronic device, the electronic device can install the driver program of the IPE (for example, IPE SubDevDriver) in the device driver layer of the kernel, and add the first module identifier and the first interface corresponding to the IPE to the hardware module list in the core layer through the subdev_inf interface of the core layer. Thus, when the above-mentioned Sensor, CIS, SFE, IFE and IPE are registered to the operating system of the electronic device, the kernel of the electronic device can add the module identifications of the Sensor, CIS, SFE, IFE and IPE respectively in the hardware module timing list (for example, SubModule Slot List) according to the initialization order of the Sensor, CIS, SFE, IFE and IPE, and then in subsequent steps, the kernel of the electronic device can obtain the SubModule Slot List through the slot_match_inf interface, and initialize the Sensor, CIS, SFE, IFE and IPE respectively.

[0108] In some examples, after the electronic device adds the module identifier corresponding to the at least one first hardware module and the at least one first interface corresponding to the at least one first hardware module in the hardware module list, it can also add the module identifier of the module (i.e., the hardware module) to which each first hardware module belongs and each second information in the hardware module list, where each second information is used to indicate whether the module to which each first hardware module belongs has been initialized, so that in subsequent steps, the kernel can accurately determine the module based on the module identifier corresponding to the module to which each first hardware module belongs, and accurately determine whether the module has been initialized based on the second information.

[0109] The kernel may add a second code segment to the hardware module list to add each first module identifier, each first interface, the module identifier of the module (i.e., the hardware module) to which each first hardware module belongs, and each second information to the hardware module list. The second code segment is as follows:

[0110] SubModuledev{

[0111] init_inf; / / Initialize the interface

[0112] master; / / The master to which the current dev belongs

[0113] has_inited; / / Whether the current host has been initialized

[0114] }

[0115] It can be understood that in this example, the hardware module list includes a module identifier corresponding to at least one first hardware module of the hardware module of the electronic device, at least one first interface corresponding to at least one first hardware module, a module identifier corresponding to a module to which at least one first hardware module belongs, and second information corresponding to at least one first hardware module.

[0116] It should be noted that in the above step 401, the first module identifier and the first interface corresponding to each first hardware module of the hardware module added by the electronic device to the hardware module list are used as an example for explanation. It should be understood that, for the case where the electronic device adds the module identifier and the initialization interface corresponding to each hardware module of other modules to the hardware module list, the electronic device can also add the module identifier and the initialization interface corresponding to any hardware module of the other modules to the hardware module list when any hardware module of the other modules is registered to the operating system of the electronic device. The embodiments of the present application will not be repeated here.

[0117] It can be seen that since a hardware module list is also stored in the electronic device, and when each first hardware module of the hardware module of the electronic device is registered to the operating system, the first module identifier and the first interface corresponding to each first hardware module can be added to the hardware module list. In this way, when it is necessary to initialize the first hardware module corresponding to the third module identifier of the electronic device, the electronic device can directly determine the first interface corresponding to the third module identifier from the hardware module list, and directly call the first interface without the electronic device spending a long time searching. Therefore, the waiting time required before initializing each first hardware module can be reduced, thereby improving the initialization efficiency of each hardware module.

[0118] Step 102b: The electronic device determines the second interface corresponding to the second module identifier that matches the third module identifier as the first interface corresponding to the third module identifier.

[0119] In some embodiments of the present application, the electronic device may determine the second interface corresponding to the second module identifier that is the same as the third module identifier as the first interface corresponding to the third module identifier.

[0120] Step 102c: The electronic device calls the first interface corresponding to the third module identifier.

[0121] It can be understood that the electronic device can execute the above step 102a and step 102b at least once to respectively call each first interface corresponding to each first module identifier.

[0122] It can be seen that since a hardware module list is also stored in the electronic device, when it is necessary to initialize the first hardware module corresponding to the third module identifier, the electronic device can directly determine from the hardware module list the second interface for initializing the first hardware module corresponding to the third module identifier, and determine the second interface as the first interface corresponding to the third module identifier, and directly call the first interface without the electronic device spending a long time searching. Therefore, the waiting time required before initializing the first hardware module corresponding to the third module identifier can be reduced, thereby improving the initialization efficiency of each hardware module.

[0123] The embodiment of the present application provides a module initialization method, in which the electronic device can first obtain a hardware module timing list, the hardware module timing list includes at least one first module identifier, each first module identifier is used to indicate a first hardware module of the hardware module of the electronic device, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of the at least one first hardware module. Then the electronic device can call each first interface corresponding to each first module identifier respectively according to the arrangement order of the at least one first module identifier, and each first interface is used to initialize a first hardware module corresponding to each first interface. Since at least one first module identifier is included in the hardware module timing list, and the arrangement order of the at least one first module identifier is associated with the initialization order of the at least one first hardware module, the initialization order of the at least one first hardware module can be determined according to the arrangement order of the at least one first module identifier, without having to determine the initialization order of the at least one first hardware module through the calling order of the initialization interface (i.e., the first interface) corresponding to each first hardware module pre-edited in the executable program. In this way, the first interfaces corresponding to the various first hardware modules can be decoupled. Therefore, in the case of upgrading the electronic device system, if the first hardware module included in the hardware module changes, it is only necessary to adjust the arrangement order of the first module identifier in the hardware module timing list, so that the at least one first hardware module can be initialized according to the new initialization order without modifying the code in the executable program. Therefore, the portability of the electronic device system can be improved.

[0124] Furthermore, on the one hand, since the arrangement order of at least one module identifier in the hardware module timing list can be directly adjusted when the initialization order of at least one hardware module changes, without modifying any code, it is possible to avoid introducing new problems due to a large number of changes to the executable program initcall section and the code of the initialization interface or resetting the initialization priority of at least part of module_init, thereby avoiding various stability and power consumption anomalies. On the other hand, since the initialization order of at least one hardware module can be determined based on the arrangement order of the at least one module identifier, there is no need to run an additional process to detect each hardware module, so the performance consumption of the CPU can be reduced.

[0125] Furthermore, since the electronic device determines the initialization order of the at least one first hardware module based on the arrangement order of the at least one first module identifier, the initialization order of the at least one first hardware module can be customized by adjusting the arrangement order of the at least one first module identifier in the hardware module timing list, thereby improving the flexibility of configuring the initialization order of the at least one first hardware module.

[0126] Furthermore, when the electronic device upgrades the system, if the first hardware module included in the hardware module changes, it is only necessary to adjust the arrangement order of the first module identifier in the hardware module timing list, so that the at least one first hardware module can be initialized according to the new initialization order without modifying the code in the executable program. Therefore, the scalability and versatility of the electronic device system can be improved, and the system debugging of the electronic device can be very convenient and efficient.

[0127] In some embodiments of the present application, after the above step 102, when the electronic device detects that a first hardware module in at least one first hardware module of the hardware module has changed, the electronic device can obtain the initialization order of the at least one first hardware module after the change, and update the at least one first module identifier in the hardware module timing table according to the initialization order. The arrangement order of the at least one first module identifier after the update is associated with the initialization order.

[0128] In some examples, a change in the first hardware module in the at least one first hardware module may be understood as: adding one or more first hardware modules to the at least one first hardware module, or deleting one or more first hardware modules from the at least one first hardware module.

[0129] In one scenario, when an electronic device adds one or more first hardware modules to at least one first hardware module, the electronic device may first add first module identifiers corresponding to the one or more first hardware modules in the hardware module timing list, and then adjust the arrangement order of the at least one first module identifier added according to the initialization order.

[0130] In another scenario, when an electronic device deletes one or some first hardware modules from at least one first hardware module, the electronic device may first delete the first module identifiers corresponding to the one or some first hardware modules from the hardware module timing list, and then adjust the arrangement order of the at least one first module identifier after deletion according to the initialization order.

[0131] Thus, it can be known that, when an electronic device adds one or some first hardware modules to at least one first hardware module, or deletes one or some first hardware modules from at least one first hardware module, the electronic device can directly adjust at least one first module identifier in the hardware module timing list, and update the arrangement order of the at least one adjusted first module identifier, that is, the electronic device can call each first interface corresponding to each adjusted first module identifier according to the arrangement order, that is, the electronic device can directly initialize the at least one adjusted first hardware module according to the new initialization order without modifying any code segment. Therefore, it can avoid the electronic device from being unable to run stably due to the modification of the code segment, thereby avoiding the reduction of the operation stability of the electronic device.

[0132] An embodiment of the present application provides a hardware drive system. Fig.13 FIG. 1 is a schematic diagram showing a hardware drive system provided by an embodiment of the present application. Fig.13 As shown, the hardware driver system 50 provided in the embodiment of the present application may include: a hardware module 51 and a core layer 52, the hardware module 51 includes at least one first hardware module 53, the core layer 52 includes a hardware module timing list, the hardware module timing list includes at least one first module identifier, each first module identifier is used to indicate a first hardware module, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of the at least one first hardware module 53.

[0133] In an embodiment of the present application, the above-mentioned core layer 52 is used to obtain a hardware module timing list, and call each first interface corresponding to each first module identifier according to the arrangement order of at least one first module identifier, and each first interface is used to initialize a first hardware module corresponding to each first interface.

[0134] It should be noted that, for the description of the hardware module 51, at least one first hardware module 53 and the hardware module timing table, reference may be made to the specific description in the above embodiments, and the embodiments of the present application will not be repeated here.

[0135] In some embodiments of the present application, the above-mentioned core layer 52 also includes a hardware module list, which includes at least one second module identifier, each second module identifier is used to indicate a hardware module of a module of an electronic device, each second module identifier corresponds to a second interface, and each second interface is used to initialize a hardware module corresponding to each second interface.

[0136] In an embodiment of the present application, the core layer 52 is used to determine a second module identifier that matches a third module identifier from at least one second module identifier, each second module identifier is used to indicate a hardware module of a module of an electronic device, each second module identifier corresponds to a second interface, and each second interface is used to initialize a hardware module corresponding to each second interface, and the third module identifier is any one of at least one first module identifier; and the second interface corresponding to the second module identifier that matches the third module identifier is determined as the first interface corresponding to the third module identifier; and, the first interface corresponding to the third module identifier is called.

[0137] It can be seen that since a hardware module list is also stored in the core layer, when it is necessary to initialize the first hardware module corresponding to the third module identifier, the core layer can directly determine the second interface for initializing the first hardware module corresponding to the third module identifier from the hardware module list, and determine the second interface as the first interface corresponding to the third module identifier, and directly call the first interface without spending a long time searching. Therefore, the waiting time before initializing the first hardware module corresponding to the third module identifier can be reduced, thereby improving the initialization efficiency of each hardware module.

[0138] In some embodiments of the present application, the hardware driver system 50 provided in the embodiments of the present application may also include a device driver layer.

[0139] In an embodiment of the present application, the device driver layer is used to add a first module identifier and a first interface corresponding to any first hardware module in a hardware module list when any first hardware module is registered to an operating system of an electronic device.

[0140] It can be seen that since a hardware module list is also stored in the device driver layer, and when each first hardware module of the hardware module is registered to the operating system, the first module identifier and the first interface corresponding to each first hardware module can be added to the hardware module list. In this way, when it is necessary to initialize the first hardware module corresponding to the third module identifier, the core layer can directly determine the first interface corresponding to the third module identifier from the hardware module list, and directly call the first interface without spending a long time searching. Therefore, the waiting time before initializing each first hardware module can be reduced, thereby improving the initialization efficiency of each hardware module.

[0141] In some embodiments of the present application, the hardware driver system 50 provided in the embodiments of the present application may also include a device driver layer.

[0142] In an embodiment of the present application, the device driver layer is used to add each first module identifier corresponding to each first hardware module in the hardware module timing list in sequence according to the initialization order when at least one first hardware module is registered to the operating system of the electronic device.

[0143] It can be seen that, since at least one first hardware module is registered to the operating system of the electronic device, the device driver layer can directly add each first module identifier corresponding to each first hardware module in the hardware module timing list in sequence according to the initialization order of the at least one first hardware module. In this way, the arrangement order of at least one first module identifier in the hardware module timing list can be consistent with the initialization order of at least one first hardware module. In the subsequent steps, the electronic device can directly call each first interface corresponding to each first module identifier in accordance with the initialization order of the at least one first hardware module, so as to initialize each first hardware module in sequence according to the initialization order. Therefore, it can avoid the situation in which the order of calling multiple first interfaces is different from the initialization order as in the related art, so as to avoid the situation in which the initialization order of at least one first hardware module is different from the initialization order.

[0144] In some embodiments of the present application, the above-mentioned core layer also includes a module list, which includes at least one module identifier, each module identifier is used to indicate a module of the electronic device, each module identifier corresponds to a third interface, and each third interface is used to initialize each hardware module of the module corresponding to each third interface.

[0145] In an embodiment of the present application, the above-mentioned core layer is used to determine a module identifier that matches a first module identifier from at least one module identifier, and the first module identifier is used to indicate a hardware module; the core layer is used to call a third interface corresponding to the module identifier that matches the first module identifier to obtain a hardware module timing list.

[0146] It can be seen that since the core layer also stores a module list, when it is necessary to initialize each hardware of each module, the core layer can directly determine the third interface for initializing each hardware module of each module from the module list, and directly call the third interface without spending a long time searching. Therefore, the waiting time required before initializing each hardware module of each module can be reduced, thereby improving the initialization efficiency of each hardware module of each module.

[0147] An embodiment of the present application provides a hardware driver system, which includes: a hardware module and a core layer, wherein the hardware module includes at least one first hardware module, and the core layer includes a hardware module timing list, wherein the hardware module timing list includes at least one first module identifier, each first module identifier is used to indicate a first hardware module, and the arrangement order of at least one first module identifier in the hardware module timing list is associated with the initialization order of at least one first hardware module; wherein the core layer is used to obtain the hardware module timing list, and according to the arrangement order of at least one first module identifier, each first interface corresponding to each first module identifier is called respectively, and each first interface is used to initialize a first hardware module corresponding to each first interface. Since the hardware module timing list in the core layer includes at least one first module identifier, and the arrangement order of the at least one first module identifier is associated with the initialization order of the at least one first hardware module, that is, the core layer can determine the initialization order of the at least one first hardware module according to the arrangement order of the at least one first module identifier, without having to determine the initialization order of the at least one first hardware module through the calling order of the initialization interface (i.e., the first interface) corresponding to each first hardware module pre-edited in the executable program. In this way, the first interfaces corresponding to each first hardware module can be decoupled. Therefore, in the case of upgrading the electronic device system, if the first hardware module included in the hardware module changes, the core layer only needs to adjust the arrangement order of the first module identifier in the hardware module timing list, so that the at least one first hardware module can be initialized according to the new initialization order without modifying the code in the executable program. Therefore, the portability of the electronic device system can be improved.

[0148] The module initialization method provided in the embodiment of the present application can be executed by a module initialization device. In the embodiment of the present application, the module initialization device provided in the embodiment of the present application is described by taking the module initialization method executed by the module initialization device as an example.

[0149] Fig.14 A possible structural diagram of a module initialization device involved in some embodiments of the present application is shown. Fig.14 As shown, the module initialization device 60 provided in the embodiment of the present application may include: an acquisition module 61 and a processing module 62.

[0150] The acquisition module 61 is used to acquire a hardware module timing list, which includes at least one first module identifier, each of which is used to indicate a first hardware module of the hardware module of the module initialization device 60, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of the at least one first hardware module. The processing module 62 is used to call each first interface corresponding to each first module identifier according to the arrangement order of the at least one first module identifier in the hardware module timing list acquired by the acquisition module 61, and each first interface is used to initialize a first hardware module corresponding to each first interface.

[0151] An embodiment of the present application provides a module initialization device. Since at least one first module identifier is included in a hardware module timing list, and the arrangement order of the at least one first module identifier is associated with the initialization order of the at least one first hardware module, the initialization order of the at least one first hardware module can be determined according to the arrangement order of the at least one first module identifier, without having to determine the initialization order of the at least one first hardware module by the calling order of the initialization interface (i.e., the first interface) corresponding to each first hardware module pre-edited in the executable program. In this way, the first interfaces corresponding to the various first hardware modules can be decoupled. Therefore, when the module initialization device upgrades the system, if the first hardware module included in the hardware module changes, it is only necessary to adjust the arrangement order of the first module identifier in the hardware module timing list, so that the at least one first hardware module can be initialized according to the new initialization order without modifying the code in the executable program. Therefore, the system portability of the module initialization device can be improved.

[0152] In one possible implementation, the processing module 62 is specifically used to determine a second module identifier that matches a third module identifier from at least one second module identifier in the hardware module list, each second module identifier is used to indicate a hardware module of a module of the module initialization device 60, each second module identifier corresponds to a second interface, and each second interface is used to initialize a hardware module corresponding to each second interface, and the third module identifier is any one of at least one first module identifier; and the second interface corresponding to the second module identifier that matches the third module identifier is determined as the first interface corresponding to the third module identifier; and the first interface corresponding to the third module identifier is called.

[0153] In one possible implementation, the processing module 62 is also used to add the first module identifier and the first interface corresponding to any first hardware module to the hardware module list when any first hardware module is registered to the operating system of the module initialization device 60 before determining the second module identifier that matches the third module identifier from at least one second module identifier in the hardware module list.

[0154] In a possible implementation, the processing module 62 is also used to add each first module identifier corresponding to each first hardware module in the hardware module timing list in sequence according to the initialization order when at least one first hardware module is registered to the operating system of the module initialization device 60 before the acquisition module 61 acquires the hardware module timing list.

[0155] In a possible implementation, the processing module 62 is further used to determine a module identifier that matches the first module identifier from at least one module identifier in the module list before the acquisition module 61 acquires the hardware module timing list, each module identifier is used to indicate a module of the module initialization device 60, each module identifier corresponds to a third interface, each third interface is used to initialize each hardware module of the module corresponding to each third interface, and the first module identifier is used to indicate the hardware module. The acquisition module 51 is specifically used to call the third interface corresponding to the module identifier that matches the first module identifier to acquire the hardware module timing list.

[0156] The module initialization device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than the terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (mobile internet device, MID), an augmented reality (augmentedreality, AR) / virtual reality (virtualreality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (network attached storage, NAS), a personal computer (personalcomputer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.

[0157] The module initialization device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0158] The module initialization device provided in the embodiment of the present application can achieve Figures 5 to 12 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0159] In some embodiments of the present application, Fig.15 As shown, an embodiment of the present application also provides an electronic device 70, including a processor 71 and a memory 72, wherein the memory 72 stores programs or instructions that can be executed on the processor 71, and when the program or instructions are executed by the processor 71, the various process steps of the above-mentioned module initialization method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0160] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0161] Fig.16 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0162] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.

[0163] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.16 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0164] Among them, the processor 110 is used to obtain a hardware module timing list, which includes at least one first module identifier, each first module identifier is used to indicate a first hardware module of a first module of an electronic device, and the arrangement order of the at least one first module identifier in the hardware module timing list is associated with the initialization order of the at least one first hardware module; and according to the arrangement order of the at least one first module identifier, each first interface corresponding to each first module identifier is called respectively, and each first interface is used to initialize a first hardware module corresponding to each first interface.

[0165] An embodiment of the present application provides an electronic device. Since at least one first module identifier is included in a hardware module timing list, and the arrangement order of the at least one first module identifier is associated with the initialization order of the at least one first hardware module, the initialization order of the at least one first hardware module can be determined according to the arrangement order of the at least one first module identifier, without having to determine the initialization order of the at least one first hardware module by the calling order of the initialization interface (i.e., the first interface) corresponding to each first hardware module pre-edited in the executable program. In this way, the first interfaces corresponding to the various first hardware modules can be decoupled. Therefore, in the case of upgrading the electronic device system, if the first hardware module included in the hardware module changes, it is only necessary to adjust the arrangement order of the first module identifier in the hardware module timing list, so that the at least one first hardware module can be initialized according to the new initialization order without modifying the code in the executable program. Therefore, the portability of the electronic device system can be improved.

[0166] In some embodiments of the present application, the above-mentioned processor 100 is specifically used to determine a second module identifier that matches a third module identifier from at least one second module identifier in the hardware module list, each second module identifier is used to indicate a hardware module of a module of an electronic device, each second module identifier corresponds to a second interface, and each second interface is used to initialize a hardware module corresponding to each second interface, and the third module identifier is any one of at least one first module identifier; the second interface corresponding to the second module identifier that matches the third module identifier is determined as the first interface corresponding to the third module identifier; and the first interface corresponding to the third module identifier is called.

[0167] In some embodiments of the present application, the above-mentioned processor 110 is also used to add a first module identifier and a first interface corresponding to any first hardware module in the hardware module list when any first hardware module is registered to the operating system of the electronic device before determining a second module identifier that matches the third module identifier from at least one second module identifier in the hardware module list.

[0168] In some embodiments of the present application, the above-mentioned processor 110 is also used to, before obtaining the hardware module timing list, add each first module identifier corresponding to each first hardware module in the hardware module timing list in sequence according to the initialization order when at least one first hardware module is registered to the operating system of the electronic device.

[0169] In some embodiments of the present application, the above-mentioned processor 110 is also used to determine a module identifier that matches the first module identifier from at least one module identifier in the module list before obtaining the hardware module timing list, each module identifier is used to indicate a module of the electronic device, each module identifier corresponds to a third interface, each third interface is used to initialize each hardware module of the module corresponding to each third interface, and the first module identifier is used to indicate the first module.

[0170] The processor 110 is specifically configured to call a third interface corresponding to a module identifier that matches the first module identifier to obtain a hardware module timing list.

[0171] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0172] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static RAM (SRAM), a dynamic RAM (DRAM), a synchronous DRAM (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct rambus RAM (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0173] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.

[0174] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned module initialization method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0175] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0176] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned module initialization method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0177] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0178] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned module initialization method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0179] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0180] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0181] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A module initialization method, It is characterized in that include: Acquire a hardware module timing list, wherein the hardware module timing list includes at least one first module identifier, each of the first module identifiers is used to indicate a first hardware module of a hardware module of the electronic device, and an arrangement order of at least one first module identifier in the hardware module timing list is associated with an initialization order of at least one first hardware module; According to the arrangement order of at least one first module identifier, each first interface corresponding to each first module identifier is called respectively, and each first interface is used to initialize a first hardware module corresponding to each first interface.

2. The method according to claim 1, It is characterized in that The respectively calling each first interface corresponding to each first module identifier includes: Determine, from at least one second module identifier in the hardware module list, a second module identifier that matches a third module identifier, each of the second module identifiers is used to indicate a hardware module of a module of the electronic device, each of the second module identifiers corresponds to a second interface, each of the second interfaces is used to initialize a hardware module corresponding to each of the second interfaces, and the third module identifier is any one of the at least one first module identifier; Determine the second interface corresponding to the second module identifier that matches the third module identifier as the first interface corresponding to the third module identifier; The first interface corresponding to the third module identifier is called.

3. The method according to claim 2, It is characterized in that Before determining the second module identifier matching the third module identifier from the at least one second module identifier in the hardware module list, the method further includes: When any one of the first hardware modules is registered to the operating system of the electronic device, the first module identifier and the first interface corresponding to any one of the first hardware modules are added to the hardware module list.

4. The method according to claim 1, It is characterized in that Before obtaining the hardware module timing list, the method further includes: In the case where at least one of the first hardware modules is registered to the operating system of the electronic device, each first module identifier corresponding to each first hardware module is sequentially added to the hardware module timing list according to the initialization sequence.

5. The method according to claim 1, It is characterized in that Before obtaining the hardware module timing list, the method further includes: Determine, from at least one module identifier in the module list, a module identifier that matches the first module identifier, each module identifier is used to indicate a module of the electronic device, each module identifier corresponds to a third interface, each third interface is used to initialize each hardware module of the module corresponding to each third interface, and the first module identifier is used to indicate the hardware module; The step of obtaining a hardware module timing list includes: The third interface corresponding to the module identifier matching the first module identifier is called to obtain the hardware module timing list.

6. A hardware drive system, It is characterized in that The hardware driving system comprises: a hardware module and a core layer, wherein the hardware module comprises at least one first hardware module, the core layer comprises a hardware module timing list, the hardware module timing list comprises at least one first module identifier, each first module identifier is used to indicate one first hardware module, and the arrangement order of at least one first module identifier in the hardware module timing list is associated with the initialization order of at least one first hardware module; Among them, the core layer is used to obtain the hardware module timing list, and call each first interface corresponding to each first module identifier according to the arrangement order of at least one first module identifier, and each first interface is used to initialize a first hardware module corresponding to each first interface.

7. The hardware drive system according to claim 6, It is characterized in that The core layer also includes a hardware module list, the hardware module list includes at least one second module identifier, each of the second module identifiers is used to indicate a hardware module of a module of the electronic device, each of the second module identifiers corresponds to a second interface, and each of the second interfaces is used to initialize a hardware module corresponding to each of the second interfaces; Among them, the core layer is used to determine the second module identifier that matches the third module identifier from at least one of the second module identifiers, each of the second module identifiers is used to indicate a hardware module of a module of the electronic device, each of the second module identifiers corresponds to a second interface, and each of the second interfaces is used to initialize a hardware module corresponding to each of the second interfaces, and the third module identifier is any one of at least one of the first module identifiers; and the second interface corresponding to the second module identifier that matches the third module identifier is determined as the first interface corresponding to the third module identifier; and the first interface corresponding to the third module identifier is called.

8. The hardware drive system according to claim 7, It is characterized in that The hardware driver system also includes a device driver layer; The device driver layer is used to add the first module identifier and the first interface corresponding to any one of the first hardware modules to the hardware module list when any one of the first hardware modules is registered to the operating system of the electronic device.

9. The hardware drive system according to claim 6, It is characterized in that The hardware driver system also includes a device driver layer; The device driver layer is used to add each first module identifier corresponding to each first hardware module in the hardware module timing list in sequence according to the initialization order when at least one of the first hardware modules is registered to the operating system of the electronic device.

10. The hardware drive system according to claim 6, It is characterized in that The core layer also includes a module list, the module list includes at least one module identifier, each module identifier is used to indicate a module of the electronic device, each module identifier corresponds to a third interface, and each third interface is used to initialize each hardware module of the module corresponding to each third interface; The core layer is used to determine a module identifier that matches the first module identifier from the at least one module identifier, and the first module identifier is used to indicate the hardware module; The core layer is used to call the third interface corresponding to the module identifier matching the first module identifier to obtain the hardware module timing list.

11. A module initialization device, It is characterized in that The module initialization device comprises: an acquisition module and a processing module; The acquisition module is used to acquire a hardware module timing list, wherein the hardware module timing list includes at least one first module identifier, each of which is used to indicate a first hardware module of a hardware module of the electronic device, and the arrangement order of at least one first module identifier in the hardware module timing list is associated with the initialization order of at least one first hardware module; The processing module is used to call each first interface corresponding to each first module identifier according to the arrangement order of at least one first module identifier obtained by the obtaining module, and each first interface is used to initialize a first hardware module corresponding to each first interface.

12. The device according to claim 11, It is characterized in that The processing module is specifically used to determine the second module identifier that matches the third module identifier from at least one second module identifier in the hardware module list, each second module identifier is used to indicate a hardware module of a module of the electronic device, each second module identifier corresponds to a second interface, and each second interface is used to initialize a hardware module corresponding to each second interface, and the third module identifier is any one of at least one first module identifier; and determine the second interface corresponding to the second module identifier that matches the third module identifier as the first interface corresponding to the third module identifier; and call the first interface corresponding to the third module identifier.

13. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the module initialization method according to any one of claims 1 to 5 are implemented.

14. A readable storage medium, It is characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the module initialization method according to any one of claims 1 to 5 are implemented.