Method and apparatus for transmitting data by a multi-channel interface
By using a continuous FIFO address space and a data processing thread priority mechanism in an embedded real-time system, the problem of data loss in high-speed data reception and storage of multi-channel interfaces is solved, enabling fast data processing and storage, reducing costs, and ensuring data integrity and security.
Patent Information
- Application Number
- CN202311148369.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-07
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-09-07
AI Technical Summary
Embedded real-time systems cannot simultaneously receive, process, and store data sent from multiple high-speed interfaces at intervals of 1 millisecond, resulting in data loss.
By defining several consecutive FIFO address spaces in memory, each corresponding to a different data transmission interface, data is received and encrypted in real time. This data, along with the reception time, forms a storage log and is stored on the hard drive of the PCIe interface. By utilizing the fact that the data processing thread has a higher priority than the receiving thread, fast data processing and storage are achieved.
It solved the data loss problem, reduced costs, and achieved data compression and encryption, ensuring the integrity and reliability of data packets.
Smart Images

Figure CN117149677B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic information technology, and in particular to a method and apparatus for transmitting data via a storage multiplex interface in an embedded real-time system. Background Technology
[0002] An embedded real-time system is a system capable of performing its functions and responding to external or internal, synchronous or asynchronous events within a specified or defined timeframe. The correctness of a real-time operating system (RTOS) depends not only on the logical results of its computations but also on the time it takes to produce those results. A real-time system is capable of performing its functions and responding to external or internal, synchronous or asynchronous events within a specified or defined timeframe. Therefore, a real-time system should have the ability to identify and process discrete events within a predefined timeframe; the system should be able to process and store the large amounts of data required by the control system.
[0003] Embedded real-time systems transmit data simultaneously at high speeds through interfaces such as CAN, 485, 1553B, and network. The real-time system then receives the high-speed data from each interface via interrupts or polling, processes the data, and stores it on a solid-state drive.
[0004] However, due to the relatively long response time for interrupts and query operations, data processing, storage, and data transmission in real-time operating systems, data loss is easily caused. This makes it impossible for embedded real-time systems in many application scenarios to simultaneously receive data from interfaces such as CAN, RS-485, RS-1553B, and network at intervals of less than 1 millisecond, and to process and store the data while meeting security and data loss prevention requirements.
[0005] Therefore, how to provide a storage-based high-speed interface data transmission method suitable for embedded real-time systems, capable of receiving data sent simultaneously at high speeds from interfaces such as CAN, 485, 1553B, and network, without data packet loss, is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] In view of the above problems, the present invention provides a method and apparatus for storing multiplexed interface data transmission to overcome or at least partially solve the above problems.
[0007] This invention provides the following solution:
[0008] A method for storing data transmitted via a multiplexed interface includes:
[0009] Several consecutive FIFO address spaces are determined in memory, and each of the several consecutive FIFO address spaces corresponds one-to-one with several data transmission interfaces;
[0010] Simultaneously, several high-speed data messages sent from several data transmission interfaces at intervals within a target time are received in real time, and the reception time of each of the several high-speed data messages is obtained; the received high-speed data messages and their respective reception times are stored one-to-one in several consecutive FIFO address spaces.
[0011] Several high-speed data information is extracted from several consecutive FIFO address spaces, and each of the several high-speed data information is encrypted. The encrypted data and their respective reception times are combined to form storage log information and stored in the corresponding location of the hard disk of the PCIe interface.
[0012] Preferably, the plurality of the continuous FIFO address spaces include n, and the size of each continuous FIFO address space is m bytes; the m bytes represent the amount of data received by the interface in a single storage.
[0013] Preferably, the data transmission interface includes a CAN interface, a 485 interface, a 1553B interface, and a network interface.
[0014] Preferably, the target time is 1 millisecond.
[0015] Preferably, during the process of storing the high-speed data information into the continuous FIFO address space, it is determined in real time whether the continuous FIFO address space is full, and when the FIFO is full, the embedded system is notified.
[0016] Preferably: After determining that the data in the continuous FIFO address space needs to be processed urgently, a new continuous FIFO address space is allocated to store the received high-speed data information.
[0017] Preferably: a data receiving thread is established, which is used to simultaneously receive several high-speed data messages sent from several data transmission interfaces at intervals within a target time, and to obtain the reception time of each of the several high-speed data messages.
[0018] A data processing thread is established, which is used to retrieve several high-speed data information from several consecutive FIFO address spaces, encrypt the several high-speed data information respectively, and combine the encrypted data with their respective reception times to form storage log information, which is then stored in the corresponding location of the hard disk of the PCIe interface.
[0019] The data processing thread has a higher priority than the data receiving thread.
[0020] Preferably, the high-speed data information is compressed using a compression algorithm, and the compressed data is then encrypted.
[0021] Preferably: the stored data file is retrieved from the hard drive, the data is parsed, decrypted using the corresponding decryption algorithm, and then decompressed using the corresponding decompression algorithm to extract the data for user use. The usage status of the external device is analyzed by analyzing the corresponding data and the data reception time.
[0022] A storage device for multiplexed interface data transmission includes:
[0023] A continuous FIFO address space determination unit is used to determine several continuous FIFO address spaces in memory, wherein each of the several continuous FIFO address spaces corresponds one-to-one with a number of data transmission interfaces;
[0024] The data receiving and storage unit is used to simultaneously receive several high-speed data messages sent from several data transmission interfaces at intervals within a target time, and to obtain the reception time of each of the several high-speed data messages; and to store the received high-speed data messages and their respective reception times into several consecutive FIFO address spaces in a one-to-one correspondence.
[0025] The storage log information generation unit is used to extract several high-speed data information from several consecutive FIFO address spaces, encrypt the several high-speed data information respectively, and combine the encrypted data with their respective reception times to form storage log information, which is then stored in the corresponding location of the hard disk of the PCIe interface.
[0026] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0027] This application provides a method and apparatus for storing data transmitted through multiple interfaces. It solves the problem that in embedded real-time systems, when multiple interfaces such as CAN, 485, 1553B, and network simultaneously transmit data at high speeds at intervals, the real-time system receives the high-speed data from each interface via interrupts or polling, processes the data, and stores it on a solid-state drive. This results in data loss due to the long response time of the real-time operating system to interrupts and polling operations, the data processing time, the storage time, and the data transmission time. In practical applications, this method can reduce costs, solve data packet loss, and compress and encrypt the stored data.
[0028] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0030] Figure 1 This is a flowchart of a method for storing data transmitted via a multiplex interface, provided in an embodiment of the present invention;
[0031] Figure 2 This is a software processing flowchart provided in an embodiment of the present invention;
[0032] Figure 3 This is a schematic diagram of a storage multi-channel interface data transmission device provided in an embodiment of the present invention;
[0033] Figure 4 This is a schematic diagram of a storage multi-interface data transmission device provided in an embodiment of the present invention. Detailed Implementation
[0034] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention are within the scope of protection of the present invention.
[0035] See Figure 1 This invention provides a method for storing data transmitted via a multiplexed interface, such as... Figure 1 As shown, the method may include:
[0036] Several contiguous FIFO address spaces are defined in memory, and each of these contiguous FIFO address spaces corresponds one-to-one with several data transmission interfaces. The number of contiguous FIFO address spaces includes n, and each contiguous FIFO address space has a size of m bytes. The m bytes represent the amount of data received by the interface in a single storage operation. The size of m can be determined based on the amount of data received in a single operation.
[0037] Furthermore, the interfaces provided in this application embodiment may include multiple types. For example, in one implementation, this application embodiment may provide the data transmission interface including a CAN interface, a 485 interface, a 1553B interface, and a network interface.
[0038] Simultaneously, several high-speed data messages are received in real time from several data transmission interfaces at intervals within a target time, and the reception time of each of the several high-speed data messages is obtained; the received high-speed data messages and their respective reception times are stored one-to-one in several consecutive FIFO address spaces; in order to achieve high-speed data transmission, the target time in this embodiment can be 1 millisecond.
[0039] To monitor the state of the address space, this embodiment of the application can provide real-time determination of whether the continuous FIFO address space is full during the process of storing the high-speed data information into the continuous FIFO address space. When the FIFO is full, the embedded system is notified. Furthermore, after determining that the data in the continuous FIFO address space needs to be processed urgently, a new continuous FIFO address space is allocated to store the received high-speed data information.
[0040] Several high-speed data information is extracted from several consecutive FIFO address spaces, and each of the several high-speed data information is encrypted. The encrypted data and their respective reception times are combined to form storage log information and stored in the corresponding location of the hard disk of the PCIe interface.
[0041] In practical applications, a data receiving thread is established, which is used to simultaneously receive several high-speed data messages sent from several data transmission interfaces at intervals within a target time, and to obtain the reception time of each of the several high-speed data messages.
[0042] A data processing thread is established, which is used to retrieve several high-speed data information from several consecutive FIFO address spaces, encrypt the several high-speed data information respectively, and combine the encrypted data with their respective reception times to form storage log information, which is then stored in the corresponding location of the hard disk of the PCIe interface.
[0043] The data processing thread has a higher priority than the data receiving thread.
[0044] To further reduce the amount of data processing, embodiments of this application can provide the high-speed data information to be compressed using a compression algorithm, and the compressed data to be encrypted.
[0045] To facilitate the use of stored data, embodiments of this application can provide the following: data files are retrieved from the hard drive, parsed, decrypted using a corresponding decryption algorithm, and then decompressed using a corresponding decompression algorithm to extract data for user use. By analyzing the corresponding data and the data reception time, the usage status of external devices can be analyzed.
[0046] The embedded real-time system provides a storage multi-channel high-speed interface data communication method, which aims to solve the problem of data packet loss when an embedded real-time system receives, processes, and stores data sent simultaneously at high speeds through interfaces such as CAN, 485, 1553B, and network.
[0047] In specific implementation, such as Figure 2 As shown.
[0048] 1. Establish data cache FIFO storage memory space.
[0049] Allocate n contiguous FIFO address spaces of size m bytes in the memory space of the real-time operating system. m bytes represents the amount of data received by the interface in a single storage, and its size directly affects the data transmission efficiency and data update latency of each port.
[0050] Each contiguous FIFO address space is used to store the received data and the time of receipt (accurate to milliseconds). These received information are then made into corresponding first-in-first-out (FIFO) queues, which are then retrieved by the data processing thread for processing.
[0051] 2. Establish corresponding data receiving and processing for each interface.
[0052] In a real-time operating system, corresponding data receiving threads are established for interfaces such as CAN, 485, 1553B, and network. These threads are used to simultaneously receive high-speed data transmitted at intervals of less than 1 millisecond. While receiving data, the timing of the received data is obtained, and the received data and its timing are stored in the allocated memory FIFO address space for later processing. During the data storage process in the FIFO, the system continuously checks if the FIFO is full. If it is, the embedded system is promptly notified to expedite the processing of the data in the FIFO and automatically allocates a new FIFO to store the received data, preventing data loss.
[0053] 3. Query and extract data, process data, encrypt data, and store data.
[0054] In a real-time operating system, while receiving data from various ports, a data processing thread is established to retrieve data from the continuous FIFO address space where the received data is stored. The data is then encrypted, and the encrypted data, along with the time of receiving the data, is combined to form a storage log and stored in the corresponding location on the hard drive of the PCIe interface.
[0055] The data processing thread has a higher priority than the data receiving thread to prevent data packet loss when the FIFO is full and the data stored in the FIFO is overwritten. Data is retrieved from the contiguous FIFO address space where the received data is stored, and the data is compressed using a compression algorithm to reduce the amount of data stored. The compressed data is then encrypted, and the encrypted data, along with the time of receiving the data, is combined to form a storage log and stored in the corresponding location on the PCIe interface hard drive.
[0056] 4. Data storage and processing.
[0057] The system retrieves the stored data file from the hard drive, parses the data, decrypts it using a specific decryption algorithm, and then decompresses it using a corresponding decompression algorithm to extract the data available to the user. By analyzing the corresponding data and the time the data was received, the system can analyze the usage status of external devices, etc.
[0058] In summary, the storage multi-interface data transmission method provided in this application solves the problem that in embedded real-time systems, when multiple interfaces such as CAN, 485, 1553B, and network simultaneously send data at high speeds at intervals, the real-time system receives the high-speed data from each interface via interrupts or polling, processes the data, and stores it on a solid-state drive, resulting in data loss due to the long response time of the real-time operating system to interrupts and polling operations, data processing time, storage time, and data transmission time. In practical applications, this method can reduce costs, solve data packet loss, and compress and encrypt the stored data.
[0059] See Figure 3 This application embodiment can also provide a storage device for multiplexed interface data transmission, such as... Figure 3 As shown, the device may include:
[0060] The continuous FIFO address space determination unit 301 is used to determine several continuous FIFO address spaces in memory, and the several continuous FIFO address spaces correspond one-to-one with several data transmission interfaces;
[0061] The data receiving and storage unit 302 is used to simultaneously receive several high-speed data messages sent from several data transmission interfaces at intervals within a target time, and simultaneously obtain the reception time of each of the several high-speed data messages; and store the received several high-speed data messages and their respective reception times into several consecutive FIFO address spaces in a one-to-one correspondence.
[0062] The storage log information generation unit 303 is used to extract several high-speed data information from several consecutive FIFO address spaces, encrypt the several high-speed data information respectively, and combine the encrypted data with their respective reception times to form storage log information, which is then stored in the corresponding location of the hard disk of the PCIe interface.
[0063] This application embodiment can also provide a storage device for multiple interface transmission data, the device including a processor and a memory:
[0064] The memory is used to store program code and transmit the program code to the processor;
[0065] The processor is used to execute the steps of the above-described storage multiplexer data transmission method according to the instructions in the program code.
[0066] like Figure 4 As shown in the figure, the storage multiplex interface data transmission device provided in this application embodiment may include: a processor 10, a memory 11, a communication interface 12, and a communication bus 13. The processor 10, memory 11, and communication interface 12 all communicate with each other through the communication bus 13.
[0067] In this embodiment, the processor 10 may be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic devices.
[0068] The processor 10 can call programs stored in the memory 11. Specifically, the processor 10 can execute operations in the embodiments of the storage multiplex interface data transmission method.
[0069] The memory 11 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the memory 11 stores at least a program for implementing the following functions:
[0070] Several consecutive FIFO address spaces are determined in memory, and each of the several consecutive FIFO address spaces corresponds one-to-one with several data transmission interfaces;
[0071] Simultaneously, several high-speed data messages sent from several data transmission interfaces at intervals within a target time are received in real time, and the reception time of each of the several high-speed data messages is obtained; the received high-speed data messages and their respective reception times are stored one-to-one in several consecutive FIFO address spaces.
[0072] Several high-speed data information is extracted from several consecutive FIFO address spaces, and each of the several high-speed data information is encrypted. The encrypted data and their respective reception times are combined to form storage log information and stored in the corresponding location of the hard disk of the PCIe interface.
[0073] In one possible implementation, the memory 11 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function (such as file creation or data read / write). The data storage area may store data created during use, such as initialization data.
[0074] In addition, memory 11 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0075] Communication interface 12 can be an interface for the communication module, used to connect with other devices or systems.
[0076] Of course, it should be noted that, Figure 4 The structure shown does not constitute a limitation on the dynamic modeling device in the embodiments of this application. In practical applications, the dynamic modeling device may include devices such as... Figure 4 More or fewer components as shown, or combinations of certain components.
[0077] This application embodiment may also provide a computer-readable storage medium for storing program code for executing the steps of the above-described method for storing multiplexed interface data transmission.
[0078] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0079] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0080] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0081] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A method for storing data transmitted via multiple interfaces, characterized in that, include: Several consecutive FIFO address spaces are determined in memory, and each of the several consecutive FIFO address spaces corresponds one-to-one with several data transmission interfaces; Simultaneously, several high-speed data messages sent from several data transmission interfaces at intervals within a target time are received in real time, and the reception time of each of the several high-speed data messages is obtained; the received high-speed data messages and their respective reception times are stored one-to-one in several consecutive FIFO address spaces. Several high-speed data information is extracted from several consecutive FIFO address spaces, and each of the several high-speed data information is encrypted. The encrypted data and their respective reception times are combined to form storage log information and stored in the corresponding location of the hard disk of the PCIe interface.
2. The method for storing and transmitting data via multiple interfaces according to claim 1, characterized in that, The plurality of consecutive FIFO address spaces includes n, and each consecutive FIFO address space is m bytes in size; the m bytes represent the amount of data received by the interface in a single storage.
3. The method for storing and transmitting data via multiple interfaces according to claim 1, characterized in that, The data transmission interfaces include a CAN interface, a 485 interface, a 1553B interface, and a network interface.
4. The method for storing and transmitting data via multiple interfaces according to claim 1, characterized in that, The target time is 1 millisecond.
5. The method for storing and transmitting data via multiple interfaces according to claim 1, characterized in that, During the process of storing the high-speed data information into the continuous FIFO address space, it is determined in real time whether the continuous FIFO address space is full. When the FIFO is full, the embedded system is notified.
6. The method for storing and transmitting data via multiple interfaces according to claim 5, characterized in that, Once it is determined that the data in the continuous FIFO address space needs to be processed urgently, a new continuous FIFO address space is allocated to store the received high-speed data information.
7. The method for storing and transmitting data via multiple interfaces according to claim 1, characterized in that, A data receiving thread is established, which is used to simultaneously receive several high-speed data messages sent from several data transmission interfaces at intervals within a target time in real time, and to obtain the reception time of each of the several high-speed data messages. A data processing thread is established, which is used to retrieve several high-speed data information from several consecutive FIFO address spaces, encrypt the several high-speed data information respectively, and combine the encrypted data with their respective reception times to form storage log information, which is then stored in the corresponding location of the hard disk of the PCIe interface. The data processing thread has a higher priority than the data receiving thread.
8. The method for storing and transmitting data via multiple interfaces according to claim 1, characterized in that, The high-speed data information is compressed using a compression algorithm, and the compressed data is then encrypted.
9. The method for storing data transmitted via multiple interfaces according to claim 8, characterized in that, The stored data file is retrieved from the hard drive, the data is parsed, decrypted using the corresponding decryption algorithm, and then decompressed using the corresponding decompression algorithm to extract the data for user use. By analyzing the corresponding data and the data reception time, the usage status of the external device is analyzed.
10. A storage device for multiplexed interface data transmission, characterized in that, include: A continuous FIFO address space determination unit is used to determine several continuous FIFO address spaces in memory, wherein each of the several continuous FIFO address spaces corresponds one-to-one with a number of data transmission interfaces; The data receiving and storage unit is used to simultaneously receive several high-speed data messages sent from several data transmission interfaces at intervals within a target time, and to obtain the reception time of each of the several high-speed data messages; and to store the received high-speed data messages and their respective reception times into several consecutive FIFO address spaces in a one-to-one correspondence. The storage log information generation unit is used to extract several high-speed data information from several consecutive FIFO address spaces, encrypt the several high-speed data information respectively, and combine the encrypted data with their respective reception times to form storage log information, which is then stored in the corresponding location of the hard disk of the PCIe interface.
Citation Information
Patent Citations
Data processing method and simulation system
CN111444609A
Method and apparatus for managing packet FIFOS
US5448558A
