CN114281724A - Data transmission method and device and electronic equipment - Google Patents

Data transmission method and device and electronic equipment Download PDF

Info

Publication number
CN114281724A
CN114281724A CN202111505935.1A CN202111505935A CN114281724A CN 114281724 A CN114281724 A CN 114281724A CN 202111505935 A CN202111505935 A CN 202111505935A CN 114281724 A CN114281724 A CN 114281724A
Authority
CN
China
Prior art keywords
data
stored
storage
storage area
transmission
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111505935.1A
Other languages
Chinese (zh)
Other versions
CN114281724B (en
Inventor
张秦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Oribo Technology Co Ltd
Original Assignee
Shenzhen Oribo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Oribo Technology Co Ltd filed Critical Shenzhen Oribo Technology Co Ltd
Priority to CN202111505935.1A priority Critical patent/CN114281724B/en
Publication of CN114281724A publication Critical patent/CN114281724A/en
Application granted granted Critical
Publication of CN114281724B publication Critical patent/CN114281724B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The application discloses a data transmission method, a data transmission device and electronic equipment, and relates to the technical field of data processing. The method is applied to a controller, the controller is connected with an external memory, the controller comprises an internal memory, the controller and the external memory carry out data transmission through a data bus, and the method comprises the following steps: when data to be stored is acquired, acquiring the current transmission state of a data bus; if the current transmission state is the transmission occupation state, acquiring data information of data currently transmitted by the data bus; if the data information meets a preset data condition, writing the data to be stored into an internal memory, wherein the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than the preset capacity; and when the current transmission state of the data bus is detected to be a transmission idle state, transmitting the data to be stored to an external memory for storage through the data bus. Therefore, the problem of data bus use conflict is avoided, and the storage of the data to be stored is completed in time.

Description

Data transmission method and device and electronic equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a data transmission method and apparatus, and an electronic device.
Background
In the development process of Internet of Things (IoT), in order to reduce hardware cost as much as possible, resources of a generally selected main control chip are often limited, for example, Memory spaces of a Read-Only Memory (ROM) and a Random Access Memory (RAM) inside the main control chip are limited. Because a large amount of data with different types and different capacities are often required to be stored in terms of product function requirements, in the related art, a hardware design structure with a memory chip (for example, a NOR Flash memory chip) mounted externally is generally adopted, and data operation is performed between a main control chip and the memory chip through a communication bus. The process of data operation through the communication bus cannot be interrupted, otherwise, the application function cannot be completed.
However, in practical applications, there may be multiple application functions that need to perform data operations through the communication bus at the same time, and the communication bus can only operate data of a single application function at the same time, so that a problem of data operation conflict occurs, and further some application functions cannot be completed.
Disclosure of Invention
In view of this, the present application provides a data transmission method, an apparatus and an electronic device.
In a first aspect, an embodiment of the present application provides a data transmission method, which is applied to a controller, where the controller is connected to an external memory, the controller includes an internal memory, and the controller and the external memory perform data transmission through a data bus, where the method includes: when data to be stored is acquired, acquiring the current transmission state of the data bus; if the current transmission state is a transmission occupation state, acquiring data information of data currently transmitted by the data bus, wherein the transmission occupation state is used for representing that the data bus is transmitting data; if the data information meets a preset data condition, writing the data to be stored into the internal memory, wherein the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than a preset capacity; and when the current transmission state of the data bus is detected to be a transmission idle state, transmitting the data to be stored to the external memory for storage through the data bus, wherein the transmission idle state is used for representing the data bus which is not transmitted currently.
In a second aspect, an embodiment of the present application provides a data transmission apparatus, which is applied to a controller, where the controller is connected to an external memory, the controller includes an internal memory, and the controller and the external memory perform data transmission through a data bus, where the apparatus includes: the device comprises a state acquisition module, an information acquisition module, a data storage module and a data transmission module. The state acquisition module is used for acquiring the current transmission state of the data bus when the data to be stored is acquired; the information acquisition module is used for acquiring data information of data currently transmitted by the data bus if the current transmission state is a transmission occupation state, wherein the transmission occupation state is used for representing that the data bus is transmitting data; the data storage module is used for writing the data to be stored into the internal memory if the data information meets a preset data condition, wherein the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than a preset capacity; and the data transmission module is used for transmitting the data to be stored to the external memory for storage through the data bus when the current transmission state of the data bus is detected to be a transmission idle state, and the transmission idle state is used for representing the data bus which is not currently transmitted with the data.
In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the data transfer method provided by the first aspect.
According to the scheme, when the data to be stored is obtained, the current transmission state of the data bus is obtained; if the current transmission state is the transmission occupation state, acquiring data information of data currently transmitted by the data bus; if the data information meets a preset data condition, writing the data to be stored into an internal memory, wherein the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than the preset capacity; and when the current transmission state of the data bus is detected to be a transmission idle state, transmitting the data to be stored to an external memory for storage through the data bus. Therefore, when the data bus is transmitting large-capacity data, the data to be stored can be written into the internal memory, the problem of data bus use conflict is avoided, the data to be stored can be stored in time, the storage requirement of the application function on the data can be completed in time, and the normal operation of the application function and the safety of the data to be stored are ensured; and after the data bus finishes transmitting the large-capacity data, the data to be stored is transmitted to the external memory through the data bus for storage, so that the use resource of the internal memory is saved, and the internal storage space and the running speed of the controller can be further ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating an application environment according to an embodiment of the present application.
Fig. 2 is a schematic flowchart illustrating a data transmission method according to an embodiment of the present application.
Fig. 3 is a schematic flowchart illustrating a data transmission method according to another embodiment of the present application.
Fig. 4 is a flowchart illustrating a data transmission method according to still another embodiment of the present application.
Fig. 5 is a flowchart illustrating a data transmission method according to still another embodiment of the present application.
Fig. 6 shows a flow diagram of the substeps of step S570 in fig. 5.
Fig. 7 is a flowchart illustrating a data transmission method according to still another embodiment of the present application.
Fig. 8 is a block diagram of a data transmission apparatus according to an embodiment of the present application.
Fig. 9 is a block diagram of an electronic device according to an embodiment of the present application for executing a data transmission method according to an embodiment of the present application.
Fig. 10 is a storage unit according to an embodiment of the present application, configured to store or carry program code for implementing a data transmission method according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
In the development process of Internet of Things (IoT), in order to reduce hardware cost as much as possible, resources of a generally selected main control chip are often limited, for example, Memory spaces of a Read-Only Memory (ROM) and a Random Access Memory (RAM) inside the main control chip are limited. Because of the functional requirements of products, a large amount of data of different types and different capacities often need to be stored, and therefore, in the related art, a hardware design structure with a memory chip (for example, a NOR Flash memory chip) mounted externally is generally adopted, and data operation is performed between a main control chip and the memory chip through a communication bus. The process of data operation through the communication bus cannot be interrupted, otherwise, the application function cannot be completed.
However, in practical applications, there may be multiple application functions that need to perform data operations through the communication bus at the same time, and the communication bus can only operate data of a single application function at the same time, so that a problem of data operation conflict occurs, and further some application functions cannot be completed.
In order to solve the above problems, the inventors propose a data transmission method, a data transmission device, and an electronic device, wherein when data to be stored is obtained, a current transmission state of a data bus is obtained, and if the current transmission state is a transmission occupation state and data being transmitted is large-capacity data, the data to be stored is written into an internal memory; and when the data bus is idle, transmitting the data to be stored to an external memory for storage. This is described in detail below.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an application environment provided in an embodiment of the present application, and a data transmission method provided in the embodiment of the present application may be applied to a data transmission system 10 shown in fig. 1. The data transmission system 10 may include a controller 110, an external memory 120, and a data bus 130. The controller 110 is connected to the external memory 120 through the data bus 130, and the controller 110 and the external memory 120 can perform data transmission based on the data bus 130, wherein the transmitted data includes, but is not limited to, text data, voice data, image data, instruction data, and the like.
The controller 110 may be understood as a main control chip, the controller 110 may include an internal Memory, the internal Memory may include a first Memory area and a second Memory area, the second Memory area may be understood as a RAM (Random Access Memory)111, the first Memory area may be understood as a ROM (Read-Only Memory)112, the RAM111 is an internal Memory that directly exchanges data with the CPU, can Read and write at any time, has a fast reading and writing speed, and is generally used to temporarily store programs, temporary data, and intermediate results; the ROM112 is also called a fixed memory, and is generally used to store various relatively stable fixed programs and data, and even if power is off, the data stored in the ROM112 is not changed.
In some embodiments, the RAM111 may be divided into an application RAM area and a dedicated RAM area, and the ROM112 may be divided into an application ROM area and a dedicated ROM area. The special RAM area is used for caching key data, and the key data can be understood as data which may need to be read and queried in real time in application; the dedicated ROM area is used for temporarily storing the generated data to be stored when the data bus 130 is in a transmission occupied state and the data currently being transmitted is large-capacity data.
Alternatively, the external memory 130 may also be divided into a large-capacity data area for storing functional data packets with large capacity, such as multimedia information like voice and video, and a small-capacity data area for storing functional data packets with small capacity, such as configuration information like fingerprints and passwords; when the data to be stored is large-capacity type data, the data to be stored is stored in a large-capacity data area of the external memory 130, and when the data to be stored is small-capacity type data, the data to be stored is stored in a small-capacity data area of the external memory 130.
In this manner, when the controller 110 detects that the data bus 130 is in the transmission idle state, the data to be stored temporarily stored in the dedicated ROM area may be transmitted to the external memory 120 through the data bus 130 for storage.
The data transmission system 10 may be deployed in electronic devices, including but not limited to smart home devices, smart control panels, smart phones, tablet computers, portable computers, desktop computers, wearable electronic devices, and the like; the smart home devices may be, for example, smart lamps, smart door locks, smart televisions, smart curtains, smart air conditioners, and the like, which is not limited in this embodiment.
Referring to fig. 2, fig. 2 is a schematic flow chart of a data transmission method according to an embodiment of the present application, and the data transmission method is applied to a controller, where the controller is connected to an external memory, the controller includes an internal memory, and the controller and the external memory perform data transmission through a data bus. The data transmission method provided by the embodiment of the present application will be described in detail below with reference to fig. 2. The data transmission method may include the steps of:
step S210: and when the data to be stored is acquired, acquiring the current transmission state of the data bus.
In this embodiment, taking the intelligent door lock as an example, the data to be stored may be data that needs to be stored and is generated by an application function running in a controller of the intelligent door lock, where the data includes, but is not limited to, fingerprint information, password information, voice information, image information, video information, and the like, and of course, the data to be stored may also be understood as operation instruction information, such as data writing operation instruction information for deleting a fingerprint, modifying a password, and the like. In order to save the storage space of the internal memory, the data to be stored may be transmitted to the external memory for storage through the data bus, but in practical applications, because the controller may simultaneously run other application functions, and the other application functions need to read and/or write data from the external memory, the data bus may be occupied, so that the data to be stored cannot be stored, and further, the application function cannot be normally completed, which affects the user experience.
Based on this, when the data to be stored is acquired, the current transmission state of the data bus can be further acquired, and then how to process the data to be stored is determined based on the current transmission state of the data bus. The transmission state comprises a transmission occupied state and a transmission idle state, the transmission occupied state represents that the data bus is transmitting data, and the transmission idle state represents that the data bus is not transmitting data currently.
Step S220: and if the current transmission state is a transmission occupation state, acquiring data information of data currently transmitted by the data bus, wherein the transmission occupation state is used for representing that the data bus is transmitting data.
Step S230: and if the data information meets a preset data condition, writing the data to be stored into the internal memory, wherein the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than a preset capacity.
In this embodiment, if the obtained current transmission state is a transmission occupied state, which represents that the data bus is transmitting data at this time, it is necessary to further determine how long the data transmission takes, so as to obtain data information of the data currently transmitted by the data bus, and determine whether the data information meets a preset data condition, so as to determine a data type of the data information, and determine whether to write the data to be stored into the internal memory for storage based on the data type. Wherein the data type includes large-capacity type data and small-capacity type data.
In some embodiments, it is determined whether the storage capacity occupied by the data information is greater than a preset capacity, and if so, it is determined that the data information is large-capacity type data, that is, the preset data condition is satisfied. Due to the fact that time consumption for transmitting the large-capacity type data is relatively long, if the data to be stored is transmitted to the external memory after the large-capacity type data is transmitted by the data bus, the time for waiting for transmission is long, the data cannot be stored in time, and therefore the current application function cannot be completed in time. The storage of the data is completed in time, which can be understood as that the storage of the data is completed in time within a time range in which the user cannot perceive the delay, for example, when the user submits and stores the password information, the password information is stored in time, and the prompt information is output to prompt the user that the storage is successful, that is, the time interval between the time when the user submits and stores the password information and the time when the user outputs the prompt information needs to be shorter than the time range in which the user perceives the delay, so that the smooth use experience of the user is ensured. Therefore, if the data information is large-capacity type data, the data to be stored can be written into the internal memory for temporary storage, so that when the data bus is occupied by the large-capacity type data, the data to be stored can be stored in time, and the current application function can be completed in time. Optionally, if the storage capacity occupied by the data information is less than or equal to the preset capacity, the data information is determined to be the small-capacity type data, that is, the preset data condition is not satisfied, and since the transmission time of the small-capacity type data is very short, the data to be stored can be written into the external memory through the data bus after the data bus finishes transmitting the small-capacity type data, so that the data storage can be completed within a time range in which a user cannot perceive the delay, and the timely completion of the current application function is ensured.
In other embodiments, the data type of the data information is obtained as the target data type; matching the target data type with a preset type corresponding to the high-capacity type data, if the matching is successful, judging that the data information is the high-capacity type data, namely meeting the preset data condition, and writing the data to be stored into an internal memory for temporary storage; if the matching fails, the data information is judged to be the small-capacity type data, and after the small-capacity type data is transmitted by the data bus, the data to be stored is directly transmitted to the external memory for storage through the data bus.
The data to be stored can be stored in a special ROM area in the internal memory, and the data temporarily stored in the special ROM area cannot be lost even if the power supply is cut off due to the nonvolatile property of the ROM. Therefore, when the data bus is occupied by the high-capacity type data, the data to be stored can be written into the internal memory in time for storage, and meanwhile, the storage safety is guaranteed.
Step S240: and when the current transmission state of the data bus is detected to be a transmission idle state, transmitting the data to be stored to the external memory for storage through the data bus, wherein the transmission idle state is used for representing the data bus which is not transmitted currently.
Based on this, after the data to be stored is written into the internal memory for temporary storage, the current transmission state of the data bus is continuously monitored, and when the current transmission state of the data bus is detected to be a transmission idle state, the data to be stored temporarily stored in the internal memory is synchronously transmitted to the external memory for storage through the data bus in time. Therefore, the use space of the internal memory can be timely vacated, the running speed of the controller is effectively guaranteed, and the problems of operation blockage and the like caused by insufficient memory of the internal memory can be avoided.
In some embodiments, when it is detected that the current transmission state of the data bus is a transmission idle state, a load task identifier of the controller is simultaneously obtained, where the load task identifier includes an idle task identifier and a busy task identifier, the busy task identifier represents a system load of the current controller, and the idle task identifier represents that the system load of the current controller has more application functions and the idle task identifier represents that the system load of the current controller is light and the application functions running at the same time are fewer. If the acquired load task identifier is an idle task identifier, synchronously transmitting the data to be stored temporarily stored in the internal memory to the external memory for storage through the data bus in time; if the obtained load task identifier is a busy task identifier, the obtained load task identifier represents the system load of the controller at the moment, if the controller synchronously transmits the data to be stored in the internal memory to the external memory through the data bus at the moment, the system load is increased, and other application functions can not be completed in time possibly, therefore, the current transmission state and the load task identifier of the data bus can be continuously detected, and when the data bus is in a transmission idle state and the load task identifier is an idle task identifier, the data to be stored in the internal memory is synchronously transmitted to the external memory through the data bus for storage. Therefore, the running speed of the controller is ensured while the data to be stored is synchronized to the external memory.
In this embodiment, when the data bus is transmitting large-capacity data, the data to be stored is written into the internal memory first, so that the problem of data bus use conflict is avoided, the data to be stored is stored in time, that is, the storage requirement of the application function on the data is completed in time, and the normal operation of the application function and the safety of the data to be stored are ensured; and after the data bus finishes transmitting the large-capacity data, the data to be stored is transmitted to the external memory through the data bus for storage, so that the use resource of the internal memory is saved, and the internal storage space and the running speed of the controller can be further ensured.
Referring to fig. 3, fig. 3 is a schematic flow chart of a data transmission method according to another embodiment of the present application, which is applied to a controller, where the controller is connected to an external memory, the controller includes an internal memory, the controller and the external memory perform data transmission through a data bus, and the internal memory includes a first storage area. The data transmission method provided by the embodiment of the present application will be described in detail below with reference to fig. 4. The data transmission method may include steps S310 to S350.
In the embodiment of the present application, steps S310 to S340 may refer to the contents of steps S210 to S240 in the foregoing embodiment, and are not described herein again.
Step S350: and deleting the data to be stored from the first storage area.
In this embodiment, the first storage area is a Read Only Memory (ROM), and when the data bus is currently in a transmission occupied state and data information of currently transmitted data meets a preset data condition, the read only memory with the storage data is written into the internal memory. When the data bus is in a transmission idle state and the data to be stored is transmitted from the read-only memory of the internal memory to the external memory, the data to be stored can be deleted from the read-only memory, so that the storage space in the internal memory is vacated in time, the used resources in the internal memory are saved, the problems of jamming and the like of the operation of the controller caused by over-small used resources in the internal memory are prevented, and the operation speed of the controller is ensured; in addition, the problem of repeated operation of re-reading the data transmitted to the external memory is avoided, the running load of the controller is reduced, and the running speed of the controller is improved.
In the embodiment, the data to be stored is deleted from the read-only memory, so that the use resources in the read-only memory are saved, and the running speed of the controller is ensured.
Referring to fig. 4, fig. 4 is a schematic flowchart of a data transmission method according to still another embodiment of the present application, which is applied to a controller, where the controller is connected to an external memory, the controller includes an internal memory, the controller and the external memory perform data transmission through a data bus, and the internal memory includes a first storage area and a second storage area. The data transmission method provided by the embodiment of the present application will be described in detail below with reference to fig. 4. The data transmission method may include steps S410 to S480.
In the embodiment of the present application, steps S410 to S440 and S480 can refer to the contents of steps S310 to S350 in the foregoing embodiment, which are not described herein again.
Step S450: and acquiring the calling identifier of the data to be stored.
Step S460: and judging whether the calling identifier is a high-frequency calling identifier, wherein the high-frequency calling identifier is used for representing that the called times of the data exceed the preset times.
Step S470: and if the calling identifier is the high-frequency calling identifier, writing the data to be stored into the second storage area.
In this embodiment, the first storage area is a Read Only Memory (ROM) in the internal memory, the second storage area is a Random Access Memory (RAM) in the internal memory, and the call identifier may include a high-frequency call identifier and a low-frequency call identifier, where the high-frequency call identifier indicates that the number of times of data calls exceeds a preset number of times, that is, when the controller runs the application function, the possibility of data calls is high; the low-frequency calling identification representation data is called for a number of times which does not exceed a preset number of times, namely the data is called less likely when the controller runs an application function.
Based on this, after the data to be stored is transmitted to the external memory for storage through the data bus, the calling identifier of the data to be stored can be further obtained, whether the calling identifier is a high-frequency calling identifier or not is judged, and if the calling identifier is judged to be the high-frequency calling identifier, the data to be stored in the ROM is written into the RAM, so that when the data to be stored is called later, the data to be stored can be called directly from the RAM without reading and calling from the external memory through the data bus. Because the speed of reading data from the external memory through the data bus is far less than the speed of directly reading data from the internal memory, the data to be stored of the high-frequency calling identifier is written into the RAM, the time length of data calling is reduced, the data calling efficiency is improved, and the response speed and the data processing efficiency of the controller are further improved.
Further, after the data to be stored is written into the second storage area, the data to be stored is deleted from the first storage area. Therefore, after the data to be stored with the calling identifier as the high-frequency calling identifier is written into the random access memory from the read only memory, the data to be stored can be deleted from the read only memory, the storage space in the read only memory is vacated in time, the use resources in the read only memory are saved, the problems that the controller runs and is blocked due to the fact that the use resources in the read only memory are too small are prevented, and the running speed of the controller is guaranteed; in addition, the problem of repeated operation of re-reading the data transmitted to the external memory is avoided, the running load of the controller is reduced, and the running speed of the controller is improved.
In some embodiments, when the controller detects power-on, all storage data in the external memory is acquired, wherein the storage data carries a call identifier; acquiring the storage data with the calling identifier being the high-frequency calling identifier in all the storage data as the data to be synchronized; and writing the data to be synchronized into the second storage area. Therefore, the process of power-on initialization of the controller can be summarized, and the high-frequency called storage data in the external memory is written into the random access memory in the internal memory as data to be synchronized, so that the data can be directly read from the random access memory in the internal memory during subsequent data reading, the data reading speed is improved, and the response processing efficiency of the controller is improved.
In the embodiment, the data to be stored of the high-frequency calling identifier in the ROM is synchronized to the RAM, so that the time length of data calling is reduced, the data calling efficiency is improved, and further, the response speed and the data processing efficiency of the controller are improved.
Referring to fig. 5, fig. 5 is a schematic flowchart of a data transmission method according to still another embodiment of the present application, applied to a controller, where the controller is connected to an external memory, the controller includes an internal memory, the controller and the external memory perform data transmission through a data bus, and the internal memory includes a first storage area and a second storage area. The data transmission method provided by the embodiment of the present application will be described in detail below with reference to fig. 5. The data transmission method may include steps S510 to S580.
In the embodiment of the present application, steps S510 to S540 and S580 may refer to the contents of steps S410 to S440 and S480 in the foregoing embodiment, which are not described herein again.
Step S550: and acquiring the available storage capacity in the second storage area.
Step S560: and judging whether the available storage capacity is larger than a preset capacity threshold value or not.
Step S570: and if the available storage capacity is larger than the preset capacity threshold, writing the data to be stored into the second storage area.
In this embodiment, after the data to be stored is transmitted to the external memory through the data bus for storage, it is determined whether the data to be stored can be written into the random access memory in the internal memory, and the determination may be performed based on the available storage capacity of the random access memory, and when the random access memory has enough available storage capacity, the data to be stored is written into the random access memory as much as possible, so as to improve the subsequent reading speed of the data to be stored, and further improve the operation processing speed of the controller.
Specifically, the available storage capacity of a designated area (dedicated RAM area) of the random access memory is acquired, whether the available storage capacity is greater than a preset capacity threshold is judged, and if the available storage capacity is greater than the preset capacity threshold, it represents that the available space of the dedicated RAM area is large at the moment, so that the data to be stored can be written into the dedicated RAM area of the random access memory for storage; if the available storage capacity is not greater than the preset capacity threshold, it represents that the available space of the dedicated RAM area is small at this time, and therefore, the data to be stored may not be written into the dedicated RAM area of the random access memory for storage. Or after determining that the available storage capacity is larger than the preset capacity threshold, further acquiring whether the calling identifier of the data to be stored is a high-frequency calling identifier, and if so, writing the data to be stored into a special RAM (random access memory) area of the random access memory for storage. The preset capacity threshold is preset, and may also be adjusted according to different application scenarios, which is not limited in this embodiment.
Therefore, whether the data to be stored is written into the random access memory is decided by combining the available storage capacity and the calling identifier of the data to be stored, so that the data to be stored is written into the random access memory as much as possible when the storage capacity is large, the subsequent data reading speed is improved, and the problems that the running speed of the controller is influenced due to insufficient storage capacity of the random access memory and the like can be avoided.
In some embodiments, the second storage area includes a dedicated storage area and an application storage area, referring to fig. 6, step S570 may include the following steps:
step S571: and detecting the occupancy rate of the special storage area and the occupancy rate of the application storage area.
Step S572: and when the occupancy rate of the special storage area exceeds a first preset proportion and the occupancy rate of the application storage area is smaller than a second preset proportion, expanding the storage capacity of the special storage area.
In this embodiment, the second storage area is a random access memory, the dedicated storage area is a dedicated RAM area, and the application storage area is an application RAM area. When writing data to be stored into the random access memory, the occupancy rate of the special RAM area and the occupancy rate of the application RAM area can be detected firstly; when the occupancy rate of the dedicated RAM area exceeds a first preset proportion (for example, 95%) and the occupancy rate of the application RAM area is less than a second preset proportion (for example, 60%), it is characterized that the amount of data stored in the dedicated RAM area is large at this time, the amount of data stored in the application RAM area is small, and the random access memory may have an excess space.
Step S573: and writing the data to be stored into the expanded special storage area.
Based on this, after the storage capacity of the special RAM area is expanded, the data to be stored is written into the expanded special RAM area, so that the data to be stored is smoothly written, meanwhile, the situations of write failure and the like caused by too small available storage space of the special RAM area are prevented, and the smooth completion of the application function in the controller is further ensured.
In this embodiment, the storage space of the access area is dynamically adjusted, and the data to be stored is written into the random access memory as much as possible, so as to increase the subsequent reading speed of the data to be stored, and further increase the running processing speed of the controller.
Referring to fig. 7, fig. 7 is a schematic flowchart of a data transmission method according to still another embodiment of the present application, which is applied to a controller, where the controller is connected to an external memory, the controller includes an internal memory, and the controller and the external memory perform data transmission through a data bus. The data transmission method provided by the embodiment of the present application will be described in detail below with reference to fig. 7. The data transmission method may include steps S610 to S650.
Step S610: and when the data to be stored is acquired, acquiring the current transmission state of the data bus.
Step S620: and if the current transmission state is a transmission occupation state, acquiring data information of data currently transmitted by the data bus, wherein the transmission occupation state is used for representing that the data bus is transmitting data.
In the embodiment of the present application, steps S610 to S620 may refer to the contents in the foregoing embodiments, and are not described herein again.
Step S630: and if the data information meets a preset data condition, adding a state identifier to the data to be stored, wherein the state identifier is used for representing whether the data to be stored is successfully and synchronously transmitted to the external memory, and the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than a preset capacity.
Step S640: and temporarily storing the data to be stored added with the state identifier in the internal memory.
In this embodiment, before the data to be stored is temporarily stored in the internal memory, the state identifier may be added to the data to be stored, and then the data to be stored to which the state identifier has been added is temporarily stored in the internal memory. The state identifier includes a completion state identifier and an incomplete state identifier, the completion state identifier represents that the data to be stored has been completed and synchronously transmitted to the external memory through the data bus, and the incomplete identifier represents that the data to be stored has not been completed and synchronously transmitted to the external memory through the data bus (for example, the data to be stored is not started to be transmitted or the data to be stored is being transmitted). Therefore, even if the controller is powered on again after the power supply is cut off, the subsequent process of synchronously transmitting the data to the external memory can be continuously completed according to the state identifier carried by the data stored in the internal memory.
In some embodiments, when power-on is detected, all data stored in the internal memory is read as first stored data; acquiring first storage data with state identification as unfinished identification as second storage data; and transmitting the second storage data to the external memory for storage. Furthermore, the first storage data with the state identification as the completion state identification can be deleted, and the second storage data transmitted to the external memory can be deleted from the internal memory, so that the use resources in the internal memory are saved, the problems of the operation jam and the like of the controller caused by the overhigh occupancy rate in the internal memory are prevented, and the operation speed of the controller is ensured.
Step S650: and when the current transmission state of the data bus is detected to be a transmission idle state, transmitting the data to be stored to the external memory for storage through the data bus, wherein the transmission idle state is used for representing the data bus which is not transmitted currently.
In the embodiment of the present application, step S650 may refer to the contents in the foregoing embodiments, and is not described herein again.
In this embodiment, before the data to be stored is temporarily stored in the internal memory, the state identifier is added to the data to be stored, and then the data to be stored to which the state identifier has been added is temporarily stored in the internal memory. Therefore, even if the controller is powered off and then powered on again, the subsequent process of synchronously transmitting the data to be stored to the external memory can be continuously realized according to the state identifier carried by the data stored in the internal memory.
Referring to fig. 8, a block diagram of a data transmission device 700 according to an embodiment of the present application is shown. The apparatus 700 is applied to a controller, the controller is connected with an external memory, the controller includes an internal memory, and the controller and the external memory perform data transmission through a data bus, and may include: a status acquisition module 710, an information acquisition module 720, a data storage module 730, and a data transmission module 740.
The state obtaining module 710 is configured to obtain a current transmission state of the data bus when obtaining data to be stored.
The information obtaining module 720 is configured to obtain data information of data currently transmitted by the data bus if the current transmission state is a transmission occupied state, where the transmission occupied state is used to represent that the data bus is transmitting data.
The data storage module 730 is configured to write the data to be stored into the internal memory if the data information meets a preset data condition, where the preset data condition is used to represent that a storage capacity occupied by the currently transmitted data is greater than a preset capacity.
The data transmission module 740 is configured to transmit the data to be stored to the external memory through the data bus for storage when detecting that the current transmission state of the data bus is a transmission idle state, where the transmission idle state is used to represent that the data bus does not transmit data currently.
In some embodiments, the internal memory includes a first storage area, and the data transmission apparatus 700 may further include: and deleting the module. The deleting module may be configured to delete the data to be stored from the first storage area after the data to be stored is transmitted to the external memory through the data bus for storage. The data storage module 730 may be specifically configured to, if the data information meets the preset data condition, write the data to be stored into the first storage area in the internal memory.
In this manner, the internal memory further includes a second storage area, and the data transmission device 700 further includes: the device comprises an identification acquisition module, a first judgment module and a data writing module. The identifier obtaining module may be configured to obtain a calling identifier of the data to be stored before the data to be stored is deleted from the first storage area. The first judging module may be configured to judge whether the call identifier is a high-frequency call identifier, where the high-frequency call identifier is used to indicate that the number of times that data is called exceeds a preset number of times. The data writing module may be configured to write the data to be stored into the second storage area if the call identifier is the high-frequency call identifier.
In this manner, the internal memory further includes a second storage area, and the data transmission device 700 further includes: the device comprises a capacity acquisition module, a second judgment module and a data writing module. The capacity obtaining module may be configured to obtain an available storage capacity in the second storage area before the data to be stored is deleted from the first storage area. The second determining module may be configured to determine whether the available storage capacity is greater than a preset capacity threshold. The data writing module may be configured to write the data to be stored into the second storage area if the available storage capacity is greater than the preset capacity threshold.
In some embodiments, the internal memory includes a second storage area, and the data transmission apparatus 700 may further include: the device comprises a data acquisition module, a to-be-synchronized data acquisition module and a data writing module. The data obtaining module may be configured to obtain all storage data in the external memory when power-on is detected before obtaining a current transmission state of the data bus when the data to be stored is obtained, where the storage data carries a call identifier. The data to be synchronized acquiring module may be configured to acquire, as the data to be synchronized, the storage data of which the call identifier is a high-frequency call identifier in all the storage data, where the high-frequency call identifier is used to indicate that the number of times that the data is called reaches a preset number of times. The data writing module may be configured to write the data to be synchronized into the second storage area.
In some embodiments, the second storage area includes a dedicated storage area and an application storage area, and the data writing module may include: an occupancy rate detection unit, a capacity expansion unit and a data writing unit. The occupancy detection unit may be configured to detect an occupancy of the dedicated storage area and an occupancy of the application storage area. The capacity expansion unit may be configured to expand the storage capacity of the dedicated storage area when the occupancy rate of the dedicated storage area exceeds a first preset ratio and the occupancy rate of the application storage area is less than a second preset ratio. The data writing unit may be configured to write the data to be stored into the expanded dedicated storage area.
In some embodiments, the data storage module 730 may include: an identification adding unit and a data storage unit. The identifier adding unit may be configured to add a state identifier to the data to be stored, where the state identifier is used to characterize whether the data to be stored has been successfully and synchronously transmitted to the external memory. The data storage unit may be configured to temporarily store the data to be stored to which the state identifier has been added in the internal memory.
In this manner, the status flag includes an incomplete flag, and the data transmission apparatus 700 may further include: the device comprises a data reading module, a second storage data acquisition module and a second storage data transmission module. The data reading module may be configured to read all data stored in the internal memory as first storage data when power-on is detected. The second storage data obtaining module may be configured to obtain the first storage data of which the status identifier is the incomplete identifier as the second storage data. The second storage data transmission module may be configured to transmit the second storage data to the external memory for storage.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
An electronic device provided by the present application will be described below with reference to the drawings.
Referring to fig. 9, fig. 9 is a block diagram illustrating a structure of an electronic device 800 according to an embodiment of the present application, where the electronic device 800 may execute a data transmission method according to the embodiment of the present application.
The electronic device 800 in embodiments of the present application may include one or more of the following components: a processor 801, a memory 802, and one or more applications, wherein the one or more applications may be stored in the memory 802 and configured to be executed by the one or more processors 801, the one or more programs configured to perform a method as described in the aforementioned method embodiments.
The processor 801 may include one or more processing cores. The processor 801 interfaces with various components throughout the electronic device 800 using various interfaces and circuitry to perform various functions of the electronic device 800 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 802 and invoking data stored in the memory 802. Alternatively, the processor 801 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 801 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is to be understood that the modem may also be integrated into the processor 801, and implemented solely by a communication chip.
The Memory 802 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 802 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 802 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The data storage area may also store data created by the electronic device 800 during use (such as the data to be stored described above), and the like.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, the coupling or direct coupling or communication connection between the modules shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or modules may be in an electrical, mechanical or other form.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
Referring to fig. 10, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 900 has stored therein program code that can be called by a processor to perform the methods described in the above-described method embodiments.
The computer-readable storage medium 900 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 900 includes a non-transitory computer-readable storage medium. The computer readable storage medium 900 has storage space for program code 910 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 910 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A data transmission method is applied to a controller, the controller is connected with an external memory, the controller comprises an internal memory, and the controller and the external memory perform data transmission through a data bus, and the method comprises the following steps:
when data to be stored is acquired, acquiring the current transmission state of the data bus;
if the current transmission state is a transmission occupation state, acquiring data information of data currently transmitted by the data bus, wherein the transmission occupation state is used for representing that the data bus is transmitting data;
if the data information meets a preset data condition, writing the data to be stored into the internal memory, wherein the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than a preset capacity;
and when the current transmission state of the data bus is detected to be a transmission idle state, transmitting the data to be stored to the external memory for storage through the data bus, wherein the transmission idle state is used for representing the data bus which is not transmitted currently.
2. The method of claim 1, wherein the internal memory includes a first storage area, and the writing the data to be stored into the internal memory if the data information satisfies a predetermined data condition includes:
if the data information meets the preset data condition, writing the data to be stored into the first storage area in the internal memory;
after the transmitting the data to be stored into the external memory for storage through the data bus, the method further comprises:
and deleting the data to be stored from the first storage area.
3. The method according to claim 2, wherein the internal memory further comprises a second storage area, and before the deleting the data to be stored from the first storage area, the method further comprises:
acquiring a calling identifier of the data to be stored;
judging whether the calling identification is a high-frequency calling identification, wherein the high-frequency calling identification is used for representing that the called times of the data exceed preset times;
and if the calling identifier is the high-frequency calling identifier, writing the data to be stored into the second storage area.
4. The method according to claim 2, wherein the internal memory further comprises a second storage area, and before the deleting the data to be stored from the first storage area, the method further comprises:
acquiring available storage capacity in the second storage area;
judging whether the available storage capacity is larger than a preset capacity threshold value or not;
and if the available storage capacity is larger than the preset capacity threshold, writing the data to be stored into the second storage area.
5. The method according to claim 1, wherein the internal memory includes a second storage area, and before the acquiring the current transmission state of the data bus when the data to be stored is acquired, the method further comprises:
when power-on is detected, all storage data in the external memory are obtained, wherein the storage data carry a calling identifier;
acquiring the storage data of which the calling identifier is a high-frequency calling identifier in all the storage data as data to be synchronized, wherein the high-frequency calling identifier is used for representing that the number of times of calling the data reaches a preset number of times;
and writing the data to be synchronized into the second storage area.
6. The method according to any one of claims 3 to 5, wherein the second storage area comprises a dedicated storage area and an application storage area, and the writing the data to be stored into the second storage area comprises:
detecting the occupancy rate of the special storage area and the occupancy rate of the application storage area;
when the occupancy rate of the special storage area exceeds a first preset proportion and the occupancy rate of the application storage area is smaller than a second preset proportion, carrying out capacity expansion on the storage capacity of the special storage area;
and writing the data to be stored into the expanded special storage area.
7. The method according to any one of claims 1 to 5, wherein the writing the data to be stored into the internal memory comprises:
adding a state identifier to the data to be stored, wherein the state identifier is used for representing whether the data to be stored is successfully and synchronously transmitted to the external memory;
and temporarily storing the data to be stored added with the state identifier in the internal memory.
8. The method of claim 7, wherein the status flag comprises an incomplete flag, the method further comprising:
when power-on is detected, reading all data stored in the internal memory as first storage data;
acquiring first storage data with the state identification as an unfinished identification as second storage data;
and transmitting the second storage data to the external memory for storage.
9. A data transmission apparatus applied to a controller, the controller being connected to an external memory, the controller including an internal memory, the controller and the external memory performing data transmission via a data bus, the apparatus comprising:
the state acquisition module is used for acquiring the current transmission state of the data bus when the data to be stored is acquired;
the information acquisition module is used for acquiring data information of data currently transmitted by the data bus if the current transmission state is a transmission occupation state, wherein the transmission occupation state is used for representing that the data bus is transmitting data;
the data storage module is used for writing the data to be stored into the internal memory if the data information meets a preset data condition, wherein the preset data condition is used for representing that the storage capacity occupied by the currently transmitted data is larger than a preset capacity;
and the data transmission module is used for transmitting the data to be stored to the external memory for storage through the data bus when the current transmission state of the data bus is detected to be a transmission idle state, and the transmission idle state is used for representing the data bus which is not currently transmitted with the data.
10. An electronic device, comprising:
one or more processors;
a memory;
one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-8.
CN202111505935.1A 2021-12-10 2021-12-10 Data transmission method and device and electronic equipment Active CN114281724B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111505935.1A CN114281724B (en) 2021-12-10 2021-12-10 Data transmission method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111505935.1A CN114281724B (en) 2021-12-10 2021-12-10 Data transmission method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN114281724A true CN114281724A (en) 2022-04-05
CN114281724B CN114281724B (en) 2024-01-02

Family

ID=80871625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111505935.1A Active CN114281724B (en) 2021-12-10 2021-12-10 Data transmission method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114281724B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117234977A (en) * 2023-11-10 2023-12-15 浪潮电子信息产业股份有限公司 Data processing method, system, device and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140129766A1 (en) * 2012-11-08 2014-05-08 Qualcomm Incorporated Intelligent dual data rate (ddr) memory controller
CN109669897A (en) * 2017-10-13 2019-04-23 华为技术有限公司 Data transmission method and device
CN110377235A (en) * 2019-07-26 2019-10-25 Oppo(重庆)智能科技有限公司 Data processing method, device, mobile terminal and computer readable storage medium
CN110753001A (en) * 2019-10-25 2020-02-04 珠海格力电器股份有限公司 Method and device for efficiently transmitting data and storage medium
CN111107123A (en) * 2018-10-29 2020-05-05 杭州海康威视数字技术股份有限公司 Method and device for continuous transmission in broken network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140129766A1 (en) * 2012-11-08 2014-05-08 Qualcomm Incorporated Intelligent dual data rate (ddr) memory controller
CN109669897A (en) * 2017-10-13 2019-04-23 华为技术有限公司 Data transmission method and device
CN111107123A (en) * 2018-10-29 2020-05-05 杭州海康威视数字技术股份有限公司 Method and device for continuous transmission in broken network
CN110377235A (en) * 2019-07-26 2019-10-25 Oppo(重庆)智能科技有限公司 Data processing method, device, mobile terminal and computer readable storage medium
CN110753001A (en) * 2019-10-25 2020-02-04 珠海格力电器股份有限公司 Method and device for efficiently transmitting data and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117234977A (en) * 2023-11-10 2023-12-15 浪潮电子信息产业股份有限公司 Data processing method, system, device and computer readable storage medium
CN117234977B (en) * 2023-11-10 2024-02-27 浪潮电子信息产业股份有限公司 Data processing method, system, device and computer readable storage medium

Also Published As

Publication number Publication date
CN114281724B (en) 2024-01-02

Similar Documents

Publication Publication Date Title
US10895987B2 (en) Memory compression method of electronic device and apparatus thereof
WO2021057619A1 (en) Memory reclamation method and apparatus, electronic device, and storage medium
CN110784858B (en) Bluetooth device control method and device, electronic device and storage medium
WO2018103401A1 (en) Wireless fidelity wi-fi scanning method and related product
CN110932994B (en) Data traffic processing method and device, electronic equipment and storage medium
CN110765031B (en) Data storage method and device, mobile terminal and storage medium
CN110888746A (en) Memory management method and device, storage medium and electronic equipment
CN109213596B (en) Method and equipment for allocating terminal memory
CN107426113B (en) Message receiving method and network equipment
CN109725543B (en) Equipment control code configuration method and device, cloud server and network system
US11010094B2 (en) Task management method and host for electronic storage device
WO2021057623A1 (en) Memory recovery method and apparatus, electronic device and storage medium
CN114281724B (en) Data transmission method and device and electronic equipment
CN114175748B (en) Communication frequency adjusting method, device, electronic equipment and storage medium
CN110602772A (en) WiFi module control method, control device, electronic device and storage medium
CN111970749A (en) Network connection method and device, intelligent household equipment and intelligent household system
CN109511139B (en) WIFI control method and device, mobile device and computer-readable storage medium
CN111078587A (en) Memory allocation method and device, storage medium and electronic equipment
CN115421907A (en) Memory recovery method and device, electronic equipment and storage medium
CN115587049A (en) Memory recovery method and device, electronic equipment and storage medium
CN113138852A (en) Resource loading method and device, chip and electronic equipment
CN114024878A (en) Data transmission method, device, medium and equipment
WO2021072760A1 (en) Touch screen reporting method and apparatus, electronic device, and storage medium
CN115002941B (en) Communication method of Bluetooth electric energy meter
CN114125941B (en) Data packetizing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant