A data transmission method based on a cache structure

By introducing a caching structure and a handshake mechanism during data transmission, the problems of excessive memory capacity and CPU processing speed are solved, achieving efficient and stable data transmission and maximizing the utilization of hardware resources.

CN116318534BActive Publication Date: 2026-05-05XIAN AVIATION COMPUTING TECH RES INST OF AVIATION IND CORP OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIAN AVIATION COMPUTING TECH RES INST OF AVIATION IND CORP OF CHINA
Filing Date
2022-12-15
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In the current technology, the direct transmission method during data transmission results in excessive requirements for memory capacity and CPU processing speed. Furthermore, when transmitting multiple packets, there are issues of hardware waste or low-level blocking, which affect the success rate and efficiency of transmission.

Method used

A data transmission method based on a cache structure is adopted. By setting up caches in the sending and receiving storage areas and establishing a connection through a handshake mechanism, the number of data packets allowed to be sent at one time is calculated to ensure that data is sent only after it has been updated. The cache structure is used to control the timing of writing, thereby improving the data transmission rate and stability.

Benefits of technology

It improves the success rate and efficiency of data transmission, maximizes the use of hardware space resources, reduces the requirements for memory capacity and CPU processing speed, and ensures efficient and stable data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116318534B_ABST
    Figure CN116318534B_ABST
Patent Text Reader

Abstract

This application provides a data transmission method based on a cache structure, belonging to the field of computer communication technology. Specifically, a sending buffer is set in the sending storage area of ​​the file to be sent, and a receiving buffer is set in the receiving storage area. The method checks whether the data to be sent has been updated; if updated, it is sent by writing the file to be sent into the sending buffer or sending it directly to the receiving storage area. A handshake mechanism is used to establish a link between the sending storage area and the receiving storage area of ​​the file to be sent, and the number of data packets allowed to be sent at one time is calculated. The file to be sent is sent to the receiving buffer, and the receiving storage area receives the file after confirming that the flag of the file to be sent in the receiving buffer matches. This processing scheme improves sending efficiency while maximizing the utilization of memory space resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer communications, and in particular to a data transmission method based on a cache structure. Background Technology

[0002] During communication, data transmission rate and stability are two key factors in evaluating communication.

[0003] Currently, direct transmission is used in communication, but this method places excessive demands on memory capacity and CPU processing speed. When transmitting data to the underlying layer, two factors affect the success rate:

[0004] 1. In multi-packet transmission, the calculation method for "the number of data packets allowed to be sent at one time" when unpacking; too few packets result in hardware waste and cannot make the best use of hardware resources; too many packets cause underlying blocking, packet loss, and other situations.

[0005] 2. When transmitting data to the underlying layer, the algorithm needs to consider flow control to avoid blockage caused by the inability to retrieve data in a timely manner. Summary of the Invention

[0006] In view of this, this application provides a data transmission method based on a cache structure, which solves the problems in the prior art, improves transmission efficiency, and maximizes the use of memory space resources.

[0007] The data transmission method based on a cache structure provided in this application adopts the following technical solution:

[0008] A data transmission method based on a cache structure includes the following steps:

[0009] A sending buffer is set in the sending storage area of ​​the file to be sent, and a receiving buffer is set in the receiving storage area;

[0010] Check if the data to be sent has been updated. Once updated, send the data by writing the file to be sent to the sending buffer or sending it directly to the receiving storage area.

[0011] A handshake mechanism is used to establish a link between the sending and receiving storage areas of the file to be sent, and the number of data packets allowed to be sent at one time is calculated.

[0012] The file to be sent is sent to the receive buffer. The receive storage area receives the file after confirming that the flag of the file to be sent in the receive buffer matches.

[0013] Optionally, check whether the data to be sent has been updated. The steps for sending after the update is complete include: before writing the data to be sent in the first data field to the buffer or bus, ensure that its content has been updated. Set a flag to indicate whether the data to be sent in the first data field is being updated. If it is being updated, wait for a set time to complete the update before reading the data. If the update is complete, read the data immediately.

