CN106919479B - Real-time log recording method of embedded device controller - Google Patents

Real-time log recording method of embedded device controller Download PDF

Info

Publication number
CN106919479B
CN106919479B CN201510984551.0A CN201510984551A CN106919479B CN 106919479 B CN106919479 B CN 106919479B CN 201510984551 A CN201510984551 A CN 201510984551A CN 106919479 B CN106919479 B CN 106919479B
Authority
CN
China
Prior art keywords
communication port
executing
data
sent
busy state
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.)
Active
Application number
CN201510984551.0A
Other languages
Chinese (zh)
Other versions
CN106919479A (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.)
Beijing Aeonmed Co Ltd
Original Assignee
Beijing Aeonmed 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 Beijing Aeonmed Co Ltd filed Critical Beijing Aeonmed Co Ltd
Priority to CN201510984551.0A priority Critical patent/CN106919479B/en
Publication of CN106919479A publication Critical patent/CN106919479A/en
Application granted granted Critical
Publication of CN106919479B publication Critical patent/CN106919479B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2268Logging of test results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/28Handling requests for interconnection or transfer for access to input/output bus using burst mode transfer, e.g. direct memory access DMA, cycle steal
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/28DMA
    • G06F2213/2806Space or buffer allocation for DMA transfers

Abstract

The invention relates to a real-time log recording method of an embedded device controller, which comprises the following steps: judging whether a file system exists in the embedded device controller, if so, storing the log message in a file mode, if not, judging whether the number of idle bytes in a communication port cache is larger than the length of the log message to be sent, if so, copying the data of the log message into a sending cache of the communication port when the communication port is not busy, resetting the memory address and the sending length of the DMA, and enabling the DMA to send.

Description

