A sensor-driven loading method, device, chip, product and medium

By defining a preset storage space in IRAM and using hardware ID matching, the problem of driver adaptation for the same type of sensor is solved, realizing efficient and low-power sensor driver loading, and supporting adaptation and expansion for multiple models.

CN120762769BActive Publication Date: 2025-11-07XIAMEN UNISOC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511286119.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-10
Publication Date
2025-11-07
Estimated Expiration
2045-09-10

AI Technical Summary

Technical Problem

In the existing technology, due to the different drivers produced by different manufacturers, it is impossible to use a single software system to adapt to multiple models of sensors of the same type. In addition, the SPIRAM space is limited and cannot load all drivers.

Method used

By defining a preset storage space in IRAM to store the sensor driver loading function, and copying candidate sensor drivers from DDR to IRAM, automatic loading and matching of sensor drivers can be achieved using hardware ID matching.

Benefits of technology

It enables a single software system to adapt to multiple sensor models, improves IRAM utilization, reduces power consumption, reduces access latency, and supports flexible expansion and automatic matching with real sensors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120762769B_ABST
    Figure CN120762769B_ABST
Patent Text Reader

Abstract

The application belongs to the field of sensors, and discloses a sensor driving loading method, device, chip, product and medium, from multiple candidate sensor drivers, a candidate sensor driver is selected as a current to-be-matched driver, and a program segment corresponding to the current to-be-matched driver is copied from DDR to IRAM; the target sensor is hardware initialized and the hardware ID of the target sensor is obtained; the hardware ID is compared with the to-be-matched ID in the program segment; if the same, the structure pointer of the current to-be-matched driver is returned; if not the same, it is judged whether there is still other candidate sensor driver; if yes, the step of selecting a candidate sensor driver from multiple candidate sensor drivers as a current to-be-matched driver is returned; if not, the sensor failure loading information is returned. Various types of sensors can be adapted by using a set of software systems, and the utilization rate of IRAM is higher.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of sensors, and particularly relates to a sensor driving loading method, device, chip, product and medium. BACKGROUND

[0002] SP IRAM refers to a high-speed on-chip memory integrated in a SP (Sensor Processor). The IRAM (Integrated Random Access Memory) is directly integrated in the chip, compared with a traditional external DRAM (Dynamic Random Access Memory), the delay and energy consumption of data transmission in and out of the chip are eliminated, the IRAM provides faster data access speed and lower power consumption.

[0003] With more and more intelligent devices and smart wearable devices emerging and being widely used, many human-computer interaction features need to rely on various sensors to be realized, and the types of sensors required are not the same for different specifications of products. In actual use, sensor services have high real-time requirements, for example, the acceleration sensor and the gyroscope data may be 1kHz or even higher frequency sampling. If DRAM is used, each access needs to go through bus arbitration and cache, and the delay is large. Secondly, many sensors need to be continuously operated in a low-power consumption scene, such as wristband step counting and wrist lifting to wake up, and accessing the on-chip IRAM can significantly reduce power consumption. Furthermore, the data locality of the sensor service is strong, and the driving function, initialization code and cache data are usually closely related. Placing them in the IRAM can reduce memory access overhead. It can be seen that the SP IRAM is suitable for storing sensor driving code and real-time data, and it is faster and more power-efficient than external DRAM, and is suitable for high-frequency sampling and low-power consumption scenarios.

[0004] However, the current situation is that there are many companies producing the same type of sensors, and the sensors produced by the many companies have different drives although they are of the same type. Due to the limited size of the SPIRAM space, all sensor drives under the same type cannot be loaded into the SPIRAM space, so that one sensor needs one set of software system, and it is impossible to realize that one set of software system is adapted to multiple models of the same type of sensor. It can be seen that how to adapt one set of software system to multiple models of the same type of sensor is a problem to be solved. SUMMARY

[0005] The purpose of the application is to adapt one set of software system to multiple models of the same type of sensor, and therefore, in a first aspect, the application provides a sensor driving loading method, which comprises:

