Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a data processing method, as shown in fig. 1, including:
101. and receiving first data sent by the terminal equipment through a data sending interface through a first receiving interface and storing the first data into a first buffer area.
Wherein the first data comprises: interrupt data or status information.
It should be noted that, the terminal device of the present invention sends the interrupt data and the status information of the terminal device through a data sending interface. A first receiving interface and a second receiving interface of the data processing device simultaneously receive first data sent by the terminal equipment. The first data may be interrupt data or status information of the terminal device. The first receiving interface of the data processing device corresponds to the interrupt query thread, and the second receiving interface of the data processing device corresponds to the serial port communication thread. That is, the terminal device transmits the first data through the data transmission interface, and the first receiving interface and the second receiving interface of the data processing apparatus receive the first data simultaneously. The method comprises the steps that an interrupt inquiry thread obtains first data sent by terminal equipment through a first receiving interface of a data processing device; and the serial port communication thread acquires the first data sent by the terminal equipment through a second receiving interface of the data processing device.
Specifically, the terminal device sends the first data to the data processing apparatus through the sending data interface, and the data processing apparatus stores the received first data into the first buffer through the first receiving interface, so that the first data can be obtained from the first buffer when the execution cycle of the interrupt query thread arrives.
102. And in the interrupt query thread, acquiring first data sent by the terminal equipment through a data sending interface through the first buffer area.
Specifically, in the interrupt query thread, the data processing apparatus obtains, through the first buffer, the first data sent by the terminal device through the data sending interface. At this time, the first data acquired by the data processing apparatus through the first buffer may be interrupt data or status information.
103. And inquiring the exclusive flag bit of the thread.
The thread mutual exclusion flag bit is set by a serial communication thread and used for indicating whether the serial communication thread acquires state information or not; and setting the thread mutual exclusion flag position as a first identifier when the serial port communication thread acquires the state information, and setting the thread mutual exclusion flag position as a second identifier when the serial port communication thread does not need to acquire the state information.
It should be noted that, since the terminal device sends the interrupt data and the state information of the terminal device through one sending data interface, the first data passing through the first receiving interface in the data processing apparatus may be the interrupt data or the state information of the terminal device, and in order to ensure normal execution of the interrupt query thread, that is, to prevent the interrupt query thread from mistaking the state information of the terminal device as the interrupt data, a thread mutual exclusion flag is set. Therefore, when the serial port communication thread needs to acquire the state information of the terminal device, the thread mutual exclusion flag position is set as the first identifier to inform that the inquiry thread is interrupted, and the serial port communication thread acquires the state information of the terminal device, so that the terminal inquiry thread can know that the first data acquired from the first buffer area may be the state information of the terminal device. When the serial communication thread does not need to acquire the state information of the terminal device, the thread mutual exclusion flag position is set as a second identifier to inform the interrupt query thread, and the serial communication thread does not acquire the state information of the terminal device, so that the terminal query thread can know that the first data acquired from the first buffer area is interrupt data and is not the state information of the terminal device. Therefore, the normal execution of the interrupt inquiry thread can be ensured through the thread mutual exclusion flag bit.
Specifically, in the execution process of the interrupt query thread, after first data sent by the terminal device is acquired in the first cache region, the data processing device needs to query a thread mutual exclusion flag bit to determine whether the first data is interrupt data.
It should be noted that, the data processing apparatus executes the following steps differently according to different results of querying the thread mutual exclusion flag, if the thread mutual exclusion flag is queried as the first identifier, the step 104a is executed, and if the thread mutual exclusion flag is queried as the second identifier, the step 104b is executed.
104a, if the thread mutual exclusion flag bit is the first identifier, discarding the first data.
Specifically, when the data processing apparatus queries that the thread mutual exclusion flag is the first identifier, it indicates that the current serial port communication thread is acquiring the state information of the terminal device, and the first data acquired by the interrupt query thread may be the state information of the terminal device and is not necessarily the interrupt data.
It should be noted that the first identifier is predetermined. The first flag may be a binary 1 or a binary 0. If the first identifier is agreed to be binary 1, when the data processing device inquires that the thread mutual exclusion flag bit is 1, the current serial port communication thread acquires the state information of the terminal device, and at the moment, the data processing device discards the first data acquired by the interrupt inquiry thread.
104b, if the thread mutual exclusion flag bit is the second identifier, performing interrupt processing according to the first data.
Specifically, when the data processing device queries that the thread mutual exclusion flag is the second identifier, it indicates that the serial port communication thread does not acquire the state information of the terminal device, and at this time, the first data acquired by the interrupt query thread from the first buffer area is interrupt data, and then the interrupt processing is performed according to the first data.
It should be noted that the second identifier has a different value from the first identifier, and the second identifier may be any identifier other than the first identifier.
It should be noted that the process of the data processing apparatus performing interrupt processing according to the interrupt data is the same as that in the prior art, and is not described herein again.
The embodiment of the invention provides a data processing method, which comprises the steps of receiving first data sent by terminal equipment through a data sending interface through a first receiving interface and storing the first data into a first buffer area; in the interruption query thread, first data sent by the terminal device through the data sending interface can be acquired through the first buffer area, the thread mutual exclusion flag bit is queried, when the thread mutual exclusion flag bit is a first identifier, the first data is discarded, and when the thread mutual exclusion flag bit is a second identifier, interruption processing can be performed according to the first data. The thread mutual exclusion flag bit is set by a serial communication thread and used for indicating whether the serial communication thread acquires state information or not; and setting the thread mutual exclusion flag position as a first identifier when the serial port communication thread acquires the state information, and setting the thread mutual exclusion flag position as a second identifier when the serial port communication thread does not need to acquire the state information. Therefore, when the terminal device sends two different types of data, namely interrupt data or state information, through a data sending interface, the data processing device can inquire the thread mutual exclusion flag bit, when the thread mutual exclusion flag bit is a first identifier, the first identifier is set when the serial port communication thread needs to acquire the state information of the terminal device, and indicates that the serial port communication thread is acquiring the state information of the terminal device, at the moment, the first data acquired in the interrupt inquiry thread is not necessarily the interrupt data required by the interrupt inquiry thread, and therefore the data processing device discards the first data acquired in the interrupt inquiry thread. When the thread mutual exclusion flag bit is the second identifier, it indicates that the serial communication thread does not acquire the state information of the terminal device, and at this time, the first data acquired in the interrupt query thread is the required interrupt data, so that interrupt processing can be performed according to the first data. That is to say, when the terminal device sends two types of data, namely interrupt data or status information, through one sending data interface of the terminal device, the data processing device can utilize the method to enable each thread to obtain the required data, so as to ensure the normal operation of each thread, and thus, the positive communication of the data can be ensured. The terminal equipment can receive two different kinds of data of the interrupt data or the state information through one sending data interface, and compared with the condition that the interrupt data and the state information need to be sent through different sending data interfaces in the prior art, and the two sending data interfaces for sending the interrupt data and the state information are both in an idle state when the interrupt data and the state information are transmitted, the invention sends the two different kinds of data through one sending data interface, so that the time of the sending data interfaces in the idle state is reduced, and the purposes of improving the use efficiency of the interfaces of the existing chip and reducing the waste of interface resources of the chip are achieved while the normal communication of the data is ensured.
An embodiment of the present invention provides a data processing method, as shown in fig. 2, including:
201. first data is determined.
Wherein the first data comprises interrupt data or status information.
Specifically, when the terminal device fails, the interruption data is determined as the first data.
That is, when the terminal device fails, the failure information reported by the terminal device is the interruption data, and the terminal device determines the interruption data as the first data.
Or, the terminal device receives a control instruction request message sent by the data processing device through a data receiving interface, and determines the state information as the first data. That is, when the terminal device receives the control instruction request message, the state information is determined as first data.
Specifically, when the terminal device receives a control instruction request message sent by the data processing apparatus, the terminal device is required to reply the state information of the terminal device according to the control instruction request message, and at this time, the terminal device determines the state information as the first data.
It should be noted that the terminal device sends the interrupt data or the status information through the data sending interface, so that the first data determined by the terminal device is either the interrupt data or the status information, and the terminal data and the status information are different data.
202. And sending the first data to a data processing device through a sending data interface.
Specifically, when the terminal device determines the first data, the first data information is sent to the data processing device through the data sending interface. And when the terminal equipment determines that the first data is the interrupt data, transmitting the interrupt data to the data processing device through the data transmission interface. And when the terminal equipment determines that the first data is the state information, the state information is sent to the data processing device through the data sending interface. At the same time, the terminal device can only transmit one type of data, i.e. either interrupt data or status information, to the data processing device via the transmit data interface. I.e. the first data is interrupt data or status information.
The embodiment of the invention provides a data processing method, which comprises the following steps: determining the interrupt data as first data when a fault occurs; or, receiving a control instruction request message sent by the data processing device through a data receiving interface, and determining the state information as first data. After the first data is determined, the first data is transmitted to a data processing device through a transmission data interface. By the method, the terminal equipment can send the interrupt data or the state information to the data processing device through a data sending interface, namely the terminal equipment can send different data information at different moments. Compared with the prior art that the interrupt data and the state information are sent by different interfaces, when the interrupt data or the state information is not sent, the two interfaces sending the first interrupt data and the state information are both in the idle state, the invention can send the two different information by one sending data interface, and because the sending time of the interrupt data and the state information is different, the time of sending the data interface in the idle state is reduced, thereby improving the use efficiency of the sending data interface and further reducing the waste of chip pin resources.
An embodiment of the present invention provides a data processing method, as shown in fig. 3, including:
301. the data processing apparatus creates an interrupt query thread.
Specifically, the specific method for creating the interrupt query thread by the data processing apparatus may refer to the method for creating the thread in the prior art.
The interrupt polling thread of the data processing apparatus is a thread that is periodically executed with a time T as a cycle. That is, the data processing apparatus executes the interrupt query thread once per time T.
It should be noted that, in the interrupt query thread, if the terminal device reports the interrupt data to the data processing apparatus, step 302 and step 306a or step 306b are executed; if the terminal device does not report the interrupt data to the data processing device, the data processing device cannot acquire the interrupt data, and at this time, step 302 and step 306a or step 306b are not executed, and the next interrupt query thread is waited to be executed.
302. And when the terminal equipment fails, determining the interruption data as first data.
It should be noted that the terminal device may also determine interrupt data generated in other situations as the first data, for example: the data processing device monitors the ambient temperature around the terminal equipment, and reports the interrupt data if the ambient temperature suddenly changes. The invention is not limited in this regard.
It should be noted that the interrupt data generated by the terminal device under other conditions and the interrupt data reported when the terminal device fails are data of the same type as the predetermined type.
303. The terminal equipment sends the first data to the data processing device through the sending data interface, and the data processing device receives the first data sent by the terminal equipment through the sending data interface through the first receiving interface and stores the first data into the first buffer area. And the data processing device receives first data sent by the terminal equipment through the data sending interface through the second receiving interface and stores the first data into the second buffer area.
Specifically, the step 202 may be referred to in a method for the terminal device to send the interruption data to the data processing apparatus through the data sending interface, which is not described herein again.
The terminal equipment can send the interrupt data and the state information through the interface for sending the data, the interrupt data corresponds to the interrupt query thread in the data processing device, and the state information corresponds to the serial port communication thread in the data processing device. Therefore, when the terminal device sends data through the interface for sending data, the first receiving interface and the second receiving interface of the data processing device need to receive the first data at the same time.
304. In the interrupt query thread, the data processing device obtains the first data sent by the terminal device through the sending data interface through the first buffer area.
Specifically, the step 102 may be referred to in the specific method for the data processing apparatus to obtain the first data sent by the terminal device through the data sending interface through the first buffer, and details are not repeated here.
305. The data processing device inquires the thread mutual exclusion flag bit.
Specifically, the specific method for the data processing apparatus to query the thread mutex flag may refer to step 103, which is not described herein again.
It should be noted that, the data processing apparatus executes the following steps according to different results of querying the thread mutual exclusion flag, if the thread mutual exclusion flag is queried as the first identifier, execute step 306a, and if the thread mutual exclusion flag is queried as the second identifier, execute step 306 b.
306a, if the thread mutual exclusion flag bit is the first identifier, the data processing apparatus discards the first data.
Specifically, if the data processing apparatus determines that the thread mutex flag is the first identifier, the method for discarding the first data may refer to 104a, which is not described herein again.
306b, if the thread mutual exclusion flag bit is the second identifier, the data processing device processes interrupt processing according to the first data.
Specifically, if the data processing apparatus determines that the thread mutual exclusion flag is the second identifier, reference may be made to step 104b for a specific method of performing interrupt processing according to the first data, which is not described herein again.
It should be noted that, when the user needs to read or control the operation state of the terminal device by operating the device requiring data processing, that is, when the user needs to read the state information of the terminal device, step 307 and step 312 are executed in the serial communication thread. If the user does not need to read the status information of the terminal device, step 307 and 312 are not executed.
It should be noted that, the step 301-.
307. In a serial communication thread, a data processing device sends a control instruction request message to terminal equipment, and the mutual exclusion flag position of the thread is set as a first identifier. At this time, the terminal device receives the control instruction request message sent by the data processing device through the data receiving interface.
Specifically, when executing a serial communication thread, the data processing apparatus first receives a request message for sending a manipulation instruction to the terminal device through the data sending interface. In order to ensure the normal execution of the interrupt query thread, when the serial communication thread needs to acquire the state information of the terminal device, the thread mutual exclusion flag position can be set as a first identifier to inform the interrupt query thread, and the serial communication thread acquires the state information of the terminal device, so that the interrupt query thread can acquire the first data acquired from the first buffer possibly being the state information of the terminal device. When the thread mutual exclusion flag position of the interrupt query thread is the first identifier, the acquired first data is discarded, and the acquired first data is not processed.
It should be noted that the control instruction request message sent by the data processing apparatus to the terminal device through the data sending interface may be a status request message for querying an operation status of the terminal device, or may be a control command message for controlling the terminal device to respond to some operations. Of course, the control command request message may also be other messages, which is not limited in the present invention.
308. And after receiving a control instruction request message sent by the data processing device and received by the data receiving interface, the terminal equipment determines the state information as first data.
Specifically, refer to step 201, which is not described herein again.
309. The terminal equipment sends the first data to a data processing device through a sending data interface, and the data processing device receives the first data sent by the terminal equipment through the sending data interface through a first receiving interface, simultaneously receives the first data sent by the terminal equipment through the sending data interface through a second receiving interface and stores the first data into a second buffer area.
Specifically, refer to step 303, which is not described herein again.
310. And the data processing device acquires the first data sent by the terminal equipment through the data sending interface through the second buffer area.
Specifically, when executing a serial communication thread, the data processing apparatus obtains the first data sent by the terminal device through the data sending interface through the second buffer area. Since the terminal device sends the interrupt data and the status information through one sending data interface, the first data acquired by the data processing apparatus through the second buffer may be the interrupt data or the status information.
311. The data processing apparatus determines whether the first data is status information.
Specifically, after the data processing apparatus acquires, through the second buffer, the first data sent by the terminal device through the data sending interface, the first data may be analyzed to determine whether the data format of the first data is the data format of the status information, and if it is determined that the data format of the first data is the data format of the status information, it is determined that the first data acquired from the second buffer is the status information. And if the data format of the first data is not the data format of the state information, determining that the first data acquired from the second buffer area is not the state information.
The data processing apparatus executes the following steps differently depending on the determination result, and executes step 312a if the first data is determined to be the status information. If it is determined that the first data is not status information, step 312b is performed.
312a, when it is determined that the first data is the state information, the data processing device performs data processing on the first data, and sets the thread mutual exclusion flag position as a second identifier.
Specifically, when the data processing apparatus determines that the first data is the state information, it indicates that the acquired first data is the data that needs to be acquired, at this time, the data processing apparatus may perform data processing on the first data acquired from the second buffer, and set the thread mutual exclusion identifier as the second identifier to notify the interrupt query thread that the serial communication thread does not acquire the state information of the terminal device currently, and when the interrupt query thread acquires the first data in the first buffer, it may be known that the first data acquired from the first buffer is the interrupt data and is not the state information of the terminal device. Therefore, the normal execution of the interrupt inquiry thread can be ensured through the thread mutual exclusion flag bit.
312b, when determining that the first data is not the state information, the data processing device resends the control instruction request message to the terminal device.
Specifically, when the data processing apparatus determines that the first data acquired from the second buffer is not the status information, the first data acquired from the second buffer is discarded, and the control instruction request message is retransmitted to the terminal device once, and the first data transmitted by the terminal device is waited to be received again.
It should be noted that, when the user needs to read the state information of the terminal device, the serial communication thread is executed, and at this time, the serial communication thread and the interrupt query thread of the data processing apparatus may be executed in parallel. The process of parallel execution of the serial communication thread and the interrupt query thread of the data processing apparatus is shown in fig. 4; and when the user does not need to read the state information of the terminal equipment, the serial port communication thread is not executed.
It should be noted that the serial communication thread is created when the data processing apparatus needs to acquire the state information of the terminal device, and after the state information of the terminal device is acquired and processed correspondingly, the data processing apparatus may end the serial communication thread, that is, delete the serial communication thread. And the data processing device only creates an interrupt query thread once, periodically executes the interrupt query thread, and waits for the next execution of the interrupt query thread after acquiring interrupt data and performing interrupt processing or when the terminal device does not report the interrupt data.
The embodiment of the invention provides a data processing method, which comprises the steps of receiving first data sent by terminal equipment through a data sending interface through a first receiving interface and storing the first data into a first buffer area; in the interruption query thread, first data sent by the terminal device through the data sending interface can be acquired through the first buffer area, the thread mutual exclusion flag bit is queried, when the thread mutual exclusion flag bit is a first identifier, the first data is discarded, and when the thread mutual exclusion flag bit is a second identifier, interruption processing can be performed according to the first data. The thread mutual exclusion flag bit is set by a serial communication thread and used for indicating whether the serial communication thread acquires state information or not; and setting the thread mutual exclusion flag position as a first identifier when the serial port communication thread acquires the state information, and setting the thread mutual exclusion flag position as a second identifier when the serial port communication thread does not need to acquire the state information. Therefore, when the terminal device sends two different types of data, namely interrupt data or state information, through a data sending interface, the data processing device can inquire the thread mutual exclusion flag bit, when the thread mutual exclusion flag bit is a first identifier, the first identifier is set when the serial port communication thread needs to acquire the state information of the terminal device, and indicates that the serial port communication thread is acquiring the state information of the terminal device, at the moment, the first data acquired in the interrupt inquiry thread is not necessarily the interrupt data required by the interrupt inquiry thread, and therefore the data processing device discards the first data acquired in the interrupt inquiry thread. When the thread mutual exclusion flag bit is the second identifier, it indicates that the serial communication thread does not acquire the state information of the terminal device, and at this time, the first data acquired in the interrupt query thread is the required interrupt data, so that interrupt processing can be performed according to the first data. That is to say, when the terminal device sends two types of data, namely interrupt data or status information, through one sending data interface of the terminal device, the data processing device can utilize the method to enable each thread to obtain the required data, so as to ensure the normal operation of each thread, and thus, the positive communication of the data can be ensured. The terminal equipment can receive two different kinds of data of the interrupt data or the state information through one sending data interface, and compared with the condition that the interrupt data and the state information need to be sent through different sending data interfaces in the prior art, and the two sending data interfaces for sending the interrupt data and the state information are both in an idle state when the interrupt data and the state information are transmitted, the invention sends the two different kinds of data through one sending data interface, so that the time of the sending data interfaces in the idle state is reduced, and the purposes of improving the use efficiency of the interfaces of the existing chip and reducing the waste of interface resources of the chip are achieved while the normal communication of the data is ensured.
The present invention provides a data processing apparatus, as shown in fig. 5, including:
a receiving unit 501, configured to receive, through a first receiving interface, first data sent by a terminal device through a data sending interface and store the first data in a first buffer.
Wherein the first data comprises: interrupt data or status information.
The processing unit 502 is configured to, in an interrupt query thread, obtain, through the first buffer, the first data sent by the terminal device through the data sending interface.
The query unit 503 is configured to query the thread mutual exclusion flag.
The thread mutual exclusion flag bit is set by a serial communication thread and used for indicating whether the serial communication thread acquires state information or not. And setting the thread mutual exclusion flag position as a first identifier when the serial port communication thread acquires the state information, and setting the thread mutual exclusion flag position as a second identifier when the serial port communication thread does not need to acquire the state information.
It should be noted that, since the terminal device sends the interrupt data and the state information of the terminal device through one sending data interface, the first data passing through the first receiving interface in the data processing apparatus may be the interrupt data or the state information of the terminal device, and in order to ensure normal execution of the interrupt query thread, that is, to prevent the interrupt query thread from mistaking the state information of the terminal device as the interrupt data, a thread mutual exclusion flag is set. Therefore, when the serial port communication thread needs to acquire the state information of the terminal device, the thread mutual exclusion flag position is set as the first identifier to inform that the inquiry thread is interrupted, and the serial port communication thread acquires the state information of the terminal device, so that the terminal inquiry thread can know that the first data acquired from the first buffer area may be the state information of the terminal device. When the serial communication thread does not need to acquire the state information of the terminal device, the thread mutual exclusion flag position is set as a second identifier to inform the interrupt query thread, and the serial communication thread does not acquire the state information of the terminal device, so that the terminal query thread can know that the first data acquired from the first buffer area is interrupt data and is not the state information of the terminal device. Therefore, the normal execution of the interrupt inquiry thread can be ensured through the thread mutual exclusion flag bit.
The processing unit 502 is further configured to discard the first data when the querying unit 503 queries that the thread mutual exclusion flag is the first identifier. Or, when the query unit 503 queries that the thread mutual exclusion flag is the second identifier, performing interrupt processing according to the first data.
Specifically, when the query unit 503 queries that the thread mutual exclusion flag is the first identifier, it indicates that the current serial port communication thread is acquiring the state information of the terminal device, and the first data acquired by the processing unit 502 in the interrupt query thread through the first buffer may be the state information of the terminal device, and is not necessarily the interrupt data, at this time, the processing unit 502 discards the first data acquired by the interrupt query thread, and does not perform interrupt processing on the first data, so as to ensure the accuracy of the interrupt processing.
When the query unit 503 queries that the thread mutual exclusion flag is the second identifier, it indicates that the serial port communication thread does not acquire the state information of the terminal device, and at this time, the processing unit 502 acquires the first data from the first buffer in the interrupt query thread as the interrupt data, and then performs interrupt processing according to the first data.
Further, the data processing apparatus, as shown in fig. 6, further includes:
the sending unit 504 is configured to send a control instruction request message to the terminal device in the serial port communication thread.
It should be noted that the manipulation instruction request message may be a status request message for querying the operating status of the terminal device, or may be a control command message for controlling the terminal device to respond to some operations. Of course, the control command request message may also be other messages, which is not limited in the present invention.
A setting unit 505, configured to set the thread mutual exclusion flag to be a first identifier.
In order to ensure the normal execution of the interrupt query thread, when the serial communication thread needs to acquire the state information of the terminal device, the thread mutual exclusion flag position can be set as a first identifier to inform the interrupt query thread, and the serial communication thread acquires the state information of the terminal device, so that the interrupt query thread can acquire the first data acquired from the first buffer possibly being the state information of the terminal device. When the thread mutual exclusion flag position of the interrupt query thread is the first identifier, the acquired first data is discarded, and the acquired first data is not processed.
The receiving unit 501 is further configured to receive, through a first receiving interface, first data sent by a terminal device through a data sending interface, and at the same time, receive, through a second receiving interface, the first data sent by the terminal device through the data sending interface and store the first data in a second buffer.
The terminal equipment can send the interrupt data and the state information through the interface for sending the data, the interrupt data corresponds to the interrupt inquiry thread in the data processing device, and the state information corresponds to the serial port communication thread in the data processing device. Therefore, when the terminal device transmits data through the interface for transmitting data, the receiving unit 501 of the data processing apparatus needs to receive the first data through the first receiving interface and the second receiving interface simultaneously.
An obtaining unit 506, configured to obtain, through the second buffer, the first data sent by the terminal device through the data sending interface.
A determining unit 507, configured to determine whether the first data is status information.
Specifically, after the determining unit 507 obtains the first data sent by the terminal device through the data sending interface through the second buffer, the determining unit may parse the first data, determine whether the data format of the first data is the data format of the status information, and if it is determined that the data format of the first data is the data format of the status information, determine that the first data obtained from the second buffer is the status information. And if the data format of the first data is not the data format of the state information, determining that the first data acquired from the second buffer area is not the state information.
The processing unit 502 is further configured to perform data processing on the first data when the determining unit 507 determines that the first data is the status information.
The setting unit 506 is further configured to set the thread mutual exclusion flag to be a second identifier when the determining unit 507 determines that the first data is the state information.
Specifically, when the determining unit 507 determines that the first data is the state information, it indicates that the acquired first data is the data that needs to be acquired, at this time, the processing unit 502 may perform data processing on the first data acquired from the second buffer, and the setting unit 506 sets the thread mutual exclusion identifier as the second identifier to notify the interrupt query thread that the serial communication thread does not acquire the state information of the terminal device currently, and when the interrupt query thread acquires the first data in the first buffer, it may be known that the first data acquired from the first buffer is the interrupt data and is not the state information of the terminal device. Therefore, the normal execution of the interrupt inquiry thread can be ensured through the thread mutual exclusion flag bit.
Further, the sending unit 504 is further configured to resend the control instruction request message to the terminal device when the determining unit 507 determines that the first data is not the state information.
Specifically, when the determining unit 507 determines that the first data acquired from the second buffer is not the status information, the processing unit 502 may discard the first data acquired from the second buffer, and the sending unit 504 resends the manipulation instruction request message to the terminal device, and waits for the first data sent by the terminal device to be resent.
The embodiment of the invention provides a data processing device, which receives first data sent by terminal equipment through a data sending interface through a first receiving interface and stores the first data into a first buffer area; in the interruption query thread, first data sent by the terminal device through the data sending interface can be acquired through the first buffer area, the thread mutual exclusion flag bit is queried, when the thread mutual exclusion flag bit is a first identifier, the first data is discarded, and when the thread mutual exclusion flag bit is a second identifier, interruption processing can be performed according to the first data. The thread mutual exclusion flag bit is set by a serial communication thread and used for indicating whether the serial communication thread acquires state information or not; and setting the thread mutual exclusion flag position as a first identifier when the serial port communication thread acquires the state information, and setting the thread mutual exclusion flag position as a second identifier when the serial port communication thread does not need to acquire the state information. Therefore, when the terminal device sends two different types of data, namely interrupt data or state information, through a data sending interface, the data processing device can inquire the thread mutual exclusion flag bit, when the thread mutual exclusion flag bit is a first identifier, the first identifier is set when the serial port communication thread needs to acquire the state information of the terminal device, and indicates that the serial port communication thread is acquiring the state information of the terminal device, at the moment, the first data acquired in the interrupt inquiry thread is not necessarily the interrupt data required by the interrupt inquiry thread, and therefore the data processing device discards the first data acquired in the interrupt inquiry thread. When the thread mutual exclusion flag bit is the second identifier, it indicates that the serial communication thread does not acquire the state information of the terminal device, and at this time, the first data acquired in the interrupt query thread is the required interrupt data, so that interrupt processing can be performed according to the first data. That is to say, when the terminal device sends two types of data, namely interrupt data or status information, through one sending data interface of the terminal device, the data processing device can utilize the method to enable each thread to obtain the required data, so as to ensure the normal operation of each thread, and thus, the positive communication of the data can be ensured. The terminal equipment can receive two different kinds of data of the interrupt data or the state information through one sending data interface, and compared with the condition that the interrupt data and the state information need to be sent through different sending data interfaces in the prior art, and the two sending data interfaces for sending the interrupt data and the state information are both in an idle state when the interrupt data and the state information are transmitted, the invention sends the two different kinds of data through one sending data interface, so that the time of the sending data interfaces in the idle state is reduced, and the purposes of improving the use efficiency of the interfaces of the existing chip and reducing the waste of interface resources of the chip are achieved while the normal communication of the data is ensured.
An embodiment of the present invention provides a terminal device, as shown in fig. 7, including: a determining unit 701, a receiving unit 702, and a transmitting unit 703.
The receiving unit 702 is configured to receive, through a data receiving interface, a control instruction request message sent by the data processing apparatus.
The determining unit 701 is configured to determine the interruption data as first data when a failure occurs. Alternatively, when the receiving unit 702 receives a manipulation instruction request message sent by the data processing apparatus through a data receiving interface, the status information is determined as the first data.
A sending unit 703, configured to send the first data to a data processing apparatus through a sending data interface.
Wherein the first data comprises interrupt data or status information.
An embodiment of the present invention provides a terminal device, including: determining first data; determining the interrupt data as first data when a fault occurs; or, receiving a control instruction request message sent by the data processing device through a data receiving interface, and determining the state information as first data. After the first data is determined, the first data is transmitted to a data processing device through a transmission data interface. By the method, the terminal equipment can send the interrupt data or the state information to the data processing device through a data sending interface, namely the terminal equipment can send different data information at different moments. Compared with the prior art that the interrupt data and the state information are sent by different interfaces, when the interrupt data or the state information is not sent, the two interfaces sending the first interrupt data and the state information are both in the idle state, the invention can send the two different information by one sending data interface, and because the sending time of the interrupt data and the state information is different, the time of sending the data interface in the idle state is reduced, thereby improving the use efficiency of the sending data interface and further reducing the waste of chip pin resources.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.