Real-time log recording method of embedded device controller
Technical Field
The invention relates to an embedded device, in particular to a real-time log recording method of an embedded device controller.
Background
The real-time log records the real running process of the software, and is generally used for debugging the software or positioning the position of a fault in the running process of the software. The embedded equipment controller such as a breathing control unit board of an anesthesia machine in the current market has the function of uploading effective data, but does not have the function of outputting real-time logs, and when a fault occurs, technicians generally analyze the fault when waiting for the fault to be recovered, and the field fault cannot be analyzed and processed at the first time.
Disclosure of Invention
The invention aims to overcome the defect that a technician cannot timely process field faults because the existing embedded device controller cannot timely output log information in real time, and thus, the real-time log recording method is provided.
In order to achieve the above object, the present invention provides a real-time logging method for an embedded device controller, comprising:
step 1), judging whether a file system exists in an embedded device controller, if so, executing the next step, otherwise, executing the step 3);
step 2), storing the log message in a file mode, then judging whether the log message needs to be output in real time, if so, executing the next step, otherwise, ending the operation;
step 3), judging whether the number of idle bytes in the communication port cache is larger than the length of the log message to be sent, if so, executing the next step, otherwise, executing the step 6); the communication port comprises one of a serial port, a network port and a wireless port;
step 4), judging whether the communication port is in a busy state, if the communication port is in a non-busy state, executing the next step, if the communication port is in the busy state, copying a data frame of the log message to the next position of a buffer area of the communication port, writing the address and the length of the data frame into a queue to be sent, and executing the next step after the communication port is in the non-busy state;
step 5), copying the data of the log message into a sending cache of a communication port, resetting the memory address and the sending length of the DMA, enabling the DMA to send, and then executing step 7);
step 6), the number of idle bytes in the communication port cache is smaller than the length of the data to be sent, the step 4) is executed after the number of idle bytes in the communication port cache is released and is increased to enable the number of idle bytes in the communication port cache to be larger than or equal to the length of the data to be sent;
step 7), DMA sends the log message data, and sets the busy state in the sending process;
step 8), in the interrupt of the completion of the DMA transmission, executing the following operations:
step 8-1), resetting the busy state, namely changing the busy state of the communication port into a non-busy state;
step 8-2), checking whether data exist in the queue to be sent, if data to be sent exist, moving the data out of the queue to be sent, then executing step 3), and if data to be sent do not exist, executing step 8-3);
step 8-3), checking the waiting queue, if the waiting queue comprises the data of the log message, executing the step 3) instead, and if not, finishing the operation.
The invention has the advantages that:
the method of the invention can transmit and record the log information in real time, and ensure the integrity of the log information. When a fault occurs, technicians can check the log and quickly locate the fault point.
Drawings
FIG. 1 is a schematic diagram of a log sending flow;
fig. 2 is a flowchart of a real-time logging method of an embedded device controller of the present invention.
Detailed Description
The invention will now be further described with reference to the accompanying drawings.
The principle of the log sending process is shown in fig. 1, log data to be sent is copied to a sending cache, a sending address and a sending length are written into a message queue, after a sending task judges that a Direct Memory Access (DMA) is idle, the message queue data is received, the Memory address and the length of the DMA are reset, the DMA sending is enabled, the CPU intervention is not needed in the sending process, the CPU burden is greatly reduced, and the real-time performance is improved to a certain extent. The relationship between data sending time, data quantity and data cache can also be found from the log sending process: data caching is space-to-time, and multiplexing is time-to-space.
The content of the log related in the invention can be defined according to the characteristics of each task, and can comprise a statistical log, a sensor log, a communication port interactive instruction log, a working state log of each module and the like. The protocol of the log may define different implementations of data frame header, instruction, length, check, etc.
Referring to fig. 2, the real-time logging method of an embedded device controller of the present invention includes:
step 1), judging whether a file system exists in an embedded device controller, if so, executing the next step, otherwise, executing the step 3);
step 2), storing the log message in a file mode, then judging whether the log message needs to be output in real time, if so, executing the next step, otherwise, ending the operation;
step 3), judging whether the number of idle bytes in the communication port cache is larger than the length of the log message to be sent, if so, executing the next step, otherwise, executing the step 6); the communication port comprises one of a serial port, a network port and a wireless port;
step 4), judging whether the communication port is in a busy state, if the communication port is in a non-busy state, executing the next step, if the communication port is in the busy state, copying a data frame of the log message to the next position of a buffer area of the communication port, writing the address and the length of the data frame into a queue to be sent, and executing the next step after the communication port is in the non-busy state;
step 5), copying the data of the log message into a sending cache of a communication port, resetting the memory address and the sending length of the DMA, enabling the DMA to send, and then executing step 7);
step 6), the number of idle bytes in the communication port cache is smaller than the length of the data to be sent, the step 4) is executed after the number of idle bytes in the communication port cache is released and is increased to enable the number of idle bytes in the communication port cache to be larger than or equal to the length of the data to be sent;
step 7), DMA sends the log message data, and sets the busy state in the sending process;
step 8), in the interrupt of the completion of the DMA transmission, executing the following operations:
step 8-1), resetting the busy state, namely changing the busy state of the communication port into a non-busy state;
step 8-2), checking whether data exist in the queue to be sent, if data to be sent exist, moving the data out of the queue to be sent, then executing step 3), and if data to be sent do not exist, executing step 8-3);
step 8-3), checking the waiting queue, if the waiting queue comprises the data of the log message, executing the step 3) instead, and if not, finishing the operation.
In the method, the log content of each task is completely copied into a data buffer, and if the space of the data buffer is insufficient, the task needs to wait until a free space is available for copying. This ensures the integrity of the log transfer.
Finally, it should be noted that the above embodiments are only used for illustrating the technical solutions of the present invention and are not limited. Although the present invention has been described in detail with reference to the embodiments, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (1)

1. A real-time logging method of an embedded device controller comprises the following steps:
step 1), judging whether a file system exists in an embedded device controller, if so, executing the next step, otherwise, executing the step 3);
step 2), storing the log message in a file mode, then judging whether the log message needs to be output in real time, if so, executing the next step, otherwise, ending the operation;
step 3), judging whether the number of idle bytes in the communication port cache area is larger than the length of the log message to be sent, if so, executing the next step, otherwise, executing the step 6); the communication port comprises one of a serial port, a network port and a wireless port;
step 4), judging whether the communication port is in a busy state, if the communication port is in a non-busy state, executing the next step, if the communication port is in the busy state, copying a data frame of the log message to the next position of a buffer area of the communication port, writing the address and the length of the data frame into a queue to be sent, and executing the next step after the communication port is in the non-busy state;
step 5), copying the data of the log message into a communication port cache region, resetting the memory address and the transmission length of the DMA, enabling the DMA to transmit, and then executing step 7);
step 6), the number of idle bytes in the communication port cache is smaller than the length of the data to be sent, the step 4) is executed after the number of idle bytes in the communication port cache is released and is increased to enable the number of idle bytes in the communication port cache to be larger than or equal to the length of the data to be sent;
step 7), DMA sends the log message data, and sets the busy state in the sending process;
step 8), in the interrupt of the completion of the DMA transmission, executing the following operations:
step 8-1), resetting the busy state, namely changing the busy state of the communication port into a non-busy state;
step 8-2), checking whether data exist in the queue to be sent, if data to be sent exist, moving the data out of the queue to be sent, then executing step 3), and if data to be sent do not exist, executing step 8-3);
step 8-3), checking the waiting queue, if the waiting queue comprises the data of the log message, executing the step 3) instead, and if not, finishing the operation.
CN201510984551.0A 2015-12-24 2015-12-24 Real-time log recording method of embedded device controller Active CN106919479B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510984551.0A CN106919479B (en) 2015-12-24 2015-12-24 Real-time log recording method of embedded device controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510984551.0A CN106919479B (en) 2015-12-24 2015-12-24 Real-time log recording method of embedded device controller