[0006] selecting one of the candidate sensor drivers as a current to-be-matched driver from the plurality of candidate sensor drivers, the plurality of candidate sensor drivers being drivers corresponding to the target sensor category actually installed, and copying a program segment corresponding to the current to-be-matched driver from the DDR to the IRAM;

[0007] performing hardware initialization on the target sensor and obtaining a hardware ID of the target sensor;

[0008] comparing the obtained hardware ID with a to-be-matched ID in the program segment;

[0009] if the hardware ID and the to-be-matched ID are the same, returning a structure pointer of the current to-be-matched driver;

[0010] if the hardware ID and the to-be-matched ID are not the same, determining whether there are other candidate sensor drivers;

[0011] if there are other candidate sensor drivers, returning the step of selecting one of the candidate sensor drivers as a current to-be-matched driver from the plurality of candidate sensor drivers; if there are no other candidate sensor drivers, returning sensor failure loading information.

[0012] In a possible implementation, the target sensor category includes an accelerometer sensor, a gyroscope sensor, a light sensor, a magnetometer sensor, and a proximity sensor.

[0013] In a possible implementation, the method further includes:

[0014] defining a preset storage space in the IRAM, the storage space being used to store driver loading functions of various sensors, wherein one type of sensor corresponds to one driver loading function;

[0015] selecting one of the driver loading functions as a current driver loading function from the plurality of driver loading functions, and calling the current driver loading function, the driver loading function being used to perform a copying operation of a program segment.

[0016] In a possible implementation, the program segment includes an instruction segment, a data segment, and an uninitialized data segment; and the instruction segment includes a second initialization function.

[0017] The performing hardware initialization on the target sensor and obtaining the hardware ID of the target sensor includes:

[0018] calling the second initialization function, performing hardware initialization on the target sensor, and obtaining the hardware ID of the target sensor.

[0019] In a possible implementation, the method further includes:

[0020] After obtaining the structure pointer of the current to-be-matched driver, it is determined whether there are other driver loading functions:

[0021] If there are, a driver loading function is selected from the plurality of driver loading functions as a current driver loading function, and the step of calling the current driver loading function is returned; if there are not, sensor complete loading information is returned.

[0022] In a second aspect, the application provides a sensor driver loading device, which comprises:

[0023] A copying module is configured to select a candidate sensor driver from a plurality of candidate sensor drivers as a current to-be-matched driver, and copy a program segment corresponding to the current to-be-matched driver from a DDR to an IRAM, wherein the plurality of candidate sensor drivers are all drivers corresponding to a target sensor category actually installed;

[0024] A hardware ID obtaining module is configured to perform hardware initialization on the target sensor and obtain a hardware ID of the target sensor;

[0025] A comparison module is configured to compare the obtained hardware ID with a to-be-matched ID in the program segment; if they are the same, a structure pointer of the current to-be-matched driver is returned; if they are not the same, it is determined whether there are other candidate sensor drivers; if there are, a step of selecting a candidate sensor driver from the plurality of candidate sensor drivers as a current to-be-matched driver is returned; if there are not, sensor failure loading information is returned.

[0026] In a possible implementation, the target sensor category comprises an accelerometer sensor, a gyroscope sensor, a light sensor, a magnetometer sensor, and a proximity sensor.

[0027] In a possible implementation, the device further comprises:

[0028] An initialization module is configured to define a preset storage space in the IRAM, and the storage space is used to store driver loading functions of various sensors, wherein one type of sensor corresponds to one driver loading function.

[0029] A calling module is configured to select a driver loading function from a plurality of driver loading functions as a current driver loading function, and call the current driver loading function, wherein the driver loading function is used to perform a copying operation of a program segment.

[0030] In a possible implementation, the program segment comprises an instruction segment, a data segment, and an uninitialized data segment; and the instruction segment comprises a second initialization function.

[0031] The hardware ID obtaining module is specifically configured to:

[0032] The second initialization function is called to perform hardware initialization on the target sensor and obtain the hardware ID of the target sensor.

[0033] In a possible implementation, the apparatus further includes:

[0034] The driver loading function iteration module is configured to, after obtaining the structure pointer of the current to-be-matched driver, determine whether there are other driver loading functions: if there are, return to select one driver loading function from the plurality of driver loading functions as a current driver loading function, and call the current driver loading function; and if there are not, return sensor completion loading information.

[0035] In a third aspect, the present application provides a system on chip, which includes an IRAM and an external memory interface, the IRAM is used to store a program segment of a sensor driver, and the external memory interface is used to copy the program segment from a DDR to the IRAM and execute the method steps of any of the above.

[0036] In a fourth aspect, the present application provides a computer program product containing instructions, which, when executed on a computer, cause the computer to implement the method of any of the above.

[0037] In a fifth aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the method of any of the above.

[0038] The present application copies a program segment corresponding to a to-be-matched sensor driver from a DDR to an IRAM, performs hardware initialization on a target sensor and obtains a hardware ID of the target sensor, the target sensor is an actually installed sensor, and the to-be-matched sensor driver is a corresponding driver under a category of the target sensor, compares the hardware ID with a to-be-matched ID in the program segment, returns a structure pointer of the to-be-matched sensor driver if they are the same, and returns to perform the copying of the program segment corresponding to the to-be-matched sensor driver from the DDR to the IRAM if they are not the same. This can implement the adaptation of various types of sensors by using one set of software systems, the utilization rate of the IRAM is high, the corresponding driver is loaded into the IRAM space according to the actually installed target sensor, that is, the IRAM space is considered to be insufficient and too many drivers cannot be loaded, and the IRAM data access speed is considered to be fast and the power consumption is low, and sensor data acquisition and processing are realized through the IRAM. BRIEF DESCRIPTION OF DRAWINGS

[0039] Figure 1 A flowchart of a sensor driving loading method provided for an embodiment of the present application is shown in FIG. 1.

[0040] Figure 2 A memory layout diagram provided for an embodiment of the present application is shown in FIG. 2.

[0041] Figure 3 A system architecture diagram provided for an embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION

[0042] The present application will be described in detail below through embodiments.

[0043] SP IRAM refers to a high-speed on-chip memory integrated internally in a SP (Sensor Processor). IRAM (Integrated Random Access Memory) is directly integrated internally in a chip, compared with a traditional external DRAM (Dynamic Random Access Memory), the delay and energy consumption of data transmission inside and outside the chip are eliminated, the IRAM provides faster data access speed and lower power consumption.

[0044] With more and more smart devices and smart wearable devices emerging and being widely used, many human-computer interaction features need to rely on various sensors to be realized, and the types of sensors required are not the same for different specifications of products. In actual use, sensor services have high real-time requirements, for example, the data of an accelerometer and a gyroscope may be 1kHz or even higher frequency sampling. If DRAM is used, each access needs to go through bus arbitration and cache, and the delay is large. Secondly, many sensors need to be continuously operated in a low-power consumption scene, such as wristband step counting and wrist lifting to wake up, and accessing on-chip IRAM can significantly reduce power consumption. Furthermore, the data locality of sensor services is strong, and the driving function, initialization code and cache data are usually closely related. Placing them in the IRAM can reduce memory access overhead. It can be seen that the SP IRAM is suitable for storing sensor driving code and real-time data, it is faster and more power-saving than external DRAM, and is suitable for high-frequency sampling and low-power consumption scenes.

[0045] But the current situation is that there are multiple companies producing the same type of sensor, and the sensors produced by the multiple companies have different drivers although they are of the same type. Due to the limited size of the SPIRAM space, all sensor drivers of the same type cannot be loaded into the SPIRAM space, so that a sensor needs a set of software systems, and it is impossible to realize that one set of software systems is adapted to multiple models of the same type of sensor. It can be seen that how to adapt one set of software systems to multiple models of the same type of sensor is a problem to be solved urgently.

[0046] Based on this, referring to Figure 1 , in a first aspect, an embodiment of the present application provides a sensor driver loading method, and the method comprises the following steps:

