Instruction response method, apparatus and electronic device
By pre-storing files in memory, the problem of slow response times for electronic devices to commands is solved, resulting in faster command response speeds.
Patent Information
- Application Number
- CN202210546238.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-19
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-05-19
AI Technical Summary
Existing electronic devices are slow to respond to commands because they need to read files from flash memory.
Files in the file system are pre-stored in memory, so that the corresponding file can be read directly from memory after receiving an instruction.
By reducing the time spent reading files from memory, instruction response speed is significantly improved, especially in scenarios requiring rapid response.
Smart Images

Figure CN114816261B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of data processing, and particularly relates to an instruction response method and device, an electronic device, and a computer readable storage medium. BACKGROUND
[0002] Currently, an electronic device loads a file index of a corresponding file system of the electronic device into a memory. When the electronic device needs to respond to an instruction, such as a video query instruction, the corresponding file needs to be read. At this time, the electronic device first searches for the file index in the memory, and then reads the corresponding file from a flash memory according to the searched file index. Since the corresponding file needs to be read from the flash memory according to the file index, and reading requires a certain amount of time, the responsiveness of the instruction is affected. SUMMARY
[0003] Embodiments of the present application provide an instruction response method, device, and electronic device, which can solve the problem that existing electronic devices are not timely in responding to instructions.
[0004] In a first aspect, an embodiment of the present application provides an instruction response method applied to an electronic device supporting a Free Real Time Operating System (Freertos), and the method comprises the following steps.
[0005] receiving a to-be-processed instruction;
[0006] reading a file corresponding to a content of the to-be-processed instruction from a file system of a memory, wherein the file system is stored in the memory;
[0007] responding to the to-be-processed instruction according to the file read from the memory.
[0008] In a second aspect, an embodiment of the present application provides an instruction response device applied to an electronic device supporting a Freertos operating system, and the device comprises the following modules.
[0009] a to-be-processed instruction receiving module configured to receive a to-be-processed instruction;
[0010] a file reading module of a memory, configured to read a file corresponding to a content of the to-be-processed instruction from a file system of a memory, wherein the file system is stored in the memory;
[0011] a first to-be-processed instruction responding module configured to respond to the to-be-processed instruction according to the file read from the memory.
[0012] In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the method according to the first aspect when running the computer program.
[0013] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the method according to the first aspect.
[0014] In a fifth aspect, a computer program product is provided, which, when running on an electronic device, causes the electronic device to perform the method according to the first aspect.
[0015] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0016] In the embodiments of the present application, when the electronic device receives a to-be-processed instruction, the electronic device reads a file corresponding to the content of the to-be-processed instruction from a file system of the memory. Since the reading speed of the file from the memory is faster than that of the file from the flash memory, the faster the reading speed of the file is, the shorter the time for responding to the to-be-processed instruction is. Therefore, the method for responding to the instruction according to the embodiments of the present application can greatly improve the speed of responding to the instruction. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced.
[0018] Figure 1 is a flowchart of a method for responding to an instruction according to an embodiment of the present application;
[0019] Figure 2 is a flowchart of an instruction responding apparatus according to an embodiment of the present application;
[0020] Figure 3 is a structural schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] In the following description, specific details are set forth in order to provide a thorough understanding of the embodiments of the present application. However, persons skilled in the art should understand that the embodiments of the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary details.
[0022] It should be understood that the term "include" as used in the specification and the appended claims indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0023] It should also be understood that the term "and / or" as used in the specification and the appended claims indicates any combination of the associated listed items, as well as all possible combinations of the items.
[0024] In addition, in the description of the specification and the appended claims, the terms "first", "second", and the like are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.
[0025] In the present specification, the reference "one embodiment" or "some embodiments" and the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearance of the phrases "in one embodiment", "in some embodiments", "in other some embodiments", "in yet some embodiments" and the like in various places in the specification is not necessarily all referring to the same embodiment, but means "one or more but not all embodiments", unless otherwise specifically noted.
[0026] Example One
[0027] When the electronic device receives the instruction, it needs to read the file of the file system to respond to the instruction. If the file to be read is stored in flash, and the speed of reading the file from flash is slow, it will result in slow response speed of the instruction.
[0028] In order to improve the response speed of the instruction, the present application provides an instruction response method. In the method, the file is stored in the memory, so that when the instruction is received, the required file can be directly read from the memory. Since the speed of reading the file from the memory is faster than that of reading the file from the flash, when responding to the received instruction according to the read file, the response speed of the instruction can be greatly improved.
[0029] The instruction response method provided by the embodiments of the present application is described below in conjunction with the accompanying drawings.
[0030] Figure 1 A flowchart of an instruction response method provided by the embodiments of the present application is shown, which is applied to an electronic device supporting Freertos operating system, and is described in detail as follows:
[0031] Step S11, receiving an instruction to be processed.
[0032] The to-be-processed instruction can be an instruction sent by a user to the electronic device actively, or an instruction sent by another device (or component) to the electronic device. For example, an electronic device and a sound sensor are installed near a house door, the electronic device is configured to capture images around the house door, and the sound sensor is configured to detect sound signals around the house door. In order to make the images captured by the electronic device more effective and save resources of the electronic device, the sound sensor can be configured to send a start instruction to the electronic device after detecting a sound signal, and the electronic device performs a start action. That is, the start instruction received by the electronic device is an instruction sent by another device (the sound sensor), rather than an instruction sent by a user actively.
[0033] It should be noted that in the above example, the sound sensor and the electronic device are independent, and in actual cases, the sound sensor can also be integrated into the electronic device as a component of the electronic device, which is not limited herein.
[0034] In step S12, a file corresponding to the content of the to-be-processed instruction is read from a file system in the memory, where the file system is stored in the memory.
[0035] In the embodiment of the present application, the file in the file system is stored in the memory in advance before the to-be-processed instruction is received, so that when the file needs to be read from the file system, the file can be directly read from the memory, thereby greatly improving the file searching speed.
[0036] In the embodiment of the present application, when the content of the to-be-processed instruction indicates that the to-be-processed instruction is used to start a camera of the electronic device, the file corresponding to the content of the to-be-processed instruction includes a file corresponding to a driver of the camera. When the content of the to-be-processed instruction indicates that the to-be-processed instruction is used to delete a file A, the file corresponding to the content of the to-be-processed instruction includes the file A.
[0037] In step S13, the to-be-processed instruction is responded according to the file read from the flash memory.
[0038] Specifically, if the content of the to-be-processed instruction indicates that the to-be-processed instruction is used to start a camera of the electronic device, responding to the to-be-processed instruction means starting the corresponding camera according to the found file. If the content of the to-be-processed instruction indicates that the to-be-processed instruction is used to delete a file A, responding to the to-be-processed instruction means deleting the file A.
[0039] In the embodiment of the present application, when the electronic device receives the to-be-processed instruction, the file corresponding to the content of the to-be-processed instruction is read from the file system in the memory. Since the reading speed of the file from the memory is faster than that of the file from the flash memory, and the faster the reading speed of the file is, the shorter the time for responding to the to-be-processed instruction is, therefore, the method for responding to the instruction according to the embodiment of the present application can greatly improve the speed of responding to the instruction.
[0040] In some embodiments, considering that the electronic device needs to respond to the received instruction very quickly in some scenarios, and can respond to the received instruction relatively slowly in some scenarios. For example, assuming that the electronic device is monitoring the door of a house, and the electronic device starts the camera to perform the shooting task after the sensor (such as a sound sensor) detects that there is a signal (such as a sound signal) around the door, once the electronic device receives the starting instruction of the camera, it needs to respond to the starting instruction very quickly, otherwise, the shooting of the object appearing around the door may be missed.
[0041] That is, in the embodiment of the present application, the correspondence relationship between different instruction types and each file system is preset, and the file (i.e., the file of the target file system) related to the specified instruction is read into the memory in advance. When the to-be-processed instruction is received, the instruction type corresponding to the to-be-processed instruction is determined, and then the file system corresponding to the to-be-processed instruction is determined according to the instruction type and the preset correspondence relationship. If the file system is the target file system, the corresponding file is directly read from the memory. That is, step S12 of the embodiment of the present application includes:
[0042] A1, determining the file system corresponding to the to-be-processed instruction according to the instruction type of the to-be-processed instruction and the preset correspondence relationship between the instruction type and the file system.
[0043] Specifically, the purpose of the to-be-processed instruction can be determined according to the content of the to-be-processed instruction, and then the instruction type of the to-be-processed instruction is determined according to the determined purpose. For example, if the purpose of the to-be-processed instruction is to start the camera, the instruction type of the to-be-processed instruction is the starting type of instruction, and if the purpose of the to-be-processed instruction is to query, the instruction type of the to-be-processed instruction is the query type of instruction. After determining the instruction type of the to-be-processed instruction, the determined instruction type is compared with the instruction type in the correspondence relationship to find the file system corresponding to the determined instruction type.
[0044] A2, if the file system is the target file system, reading the file corresponding to the content of the to-be-processed instruction from the target file system in the memory.
[0045] Since the files of the target file system have been pre-loaded into memory, if it is determined that the file involved in the instruction to be processed belongs to the target file system, the required file can be directly read from memory, thereby improving the speed of responding to instructions of the type corresponding to the target file system.
[0046] In some embodiments, considering that some instruction types will not cause any loss to the user even if the response is relatively slow, the files involved in these instruction types (i.e., files not in the target file system) can be stored in the flash memory of the electronic device without being read from the memory of the electronic device, thereby saving memory space. That is, the instruction response method of this application embodiment further includes:
[0047] B1. If the above file system is not the target file system, then read the file index corresponding to the content of the above instruction to be processed from memory.
[0048] In this embodiment, since the memory only stores the files of the target file system and the file indexes corresponding to the files of non-target file systems, when it is determined that the file system determined by the instruction type of the instruction to be processed and the preset correspondence between the instruction type and the file system is not the target file system, the file index corresponding to the content of the instruction to be processed will be read from the memory first.
[0049] B2. Read the corresponding file from the flash memory based on the file index.
[0050] Specifically, since files not belonging to the target file system are stored in flash memory rather than in memory, after reading the file index from memory, the corresponding file needs to be read from flash memory based on that file index.
[0051] B3. Respond to the above pending instructions based on the file read from the flash memory.
[0052] In this embodiment, because the files of the target file system are read into memory, the electronic device can respond promptly to the pending instructions corresponding to the files of the target file system. Simultaneously, because files not belonging to the target file system are stored in flash memory, the memory footprint of the electronic device can be reduced.
[0053] In some embodiments, the target file system is initially stored in flash memory. In this case, the instruction response method provided in this application embodiment further includes:
[0054] When the aforementioned electronic device starts up, the target file system stored in the flash memory is read into memory.
[0055] In this embodiment of the application, considering that the records of the target file system in the memory will be lost after the electronic device is powered off, the target file system stored in the flash memory is read into the memory after the electronic device starts up, such as after each startup of the electronic device, so that when it is necessary to read the files of the target file system later, they can be read directly from the memory quickly.
[0056] In some embodiments, reading the target file system stored in flash memory into memory when the electronic device starts up includes:
[0057] When the aforementioned electronic device boots from a flash memory boot path, the target file system stored in the flash memory is read into memory.
[0058] The boot paths for electronic devices include those from flash memory and those from a Secure Digital Memory Card (SD).
[0059] When electronic devices need to operate normally, they usually boot from flash memory. However, when electronic devices need to be debugged (such as installing or maintaining a system), they usually boot from an SD card. Since the speed requirement for responding to commands is not high when debugging electronic devices, in order to save the resources of electronic devices, the target file system stored in flash memory is only read into memory when the boot path of the electronic device is a flash-boot path.
[0060] In some embodiments, to further improve the command response speed, the command response method provided in this application further includes:
[0061] C1. When packaging files, determine the file system corresponding to the above files.
[0062] In this embodiment of the application, since it includes both target file systems and non-target file systems, when packaging each file in the firmware (such as operating software), it is necessary to first determine the file system corresponding to the file.
[0063] In some embodiments, the file system to which a file belongs can be distinguished based on its importance to starting the electronic device. For example, files that affect the startup of the electronic device can be categorized into the target file system, while files that do not affect the startup of the electronic device can be categorized into a non-target file system. Since users are very sensitive to the startup speed of the electronic device, files that affect the startup of the electronic device are categorized into the target file system, and then the files in the target file system are read from flash memory into memory. This allows the corresponding files to be read directly from memory when the electronic device needs to be started, thereby improving the startup speed of the electronic device.
[0064] C2. If the file system corresponding to the above files is the target file system, then the files of the target file system are packaged according to the data structure after the target file system is mounted.
[0065] Specifically, if the parent node of the folder containing file A and the folder containing file B is the same in the data structure after the target file system is mounted, then file A and file B are packaged according to this data structure.
[0066] C3. Save the packaged files to flash memory.
[0067] In this embodiment, the flash memory can be partitioned in advance, and the packaged files can be written into the corresponding partition of the flash memory to facilitate the management of the flash memory.
[0068] In this embodiment, since the files belonging to the target file system are packaged according to the data structure after the target file system is mounted, when searching for the file later, it can be searched directly according to the data structure after the target file system is mounted, avoiding brute-force search of the file, thereby greatly saving the file search time.
[0069] It should be noted that if the file system corresponding to the above files is not the target file system, you can choose to package the files of the non-target file system according to the data structure after the non-target file system is mounted, and store the packaged files in the flash memory, or you can directly store the files of the non-target file system in the flash memory.
[0070] In some embodiments, to facilitate subsequent verification of the read file, step C3 above includes:
[0071] The packaged file, the corresponding checksum of the packaged file, and the value indicating the size of the packaged file are stored in the flash memory.
[0072] In this embodiment of the application, the packaged file can be obtained by packaging a single file or by packaging multiple files.
[0073] The checksum corresponding to the packaged file can be obtained by processing the content of the packaged file using the Message Digest Algorithm Version 5 (MD5). The value indicating the size of the packaged file can be directly the value corresponding to the size of the packaged file.
[0074] Correspondingly, the process of reading the target file system stored in flash memory into memory includes:
[0075] D1. Read the files of the target file system from flash memory into memory according to the value indicating the size of the files of the target file system.
[0076] Specifically, since the flash memory stores the file of the target file system and a value indicating the size of the file, data of the corresponding length can be read according to the value in the flash memory, so as to read the file corresponding to the value into memory.
[0077] D2. Calculate the checksum of the target file system file read into memory to obtain the first checksum.
[0078] For example, if the checksum of a file is calculated using the MD5 algorithm when packaging a file, then this step also calculates the checksum of the file read into memory using the MD5 algorithm.
[0079] D3. Compare the first check value with the second check value. If the first check value and the second check value are equal, then assign the file of the target file system read into memory to the corresponding memory variable. The second check value is the check value stored in flash memory corresponding to the file of the target file system.
[0080] In this embodiment, the checksum calculated when the file is packaged is compared with the checksum calculated after the file is read from flash memory into memory. If the comparison result indicates that the compared parameters are equal, it means that the file is the same after being read into memory as it was packaged and stored in flash memory. At this time, the file is then assigned to the memory variable of the corresponding data structure to ensure the accuracy of the read file.
[0081] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0082] Example Two
[0083] One instruction response method corresponding to the above embodiment, Figure 2 This diagram illustrates a structural block diagram of an instruction response device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiments of this application are shown.
[0084] Reference Figure 2 The instruction response device 2 is applied to an electronic device and includes: a pending instruction receiving module 21, a memory file reading module 22, and a first pending instruction response module 23. Wherein:
[0085] The pending instruction receiving module 21 is used to receive pending instructions.
[0086] The instruction to be processed can be an instruction sent by the user to the electronic device, or an instruction sent by other devices to the electronic device.
[0087] The memory file reading module 22 is used to read the file corresponding to the content of the above-mentioned instruction to be processed from the memory file system, wherein the above-mentioned file system is stored in memory.
[0088] In this embodiment of the application, before receiving the instruction to be processed, the files in the file system are stored in memory in advance. In this way, when it is necessary to read the file from the file system, it can be read directly from memory, thereby greatly improving the file search speed.
[0089] The first pending instruction response module 23 is used to respond to the pending instruction based on the file read from the memory.
[0090] In this embodiment, when the electronic device receives a processing instruction, it reads the file corresponding to the content of the processing instruction from the file system in memory. Since reading a file from memory is faster than reading a file from flash memory, and faster file reading speed can shorten the response time to the processing instruction, the instruction response method of this embodiment can greatly improve the speed of responding to instructions.
[0091] In some embodiments, different instruction types are pre-defined to correspond to various file systems, and files involving specified instructions (i.e., files of the target file system) are pre-read into memory. Upon receiving an instruction to be processed, the instruction type corresponding to the instruction is determined, and then the file system corresponding to the instruction is determined based on the instruction type and the pre-defined correspondence. If the file system is the target file system, the corresponding file is directly read from memory. That is, the memory file reading module 22 in this embodiment includes:
[0092] The file system determination unit corresponding to the instruction is used to determine the file system corresponding to the instruction to be processed based on the instruction type of the instruction to be processed and the preset correspondence between instruction type and file system.
[0093] Specifically, the purpose of the instruction to be processed can be determined based on its content, and then the instruction type can be determined based on the determined purpose.
[0094] The file reading unit of the target file system is used to read the file corresponding to the content of the above-mentioned instruction to be processed from the target file system in memory if the above file system is the target file system.
[0095] Since the files of the target file system have been pre-loaded into memory, if it is determined that the file involved in the instruction to be processed belongs to the target file system, the required file can be directly read from memory, thereby improving the speed of responding to instructions of the type corresponding to the target file system.
[0096] In some embodiments, considering that some instruction types will not cause any loss to the user even if the response is relatively slow, the files involved in these instruction types (i.e., files not in the target file system) can be stored in the flash memory of the electronic device without being read from the memory of the electronic device, thereby saving memory space. That is, the instruction response device 2 of this application embodiment further includes:
[0097] The file index reading module is used to read the file index corresponding to the content of the above-mentioned instruction from memory if the above file system is not the target file system.
[0098] Since memory only stores files of the target file system and file indexes corresponding to files of non-target file systems, when it is determined that the file system determined based on the instruction type of the instruction to be processed and the preset correspondence between instruction type and file system is not the target file system, the file index corresponding to the content of the instruction to be processed will be read from memory first.
[0099] The flash memory file reading module is used to read the corresponding file from the flash memory according to the file index.
[0100] The second pending instruction response module is used to respond to the above pending instructions based on the file read from the flash memory.
[0101] In this embodiment, because the files of the target file system are read into memory, the electronic device can respond promptly to the pending instructions corresponding to the files of the target file system. Simultaneously, because files not belonging to the target file system are stored in flash memory, the memory footprint of the electronic device can be reduced.
[0102] In some embodiments, the target file system is initially stored in flash memory. In this case, the instruction response device 2 further includes:
[0103] The target file system prefetch module is used to read the target file system stored in flash memory into memory when the electronic device starts up.
[0104] In this embodiment of the application, considering that the records of the target file system in the memory will be lost after the electronic device is powered off, the target file system stored in the flash memory is read into the memory after the electronic device starts up, such as after each startup of the electronic device, so that when it is necessary to read the files of the target file system later, they can be read directly from the memory quickly.
[0105] In some embodiments, the target file system prefetching module described above is specifically used for:
[0106] When the aforementioned electronic device boots from a flash memory boot path, the target file system stored in the flash memory is read into memory.
[0107] The boot paths of electronic devices include those booting from flash memory and those booting from SD card.
[0108] When electronic devices need to operate normally, they usually boot from flash memory. However, when electronic devices need to be debugged (such as installing or maintaining a system), they usually boot from an SD card. Since the speed requirement for responding to commands is not high when debugging electronic devices, in order to save the resources of electronic devices, the target file system stored in flash memory is only read into memory when the electronic device boots from a path that boots from flash memory.
[0109] In some embodiments, to further improve the command response speed, the command response device 2 provided in this application embodiment further includes:
[0110] The file system determination module for the files to be packaged is used to determine the file system corresponding to the files when packaging them.
[0111] In some embodiments, the file system to which a file belongs can be distinguished based on its importance to starting the electronic device. For example, files that affect the startup of the electronic device can be categorized into the target file system, while files that do not affect the startup of the electronic device can be categorized into a non-target file system. Since users are very sensitive to the startup speed of the electronic device, files that affect the startup of the electronic device are categorized into the target file system, and then the files in the target file system are read from flash memory into memory. This allows the corresponding files to be read directly from memory when the electronic device needs to be started, thereby improving the startup speed of the electronic device.
[0112] The file packaging module is used to package the files of the target file system according to the data structure after the target file system is mounted, if the file system corresponding to the above files is the target file system.
[0113] The packaged file storage module is used to store the packaged files into flash memory.
[0114] In this embodiment, since the files belonging to the target file system are packaged according to the data structure after the target file system is mounted, when searching for the file later, it can be searched directly according to the data structure after the target file system is mounted, avoiding brute-force search of the file, thereby greatly saving the file search time.
[0115] In some embodiments, the instruction response device 2 provided in this application further includes:
[0116] The file storage module for non-target file systems is used to determine that the file system corresponding to the above file is a non-target file system. It can choose to package the file of the non-target file system according to the data structure after the non-target file system is mounted, and store the packaged file in flash memory, or it can directly store the file of the non-target file system in flash memory.
[0117] In some embodiments, to facilitate subsequent verification of the read files, the above-mentioned packaged file storage module includes:
[0118] The verification value storage unit is used to store the packaged file, the verification value corresponding to the packaged file, and a value indicating the size of the packaged file into the flash memory.
[0119] In this embodiment of the application, the packaged file can be obtained by packaging a single file or by packaging multiple files.
[0120] The checksum corresponding to the packaged file can be obtained by processing the contents of the packaged file using MD5, and the value indicating the size of the packaged file can be directly the value corresponding to the size of the packaged file.
[0121] Correspondingly, when the aforementioned target file system prefetching module reads the target file system stored in flash memory into memory, it is specifically used for:
[0122] The files of the target file system are read from flash memory into memory according to the value indicating the size of the files in the target file system;
[0123] Calculate the checksum of the target file system file read into memory to obtain the first checksum;
[0124] The first check value is compared with the second check value. If the first check value and the second check value are equal, the file of the target file system read into memory is assigned to the corresponding memory variable. The second check value is the check value stored in flash memory corresponding to the file of the target file system.
[0125] In this embodiment, the checksum calculated when the file is packaged is compared with the checksum calculated after the file is read from flash memory into memory. If the comparison result indicates that the compared parameters are equal, it means that the file is the same after being read into memory as it was packaged and stored in flash memory. At this time, the file is then assigned to the memory variable of the corresponding data structure to ensure the accuracy of the read file.
[0126] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0127] Example Three
[0128] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the electronic device 3 of this embodiment includes: at least one processor 30 ( Figure 3 The diagram shows only one processor, a memory 31, and a computer program 32 stored in the memory 31 and executable on the at least one processor 30, wherein the processor 30 executes the computer program 32 to implement the steps in any of the above method embodiments.
[0129] The electronic device 3 may be a network camera (IP camera, IPC), a smart doorbell, or a video host, etc. The electronic device 3 may include, but is not limited to, a processor 30 and a memory 31. Those skilled in the art will understand that... Figure 3 This is merely an example of electronic device 3 and does not constitute a limitation on electronic device 3. It may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, it may also include input / output devices, network access devices, etc.
[0130] The processor 30 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0131] In some embodiments, the memory 31 may be an internal storage unit of the electronic device 3, such as a hard disk or memory of the electronic device 3. In other embodiments, the memory 31 may be an external storage device of the electronic device 3, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 3. Furthermore, the memory 31 may include both internal and external storage units of the electronic device 3. The memory 31 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 31 can also be used to temporarily store data that has been output or will be output.
[0132] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0133] This application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor executes the computer program to implement the steps in any of the above method embodiments.
[0134] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0135] This application provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.
[0136] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0137] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0138] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0139] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0140] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0141] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. An instruction response method, characterized by, The application is applied to an electronic device supporting a Freertos operating system, and comprises: receiving a to-be-processed instruction; reading a file corresponding to the content of the to-be-processed instruction from a file system in memory, wherein the file system is stored in memory; responding to the to-be-processed instruction according to the file read from the memory; the reading of the file corresponding to the content of the to-be-processed instruction from the file system in memory comprises: determining the purpose of the to-be-processed instruction according to the content of the to-be-processed instruction, and determining the instruction type of the to-be-processed instruction according to the determined purpose; determining the file system corresponding to the to-be-processed instruction according to the instruction type of the to-be-processed instruction and a preset correspondence between instruction types and file systems; if the file system is a target file system, reading the file corresponding to the content of the to-be-processed instruction from the target file system in memory, wherein the target file system corresponds to an instruction type of an instruction that requires the electronic device to respond quickly.
2. The instruction response method of claim 1, wherein, further comprising: if the file system is not the target file system, reading a file index corresponding to the content of the to-be-processed instruction from the memory; reading the corresponding file from the flash memory according to the read file index; responding to the to-be-processed instruction according to the file read from the flash memory.
3. The instruction response method of claim 2, wherein, The target file system is initially stored in the flash memory, and the instruction response method further comprises: when the electronic device is started, reading the target file system stored in the flash memory to the memory.
4. The instruction response method of claim 3, wherein, the reading of the target file system stored in the flash memory to the memory when the electronic device is started comprises: when the path of starting the electronic device is a path of starting from the flash memory, reading the target file system stored in the flash memory to the memory.
5. The instruction response method of claim 3, wherein, further comprising: when the file is packaged, determining the file system corresponding to the file; if the file system corresponding to the file is the target file system, packaging the file of the target file system according to the data structure of the target file system after mounting; storing the packaged file in the flash memory.
6. The instruction response method of claim 5, wherein, the storing of the packaged file in the flash memory comprises: storing the packaged file, a check value corresponding to the packaged file, and a numerical value indicating the size of the packaged file in the flash memory; the reading of the target file system of the electronic device from the flash memory to the memory comprises: reading the file of the target file system from the flash memory to the memory according to the numerical value indicating the size of the file of the target file system; calculating the check value of the file of the target file system read to the memory to obtain a first check value; comparing the first check value with a second check value, if the first check value and the second check value are equal, assigning the file of the target file system read to the memory to a corresponding memory variable, wherein the second check value is a check value corresponding to the file of the target file system stored in the flash memory.
7. An instruction responding apparatus characterized by comprising: The application is applied to an electronic device supporting a Freertos operating system, and comprises: a to-be-processed instruction receiving module for receiving a to-be-processed instruction; The file reading module of the memory is configured to read a file corresponding to the content of the to-be-processed instruction from a file system stored in the memory; The first to-be-processed instruction response module is configured to respond to the to-be-processed instruction according to the file read from the memory; The file reading module of the memory comprises: The content of the to-be-processed instruction is determined, and the instruction type of the to-be-processed instruction is determined according to the determined use; The file system corresponding to the to-be-processed instruction is determined according to the instruction type of the to-be-processed instruction and a preset correspondence between instruction types and file systems. If the file system is a target file system, a file corresponding to the content of the to-be-processed instruction is read from the target file system of the memory, wherein the instruction type corresponding to the target file system is an instruction type corresponding to an instruction requiring rapid response of the electronic device.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method of any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program is executed by the processor to implement the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Method for reading Flash data based on set top box
CN104717557A
Information acquisition method and device, electronic equipment and computer storage medium
CN111241040A
File reading method and device
CN111782590A