Publications (2)

Publication Number Publication Date
CN106919479A CN106919479A (en) 2017-07-04
CN106919479B true CN106919479B (en) 2020-04-24

Family

ID=59456510

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510984551.0A Active CN106919479B (en) 2015-12-24 2015-12-24 Real-time log recording method of embedded device controller

Country Status (1)

Country Link
CN (1) CN106919479B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109939310A (en) * 2017-12-20 2019-06-28 北京谊安医疗系统股份有限公司 The slave computer of ventilator sends the method and ventilator of data to host computer
CN109067754B (en) * 2018-08-17 2021-04-20 武汉精测电子集团股份有限公司 Communication method and system for request terminal and server terminal
CN117149680B (en) * 2023-10-27 2024-02-02 合肥安迅精密技术有限公司 Main control board for uploading sub-module log of chip mounter and uploading method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902434A (en) * 2012-12-29 2014-07-02 北京谊安医疗系统股份有限公司 Alarm log management method and system
CN104978543A (en) * 2015-07-09 2015-10-14 黄凯锋 Mobile terminal information safety protection system and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10002539B2 (en) * 2006-11-27 2018-06-19 Kbport Llc Method and apparatus for integrated recording and playback of video audio and data inputs

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902434A (en) * 2012-12-29 2014-07-02 北京谊安医疗系统股份有限公司 Alarm log management method and system
CN104978543A (en) * 2015-07-09 2015-10-14 黄凯锋 Mobile terminal information safety protection system and method

Also Published As

Publication number Publication date
CN106919479A (en) 2017-07-04

Similar Documents

Publication Publication Date Title
US20140068134A1 (en) Data transmission apparatus, system, and method
US11265266B2 (en) Computer-readable recording medium recording port switching program and port switching method
US8843663B2 (en) Data transmission device and method for merging multiple commands
EP2829986B1 (en) Computer system, access method and apparatus for peripheral component interconnect express endpoint devices
CN112463614B (en) Software virtualization test environment construction method based on hardware board access
WO2023284699A1 (en) Protocol stack data transmission method based on linux system, and computer device and storage medium
US7676701B2 (en) Computer readable medium storing an error recovery program, error recovery method, error recovery apparatus, and computer system
CN106919479B (en) Real-time log recording method of embedded device controller
US9021147B1 (en) Command queuing in disk drives
CN104021069A (en) Management method and system for software performance test based on distributed virtual machine system
CN111683252B (en) Server and output system and method of video compression image
CN106502814B (en) Method and device for recording error information of PCIE (peripheral component interface express) equipment
JP5326673B2 (en) Control circuit, information processing apparatus, and information processing apparatus control method
CN112039722A (en) MQTT protocol simulation method and simulation equipment
WO2016127600A1 (en) Exception handling method and apparatus
CN107066413B (en) Method for processing data of multiple bus devices and bus system thereof
US20150100745A1 (en) Method and apparatus for efficiently processing storage commands
WO2024037076A1 (en) Data interaction method, apparatus and system, and electronic device and storage medium
CN105718396A (en) I<2>C bus device with big data master device transmission function and communication method thereof
WO2017054714A1 (en) Method and apparatus for reading disk array
CN115981956A (en) SPDK service process monitoring method, device, equipment, storage medium and program product
WO2021136099A1 (en) Data transmission method, apparatus, and device, and storage medium
US11438448B2 (en) Network application program product and method for processing application layer protocol
KR20140134066A (en) Apparatus and Method Debugging Software of Vehicle's ECU
US8904062B2 (en) Network control model driver

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