[0047] S101, selecting one candidate sensor driver program from multiple candidate sensor driver programs as a current to-be-matched driver program, and copying a program segment corresponding to the current to-be-matched driver program from DDR to IRAM, wherein the multiple candidate sensor driver programs are all driver programs corresponding to a target sensor category actually installed.

[0048] S102, performing hardware initialization on the target sensor and obtaining a hardware ID of the target sensor.

[0049] S103, comparing the obtained hardware ID with a to-be-matched ID in the program segment.

[0050] S104, if the hardware ID and the to-be-matched ID are the same, returning a structure pointer of the current to-be-matched driver program.

[0051] S105, if the hardware ID and the to-be-matched ID are different, judging whether there is another candidate sensor driver program.

[0052] S106, if there is another candidate sensor driver program, returning the step of selecting one candidate sensor driver program from multiple candidate sensor driver programs as a current to-be-matched driver program.

[0053] S107, if there is no other candidate sensor driver program, returning sensor failure loading information.

[0054] The above steps can be implemented by the following steps:

[0055] S201, copying a to-be-matched sensor driver program corresponding to a program segment from DDR to IRAM.

[0056] DDR (Double Data Rate, double data rate synchronous dynamic random access memory) is a kind of DRAM, with high bandwidth and high-speed data transmission, high density and large capacity support, cheap and other advantages, can be used to store a large amount of data information. The scheme of the application saves the data in the low-speed memory DDR first, and then moves to the high-speed memory IRAM.

[0057] Before this step, a block of preset storage space is defined in the IRAM, and the storage space is used to store driving loading functions of various sensors, wherein one type of sensor corresponds to one driving loading function. From the plurality of driving loading functions, a driving loading function is selected as a current driving loading function, and the current driving loading function is called, and the driving loading function is used to execute the copy operation of the program segment. It can be understood that when writing the link script, the engineer will specify a block of IRAM address range as the SENSOR INIT section. The compiler / linker will collect the driving loading function entry addresses of various sensors when generating the executable file, and put them into this section in order. The generated firmware file already contains the layout information of this IRAM space. When the device is powered on and the firmware is loaded into the memory, this IRAM space has been defined in advance, and is waiting for the CPU to access. The runtime will not define it again, but directly use it.

[0058] In the embodiments of the present application, a preset storage space is defined in the IRAM in advance to store the driving loading functions of various sensors, which can be uniformly managed to make the structure clear, and the driving loading functions of each sensor are concentrated in a continuous IRAM region; when the system starts, each initialization function can be sequentially executed by traversing this region, which avoids scattered searching and simplifies the initialization process. In addition, the access speed can be improved, the IRAM is on-chip, and the access speed is much faster than the external DDR; the initialization function often needs to frequently access the register and configure the hardware, and placing it in the IRAM can improve the execution efficiency; the delay of the system power-on or wake-up is reduced. In addition, the power consumption can be reduced, the initialization stage usually occurs on the critical path of the device power-on / wake-up; placing the driving loading function in the IRAM for execution can avoid accessing the external DDR (which has higher power consumption); it is particularly meaningful for low-power devices such as wearable devices. The scheme of the present application can be flexibly extended to support multiple types of sensors, and sensors of different manufacturers / models can be hung to the preset storage space through the link script, and the system only needs to cyclically execute this region without hard-coding the specific sensors in advance; new sensors only need to add the corresponding driving loading function at the time of compilation without changing the system logic.

[0059] The program segment corresponding to the sensor driver to be matched is copied from the DDR to the IRAM, which can specifically include:

[0060] The driving loading function is executed to copy the program segment corresponding to the sensor driver to be matched from the DDR to the IRAM, and the program segment includes an instruction segment, a data segment, and an uninitialized data segment.

[0061] The above process is executed after the device is powered on.

[0062] The driving loading function is used to copy the program segment corresponding to the sensor driver to be matched from the DDR to the IRAM. The program segment includes an instruction segment (text segment), a data segment (data segment), and an uninitialized data segment (bss segment), and the instruction segment (text segment) includes a sensor ID corresponding to the sensor driver to be matched, a get function, a set function, and a second initialization function. The second initialization function is an initialization function of a specific sensor of the same type, the set function is used to set the baud rate and frequency, and the get function is used to obtain the data transmitted from outside and send the data to the CPU after collecting the data to make the CPU perform some operations or fusion operations. For example, the step counting function is obtained by performing fusion algorithm on the accelerometer, gyroscope and the like; common applications implemented by sensors also include measurement of heart rate, blood pressure, blood oxygen and the like.