[0014] Optionally, the steps for calculating the number of packets allowed to be sent at one time include:

[0015] For data transfer between modules, a link is first established, and then the number of data packets allowed to be sent at one time is calculated based on the information provided by establishing the link.

[0016] Optionally, when the communication method is node-based transmission, the number of data packets allowed to be sent at one time is the minimum of the remaining space in the sending buffer, the number of remaining data packets, and the number of data packets set by the system.

[0017] Optionally, when the communication method is frame-based transmission, the number of data packets allowed to be sent at one time is the smallest of the remaining space in the transmission buffer, the number of remaining data packets, and the number of data packets defined by the manufacturer.

[0018] Optionally, writing the file to be sent to the send buffer or sending it directly to the receive storage area includes the following steps: First, determine whether the send buffer is full. If it is full, clear it. If there is remaining space in the send buffer-send circular queue, determine whether the data can be written to the bus. If it can, write the data directly to the bus. If it cannot, temporarily write the data to the send buffer, wait for the bus to be idle, and then write it to the bus for transmission.

[0019] Optionally, the file to be sent is sent to the receiving buffer. After the receiving storage area confirms that the flag of the file to be sent in the receiving buffer matches, it receives the file. Specifically, this includes: first, determining whether the receiving buffer - the receiving circular queue is full. The method of determination is to calculate the remaining space of the receiving circular queue. If the remaining space is 0, it means that the receiving circular queue is full and is cleared; otherwise, the data is stored in the receiving circular queue and waits for the periodic task to poll and access it.

[0020] In summary, this application includes the following beneficial technical effects:

[0021] By adding a level-one cache structure and using corresponding flags to control its write timing, data transfer rates and stability are improved. This ensures high success rates for transmission and reduces the excessive demands on memory capacity and CPU processing speed imposed by direct transmission. It maximizes the utilization of hardware space resources while improving transmission efficiency. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a schematic diagram of the overall process of the data transmission method based on the cache structure in this application;

[0024] Figure 2 This is a flowchart illustrating the data storage process for sending data in this application;

[0025] Figure 3 A flowchart illustrating the process of sending the buffer for this application;

[0026] Figure 4 This is a schematic diagram of the packet unpacking algorithm used in the transmission process of this application;

[0027] Figure 5 This is a schematic diagram of the process for receiving the buffer area in this application. Detailed Implementation

[0028] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0029] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. This application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be based on different...

[0030] The same viewpoints and applications may be modified or altered in various ways without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features described herein can be combined with each other. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0031] It should be noted that the following description covers various aspects of embodiments within the scope of the appended claims. It will be apparent that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this application, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects set forth herein can be used to implement the apparatus and / or practice. Additionally, aspects other than those set forth herein can be used...

[0032] Other structures and / or functionalities besides one or more of the aspects may be used to implement this device and / or practice this method. 5 It should also be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show components related to this application and are not drawn according to the actual number, shape, and size of the components in the actual implementation. In the actual implementation, the type, quantity, and proportion of each component may be arbitrarily changed, and the component layout may also be more complex.

[0033] Furthermore, specific details are provided in the following description to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that the described aspects can be practiced without these specific details.

[0034] This application provides a data transmission method based on a cache structure.

[0035] like Figure 1 As shown, a data transmission method based on a cache structure includes the following steps:

[0036] A sending buffer is set in the sending storage area of ​​the file to be sent, and a receiving buffer is set in the receiving storage area;

[0037] Check if the data to be sent has been updated. Once updated, send the data by writing the file to be sent to the sending buffer or sending it directly to the receiving storage area.

[0038] A handshake mechanism is used to establish a link between the sending and receiving storage areas of the file to be sent, and the number of data packets allowed to be sent at one time is calculated.

[0039] The file to be sent is sent to the receive buffer. After confirming that the flag of the file to be sent in the receive buffer matches, the receive buffer receives the file. Reception is an asynchronous event; the data received from the bus is temporarily stored in the buffer, waiting for the device module to receive it.

