Method and device for reading and writing serial data, computer device, and storage medium

A technology of serial data, reading and writing methods, applied in the direction of electrical digital data processing, instruments, etc., to save CPU resources, save system resource overhead, and fast transmission.

CN108470008AActive Publication Date: 2018-08-31GUANGZHOU HI TARGET SURVEYING INSTRUMENT CO LTD
6 Cites 6 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Publication Date
2018-08-31

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention relates to a method and a device for reading and writing serial data, a computer device, and a storage medium. The method comprises: configuring a direct memory access resource; traversing direct memory access node names and comparing the direct memory access node names with preset node names; when the direct memory access node names are consistent with the preset node names, analyzing the direct memory access resource and configuring a direct memory access transmission mode; establishing a double-ring buffer region memory; establishing a device file descriptor and monitoring thedevice file descriptor; when dynamic conditions are monitored, performing writing-reading operation on a double-ring buffer region. Through a direct memory access transmission module, data rapid transmission is realized. Through establishing the double-ring buffer region to store and manage data, a data buffer storage problem is effectively solved. Through an epoll mechanism to monitor data of serial equipment, system resource cost is saved, data real-time transmitting-receiving efficiency is improved, so as to further solve problems of little overflow, loss, and usurpation in serial data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention relates to the technical field of embedded systems, in particular to a serial port data reading and writing method, device, computer equipment and storage medium. Background technique

[0002] The GNSS (Global Navigation Satellite System) positioning module can be configured to update and output GNSS raw data to the serial port at a rate of 1Hz, 5Hz, and 10Hz. User applications need to write data to the serial port while continuously reading data from the serial port device. That is to say, the serial port Data interaction and communication between the two parties are required with the user application.

[0003] The traditional technical solution is that in the kernel layer of the LINUX system, the serial port communication adopts the PIO mode (Programming Input / Output Model), and the CPU responds to the interrupt and executes the IO port command to read and write data to realize data communication. In the serial port communication applic...

Examples

Embodiment Construction

[0051] In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

[0052] figure 1 It is a schematic flowchart of a method for reading and writing serial port data in an embodiment. like figure 1 As shown, the present invention provides a method for reading and writing serial port data, including:

[0053] Step S101: Configure the direct memory access resource of the serial port device in the device tree.

[0054]Specifically, in the system device number file, add the direct memory access (DirectMemory Access) resource corresponding to the serial port device. As the name implies, the direct memory access function is to allow the device to bypass the processor a...