[0063] The scheme of the embodiment of the application moves the driver segment to the IRAM, and the initialization and driving execution speed is faster; the DDR access delay is reduced, and the system response speed is improved. Moreover, the boot initialization stage is usually an energy consumption sensitive path; the second initialization function is executed in the IRAM, the external DDR is avoided from being frequently accessed, and the energy consumption is reduced. In addition, the initialization process occurs when the system is just powered on or wakes up, and the external DDR may not be completely stable; the second initialization function is run in the IRAM first, the early reliability is ensured, and the system stability is improved. The scheme of the application triggers the moving operation by executing the driving loading function, so that the driving loading process is standardized; different types of sensor drivers can be copied and executed by using the same mechanism. The flexibility and scalability are specifically embodied, and different program segments (text, data, bss) are integrally moved; in the future, when a new type of sensor is added, the corresponding segment needs to be added at the time of compilation, and the loading logic does not need to be changed.

[0064] In S202, hardware of a target sensor is initialized, and a hardware ID of the target sensor is obtained, the target sensor is an actually installed sensor, and the to-be-matched sensor driver is a corresponding driver under a category of the target sensor.

[0065] The target sensor category includes an accelerometer sensor, a gyroscope sensor, a light sensor, a magnetometer sensor, and a proximity sensor.

[0066] The scheme of the application can be applied to a chip, a module, and a terminal product with a sensor hub, wherein the sensor hub usually includes a group of low-power processors and memories, and is used for collecting and analyzing real-time data from an accelerometer, a gyroscope, a magnetometer, an ambient light sensor, a proximity sensor, and a pressure sensor. The sensor hub can execute some basic sensor fusion algorithms, combines data of multiple sensors, and provides more accurate position information, motion states, and other environmental information.

[0067] Now, the program segment corresponding to the to-be-matched sensor driver is in the IRAM space, including an instruction segment (a text segment), a data segment (a data segment), and an uninitialized data segment (a bss segment). The instruction segment (the text segment) includes a sensor ID corresponding to the to-be-matched sensor driver, a get function, a set function, and a second initialization function. The second initialization function is an initialization function of a specific sensor of the same type.

[0068] The second initialization function is called to perform hardware initialization on the target sensor and obtain a hardware ID of the target sensor. The hardware initialization generally refers to an initialization operation performed by the second initialization function on a sensor chip, such as power-on, reset, setting a default value of a register, configuring a sampling rate and a working mode, and reading a chip ID, which is the hardware ID mentioned above.

[0069] In S203, the hardware ID is compared with an ID to be matched in the program segment, and if the two are the same, a structure pointer of the to-be-matched sensor driver program is returned; if the two are different, a step of copying the program segment corresponding to the to-be-matched sensor driver program from the DDR to the IRAM is performed.

[0070] After the structure pointer of the current to-be-matched driver program is obtained, it is determined whether there are other driver loading functions, and if so, a driver loading function is selected from the multiple driver loading functions as a current driver loading function, and the step of calling the current driver loading function is performed; if not, sensor completion loading information is returned.

[0071] Since the device actually installs only one sensor for a type of sensor, the uniquely installed hardware ID is the evaluation standard. Since the IRAM space already stores an instruction segment (text segment), a data segment (data segment), and an uninitialized data segment (bss segment) of the to-be-matched sensor driver program, the instruction segment (text segment) includes a sensor ID, a get function, a set function, and a second initialization function corresponding to the to-be-matched sensor driver program. Therefore, after the hardware ID of the actually installed sensor is obtained, it is compared with the sensor ID corresponding to the to-be-matched sensor driver program stored in the current IRAM, and if the two are consistent, it indicates that the correct sensor driver program is loaded into the IRAM space, and if the two are inconsistent, a sensor driver program matching the actually installed sensor needs to be found. Specifically, it is determined whether there are other candidate sensor driver programs, and if so, a candidate sensor driver program is selected from the multiple candidate sensor driver programs as a current to-be-matched driver program; if not, sensor failure loading information is returned.