[0040] Data transfer rate and stability are improved by adding a level-one cache. This ensures a high success rate for transmission and reduces the excessive demands on memory capacity and CPU processing speed imposed by direct transmission. While improving transmission efficiency, it also maximizes the utilization of hardware space resources.

[0041] The steps for checking whether the data to be sent has been updated and then sending it after the update is complete include: before writing the data to be sent in the first data field to the buffer or bus, it must be ensured that its content has been updated. A flag is set to indicate whether the data to be sent in the first data field is being updated. If it is being updated, a set time must be waited for it to be updated before the data can be read. If the update is complete, the data can be read immediately.

[0042] In one embodiment, the process for sending the storage area is as follows:

[0043] like Figure 2 As shown, TransArea is the area for sending data, and its flag is TransArea.FLAG.

[0044] Before writing data from TransArea to the buffer or bus, ensure its contents have been completely updated. If updating is in progress, set a wait; if a timeout occurs, activate TransArea.FLAG and then set it to null.

[0045] When reading data from the TransArea region, set TransArea.FLAG to ensure its content remains unchanged.

[0046] After reading the data in the TransArea region, activate TransArea.FLAG and then set it to null.

[0047] During transmission, the timing of data transmission directly affects the success rate and efficiency. Before writing the data to be transmitted into the transmission buffer structure or directly onto the bus, it is essential to ensure that the data in the transmission data storage area is ready for transmission. According to the software implementation of this algorithm, Figure 1 Ensure that the data is complete and reliable before it is sent.

[0048] like Figure 3As shown, writing a file to be sent to the transmit buffer or sending it directly to the receive storage area involves the following steps: First, determine if the transmit buffer is full. If it is full, clear it. If there is remaining space in the transmit buffer-transmit circular queue, determine if the data can be written to the bus. If yes, write the data directly to the bus; otherwise, temporarily write the data to the transmit buffer, wait for the bus to become idle, and then write it to the bus for transmission. Adding a buffer structure—the transmit circular queue—before writing the data to the bus for transmission improves transmission efficiency and reduces the real-time storage capacity requirements. This type of bus must confirm its idle status before writing data. For example, in the CAN bus, when the underlying bus is transmitting, data is temporarily written to the transmit buffer and queued. When the bus becomes idle, the data is written to the bus for transmission. This circular queue data structure not only avoids false overflows but also allows excess space in the array to be used for further operations.

[0049] During transmission, the number of data packets sent at one time directly determines the transmission efficiency. Too many packets will cause underlying data packet blocking and packet loss; too few packets will result in hardware waste.

[0050] Communication methods include two types: node-based transmission and frame-based transmission. Node-based transmission only involves communication between two nodes, with other nodes not participating. Frame-based transmission involves a node sending a parameter group message containing one or more parameters to all nodes in the network, which is a broadcast transmission method.

[0051] like Figure 4 As shown, the steps for calculating the number of data packets allowed to be sent at once include: for data transfer between modules, firstly, a link is established, and then the number of data packets allowed to be sent at once is calculated based on the information provided by establishing the link. First, a link is established through a "handshake" mechanism, and then the number of data packets allowed to be sent at once is calculated according to the different communication methods.

[0052] When the communication method is node-based transmission, the number of data packets that can be sent at one time is the minimum of the remaining space in the sending buffer, the number of remaining data packets, and the number of data packets set by the system.

[0053] In one embodiment, A_P2P: the number of remaining data packets ("the maximum number of data packets that can be sent" - "the number of the next data packet to be sent" + 1);

[0054] B_P2P: Send buffer - the remaining space in the send circular queue;

[0055] C_P2P: The system sets the number of data packets to 9 (the maximum number of data packets that can be sent is usually set to a fixed value. However, in specific implementation systems, this value will be adjusted according to the hardware).

[0056] The number of data packets allowed to be sent at one time = min(A_P2P, B_P2P-5, C_P2P).