[0072] In the case of consistent ID matching, a structure pointer of the to-be-matched sensor driver program is returned, which is used to point to the get function and the set function in the to-be-matched sensor driver program, so that the get function and the set function can be used to perform data acquisition and data setting operations. Then, the next driver loading function is executed until a null pointer is obtained. It can be understood that the memory layout of the SENSOR INIT is shown in Figure 2The driving loading function includes first initialization functions of various sensors, the driving loading function of the first type of sensor is executed first, after the structure pointer of the to-be-matched sensor driving program is acquired, it is indicated that the first type of sensor has found the corresponding driving and has been loaded into the IRAM space; then, the driving loading function of the second type of sensor is executed, after the structure pointer of the to-be-matched sensor driving program is acquired, it is indicated that the second type of sensor has found the corresponding driving and has been loaded into the IRAM space; then, if the null pointer is acquired, it is indicated that the process of loading the corresponding driving of various sensors is all completed, at this time, the whole driving loading process is ended.

[0073] The scheme of the embodiment of the application facilitates judging and selecting a real sensor, the chip ID of a target sensor can be read by executing each second initialization function; if matching is successful, the corresponding driving is loaded, if not, the next one is tried; until the null pointer is traversed, all attempts are completed. This is an automatic detection and matching mechanism. The application realizes unified management and execution of driving loading functions of various sensors quickly, efficiently and with low power consumption, supports flexible expansion and automatic matching of real sensors.

[0074] The application copies the program segment corresponding to the to-be-matched sensor driving program from the DDR into the IRAM; the hardware ID of a target sensor is acquired by performing hardware initialization on the target sensor, the target sensor is an actually installed sensor, and the to-be-matched sensor driving program is the corresponding driving program under the category of the target sensor; the hardware ID and the to-be-matched ID in the program segment are compared, if they are the same, the structure pointer of the to-be-matched sensor driving program is returned; if they are not the same, the copying of the program segment corresponding to the to-be-matched sensor driving program from the DDR into the IRAM is continued. Various models of sensors can be adapted by using one set of software systems, the utilization rate of the IRAM is high, the corresponding driving is loaded into the IRAM space according to the actually installed target sensor, that is, the insufficient IRAM space and the inability to load too many drivers are considered, and the fast data access speed and low power consumption of the IRAM are considered, and sensor data acquisition and processing are realized through the IRAM.

[0075] Referring to Figure 3A system structure schematic diagram provided by an embodiment of the present application. A plurality of types of sensors corresponding to driving are stored in a double data rate synchronous dynamic random access memory (DDR), and under each specific type, different models of sensor driving are included. An area is opened in an embedded static random access memory (IRAM) to store a driving loading function sensor init of each type of sensor, and one sensor init function corresponds to one type of sensor. An ACC (Accelerometer, accelerometer) sensor init function is executed in sequence first, and when the sensor is initialized, the four models of sensor driving corresponding to the ACC type in the DDR are copied in sequence. After the program segment of the first model 01 is copied, if the ID corresponds to the actual installed sensor ID, it is indicated that the program segment in the current IRAM space is the correct program segment, and for the same type of sensor, the copying of the text segment, the data segment, and the bss segment will not be performed again, and otherwise, the data of the next sensor will be copied and executed.

[0076] After the correct driving for the current type of sensor is found and loaded into the IRAM space, a structure body pointer is returned to access the get function and the set function in the driving to perform data acquisition and configuration operations. If the structure body pointer is obtained, a GYRO (Gyroscope, gyroscope) sensor init function is executed, the four models of sensor driving corresponding to the GYRO type in the DDR are copied in sequence, and if the first model 11 that is currently copied does not match the ID of the actual installed sensor, the second model 12 is continued to be copied until the ID of the newly copied program segment is the same as the ID of the actual installed sensor, and the copying is stopped and the structure body pointer is returned.

[0077] Subsequent processes can be implemented according to the above description, and a Light (light sensor) sensor init function, a Mag (Magnetometer, magnetometer) sensor init function, and a Prox (Proximity Sensor, proximity sensor) are executed in sequence.

[0078] However, the prior art implements the above process by placing all the contents stored in the DDR into the IRAM and commenting out the sensor driving that is not needed. In order to adapt to the hardware, different models of sensors need to be repeatedly compiled, which is a huge workload, and causes the software version maintenance cost to be doubled and the version upgrade iteration to be difficult. The scheme of the present application does not need to be recompiled, and as long as it is compiled once, it can adapt to all models of sensors, regardless of the hardware, and a set of software system is adapted to multiple hardware.

[0079] In a second aspect, the present application provides a sensor-driven loading device, which comprises:

[0080] a copying module configured to select a candidate sensor driver from a plurality of candidate sensor drivers as a current to-be-matched driver, and copy a program segment corresponding to the current to-be-matched driver from a DDR to an IRAM, wherein the plurality of candidate sensor drivers are drivers corresponding to a target sensor category actually installed;

[0081] a hardware ID obtaining module configured to perform hardware initialization on the target sensor and obtain a hardware ID of the target sensor;

[0082] a comparing module configured to compare the obtained hardware ID with a to-be-matched ID in the program segment; if the hardware ID and the to-be-matched ID are the same, return a structure pointer of the current to-be-matched driver; if the hardware ID and the to-be-matched ID are different, determine whether there is another candidate sensor driver; if there is another candidate sensor driver, return the step of selecting a candidate sensor driver from the plurality of candidate sensor drivers as a current to-be-matched driver; if there is no other candidate sensor driver, return sensor failure loading information.

[0083] In a possible implementation, the target sensor category comprises an accelerometer sensor, a gyroscope sensor, a light sensor, a magnetometer sensor, and a proximity sensor.

[0084] In a possible implementation, the device further comprises:

[0085] an initializing module configured to define a preset storage space in the IRAM, wherein the storage space is used to store driver loading functions of various sensors, and one type of sensor corresponds to one driver loading function;

[0086] a calling module configured to select a driver loading function from a plurality of driver loading functions as a current driver loading function, and call the current driver loading function, wherein the driver loading function is used to perform a copying operation of a program segment.

[0087] In a possible implementation, the program segment comprises an instruction segment, a data segment, and an uninitialized data segment, and the instruction segment comprises a second initialization function.

[0088] The hardware ID obtaining module is specifically configured to:

[0089] call the second initialization function, perform hardware initialization on the target sensor, and obtain the hardware ID of the target sensor.

[0090] In a possible implementation, the device further comprises:

[0091] The driving loading function traversal module is configured to, after obtaining the structure pointer of the current to-be-matched driver, determine whether there are other driving loading functions; if there are, return a driving loading function selected from the plurality of driving loading functions as a current driving loading function, and call the current driving loading function; and if there are not, return sensor completion loading information.

[0092] In a third aspect, the present application provides a system on chip, which comprises an IRAM and an external memory interface, the IRAM is configured to store a program segment of a sensor driver, and the external memory interface is configured to copy the program segment from a DDR to the IRAM and execute the method steps of any of the above.

[0093] In a fourth aspect, the present application provides a computer program product comprising instructions which, when executed on a computer, cause the computer to perform the method of any of the above.

[0094] In a fifth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method of any of the above.

[0095] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product comprises one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)) and the like.

[0096] It is to be noted that, in the present text, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0097] Each of the embodiments in the present specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the device, chip, computer program product, and computer readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.