[0057] When the communication method is frame-based transmission, the number of data packets that can be sent at one time is the smallest of the remaining space in the send buffer, the number of remaining data packets, and the number of data packets defined by the manufacturer.

[0058] In one embodiment, A_BroadCast: the number of remaining data packets ("maximum data packet number that can be sent" - "next data packet number to be sent" + 1);

[0059] B_BroadCast: Send buffer - remaining space in the send circular queue;

[0060] C_BroadCast: -- Manufacturer-defined: C_BroadCast = 9;

[0061] --Non-manufacturer custom: C_BroadCast=1.

[0062] The number of data packets allowed to be sent at one time = min(A_BroadCast, B_BroadCast-5, C_BroadCast).

[0063] like Figure 5 As shown, the file to be sent is sent to the receive buffer. The receive storage area confirms that the flag of the file to be sent in the receive buffer matches before receiving the file. Specifically, this includes: first, determining whether the receive buffer—the receive circular queue—is full. This is done by calculating the remaining space in the receive circular queue. If the remaining space is 0, it means the receive circular queue is full and is cleared; otherwise, the data is stored in the receive circular queue, waiting for periodic task polling. Data received on the bus is then stored in the receive buffer. Receiving in communication is an asynchronous event; the receiving process involves storing data on the bus in the receive buffer and then periodically accessing it to receive the data.

[0064] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data transmission method based on a cache structure, characterized in that, Includes the following steps: A sending buffer is set in the sending storage area of ​​the file to be sent, and a receiving buffer is set in the receiving storage area; Check if the data to be sent has been updated. Once updated, send the data by writing the file to be sent to the sending buffer or sending it directly to the receiving storage area. A handshake mechanism is used to establish a link between the sending and receiving storage areas of the file to be sent, and the number of data packets allowed to be sent at one time is calculated. The file to be sent is sent to the receive buffer. The receive storage area receives the file after confirming that the flag of the file to be sent in the receive buffer matches. When the communication method is node-based transmission, the number of data packets that can be sent at one time is the minimum value among the remaining space in the sending buffer, the number of remaining data packets, and the number of data packets set by the system. When the communication method is frame-based transmission, the number of data packets that can be sent at one time is the minimum value among the remaining space in the send buffer, the number of remaining data packets, and the number of data packets defined by the manufacturer. Writing the file to be sent to the send buffer or sending it directly to the receive storage area involves the following steps: First, determine if the send buffer is full. If it is full, clear it. If there is remaining space in the send buffer - send circular queue, determine if the data can be written to the bus. If it can, write the data directly to the bus. If not, the data will be temporarily written to the transmit buffer and sent after the bus becomes idle. The file to be sent is sent to the receive buffer. After the receive storage area confirms that the flag of the file to be sent in the receive buffer matches, it receives the file. Specifically, it includes: first, determining whether the receive buffer - receive circular queue is full. The method of determination is to calculate the remaining space of the receive circular queue. If the remaining space is 0, it means that the receive circular queue is full and is cleared; otherwise, the data is stored in the receive circular queue and waits for the periodic task to poll and access it.

2. The data transmission method based on a cache structure according to claim 1, characterized in that, The steps for checking whether the data to be sent has been updated and then sending it after the update is complete include: before writing the data to be sent in the first data field to the buffer or bus, it must be ensured that its content has been updated. A flag is set to indicate whether the data to be sent in the first data field is being updated. If it is being updated, a set time must be waited for it to be updated before the data can be read. If the update is complete, the data can be read immediately.

3. The data transmission method based on a cache structure according to claim 1, characterized in that, The steps for calculating the number of data packets allowed to be sent at one time include: For data transfer between modules, a link is first established, and then the number of data packets allowed to be sent at one time is calculated based on the information provided by establishing the link.

Citation Information

Patent Citations

  • Cache data loss prevention method, FIFO memory, computer readable storage medium and computer equipment

    CN115357183A