[0098] The above only describes the preferred embodiments of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A sensor-driven loading method, characterized by, The method comprises: selecting a candidate sensor driver program as a current to-be-matched driver program from a plurality of candidate sensor driver programs, the plurality of candidate sensor driver programs being driver programs corresponding to a target sensor category actually installed, and copying a program segment corresponding to the current to-be-matched driver program from a DDR to an IRAM; performing hardware initialization on the target sensor and obtaining a hardware ID of the target sensor; comparing the obtained hardware ID with a to-be-matched ID in the program segment; if the hardware ID and the to-be-matched ID are the same, returning a structure pointer of the current to-be-matched driver program; if the hardware ID and the to-be-matched ID are different, determining whether there are other candidate sensor driver programs; if there are other candidate sensor driver programs, returning the step of selecting a candidate sensor driver program as a current to-be-matched driver program from a plurality of candidate sensor driver programs; and if there are no other candidate sensor driver programs, returning sensor failure loading information; defining a preset storage space in the IRAM, the storage space being used to store driver loading functions of various sensors, wherein one category of sensors corresponds to one driver loading function; selecting a driver loading function as a current driver loading function from a plurality of driver loading functions, and calling the current driver loading function, the driver loading function being used to perform a copying operation of a program segment; after obtaining the structure pointer of the current to-be-matched driver program, determining whether there are other driver loading functions; if there are other driver loading functions, returning the step of selecting a driver loading function as a current driver loading function from a plurality of driver loading functions and calling the current driver loading function; and if there are no other driver loading functions, returning sensor completion loading information.

2. The method of claim 1, wherein, The target sensor category comprises an accelerometer sensor, a gyroscope sensor, a light sensor, a magnetometer sensor, and a proximity sensor.

3. The method of claim 1, wherein, The program segment comprises an instruction segment, a data segment, and an uninitialized data segment. The instruction segment comprises a second initialization function. The hardware initialization on the target sensor and the obtaining of the hardware ID of the target sensor comprise: calling the second initialization function, performing hardware initialization on the target sensor, and obtaining the hardware ID of the target sensor.

4. A sensor driven loading device, characterized by The apparatus comprises: a copying module configured to select a candidate sensor driver program as a current to-be-matched driver program from a plurality of candidate sensor driver programs, the plurality of candidate sensor driver programs being driver programs corresponding to a target sensor category actually installed, and copy a program segment corresponding to the current to-be-matched driver program from a DDR to an IRAM; a hardware ID obtaining module configured to perform hardware initialization on the target sensor and obtain a hardware ID of the target sensor; and comparing module, configured to compare the obtained hardware ID with the to-be-matched ID in the program segment; if the same, return the structure pointer of the current to-be-matched driver program; if not the same, judge whether there is still other candidate sensor driver program; if yes, return the step of selecting one candidate sensor driver program from the plurality of candidate sensor driver programs as the current to-be-matched driver program; if not, return the sensor failure loading information; an initialization module, configured to define a preset storage space in the IRAM, the storage space being used to store the driving loading functions of various sensors, wherein one type of sensor corresponds to one driving loading function; a calling module, configured to select one driving loading function from the plurality of driving loading functions as the current driving loading function, and call the current driving loading function, the driving loading function being used to perform the copying operation of the program segment; a driving loading function traversal module, configured to, after obtaining the structure pointer of the current to-be-matched driver program, judge whether there is still other driving loading function; if yes, return the step of selecting one driving loading function from the plurality of driving loading functions as the current driving loading function, and calling the current driving loading function; if not, return the sensor completion loading information.

5. A system on chip, comprising: The system-level chip comprises an IRAM and an external memory interface, the IRAM being used to store the program segment of the sensor driver program, and the external memory interface being used to copy the program segment from the DDR to the IRAM and perform the method steps of any one of claims 1-3.

6. A computer program product comprising instructions, characterized in that, When it runs on the computer, it enables the computer to implement the method of any one of claims 1-3.

7. A computer readable storage medium characterized in that, The computer readable storage medium stores the computer program, and the computer program is executed by the processor to implement the method of any one of claims 1-3. The computer readable storage medium stores the computer program, and the computer program is executed by the processor to implement the method of any one of claims 1-3.

Citation Information

Patent Citations

  • Chip simulation verification method and system, electronic equipment and program product

    CN118862768A

  • Method and appatatus for selecting a desired application on a smart card

    US20050184165A1