Message processing method and device and vehicle
Patent Information
- Application Number
- CN202380053281.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2025-03-04
AI Technical Summary
When existing vehicle controllers receive multiple messages, low-priority messages may affect the processing of high-priority messages, resulting in processing delays or packet loss, which in turn affects the execution of periodic tasks and even causes the controller task to hang. .
By determining the priority of the message according to its identification and using interrupt processing or periodic polling processing, it ensures that high-priority messages are processed first and prevents low-priority messages from affecting the processing of high-priority messages.
It improves the reliability and flexibility of message processing, ensures the real-time nature of high-priority messages, and improves vehicle safety and processing efficiency.
Smart Images

Figure CN119563310A_ABST
Abstract
Description
Message processing method, device and vehicle Technical Field
[0001] The present application relates to the field of vehicle-mounted communications, and more specifically, to a method, device, and vehicle for message processing. Background Art
[0002] Currently, vehicle-mounted controllers mainly communicate via the controller area network (CAN) bus. As product functionality and intelligence requirements increase, the number of CAN messages sent and received by vehicle-mounted controllers is also increasing.
[0003] In current technology, when the vehicle-mounted controller receives multiple messages as the receiving end, it generally receives multiple messages uniformly through interruption or periodic polling. This may cause low-priority messages to impact high-priority messages, such as making high-priority messages unable to be processed in time or packet loss, etc., which in turn affects the execution of some periodic tasks (such as periodic task disorder, signal transmission and reception message frame loss, transmission failure, etc.). In severe cases, it will cause the controller task to hang and all functions to fail.
[0004] Summary of the Invention
[0005] The present application provides a method, device, and vehicle for message processing, which can improve the reliability and flexibility of message processing, thereby helping to improve vehicle safety.
[0006] In the first aspect, a method for message processing is provided, which can be executed by a vehicle; or, it can be executed by a vehicle-mounted terminal such as a vehicle computer, or it can be executed by an on-board electronic control unit (ECU), etc.; or, it can be executed by a chip or circuit used for the vehicle, which is not limited in this application.
[0007] The method may include: obtaining a first message, which corresponds to a first identifier (identity, ID); determining the priority of the first message based on the first identifier; when the first message corresponds to a first priority, interrupting the first message; or, when the first message corresponds to a second priority, periodically polling the first message, wherein the first priority is higher than the second priority.
[0008] Interrupt handling refers to the following: when the central processing unit (CPU) receives an interrupt or exception signal, it suspends the currently executing program and, through a specific mechanism, jumps to the relevant processing routine responsible for handling the signal. After processing the signal, it jumps back to the interrupted program. Therefore, interrupt handling of the first message refers to the CPU suspending the currently executing program upon receiving the signal to interrupt the first message, prioritizing processing of the first message, and then returning to the interrupted program after processing the first message.
[0009] The above-mentioned periodic polling process refers to the CPU sending queries according to a preset period, sequentially asking each peripheral device whether its service is required. The preset period can be, for example, 100 milliseconds, 300 milliseconds, or 500 milliseconds, and this application does not limit this. Based on this, the above-mentioned periodic polling process of the first message refers to the CPU processing the first message by querying according to the preset period.
[0010] When processing messages based on the above solution, the message's priority can be determined based on its identifier. The message's processing method can then be determined based on the message's priority. For example, messages with higher priority will be interrupted first, while messages with lower priority will be periodically polled. This prevents the processing of lower-priority messages from impacting higher-priority messages, ensuring the real-time processing of higher-priority messages. It also improves the reliability and flexibility of message processing, contributing to enhanced vehicle safety.
[0011] For example, the first message may be a CAN message, or other messages, which are not limited in the present embodiment. For ease of description, the following description will take the CAN message as an example.
[0012] Taking CAN messages as an example, the priority of a CAN message can be determined by the identification ID of the CAN message. It should be noted that there are usually two types of level states on the CAN bus, namely, explicit level and implicit level. The explicit level is defined as logic 0, and the implicit level is logic 1. The explicit level has a higher priority than the implicit level. Taking the 11-bit CAN ID as an example, the 11-bit CAN ID includes 11 bytes, which are byte 1 to byte 11 from left to right, and each byte has a value of 0 or 1. Usually, when judging the priority of different IDs, the byte values of different IDs can be compared bit by bit from left to right. When the values at a certain byte are different, the comparison ends, the explicit level wins, is sent first, and the byte number is recorded. The priority of the ID can be represented by the byte number. For example, for ID1, ID2, and ID3, if the value of ID1 at byte 1 is different from that of other IDs, and byte 1 of ID1 is dominant, then ID1's priority can be considered higher than that of other IDs, and "ID1 = byte 1" can be used to represent ID1's priority. Comparing the bytes of ID2 and ID3, if the value of ID2 at byte 5 begins to differ from that of ID3, and byte 5 of ID2 is dominant, then "ID2 = byte 5" can be used to represent ID2's priority. In summary, the priority of an ID can be represented by "ID = byte x." Generally, a smaller x means a higher priority ID. For example, a CAN message with "ID = byte 1" has a higher priority than a CAN message with "ID = byte 2," and so on.
[0013] Based on the above description, as an example, the message of "ID=Byte 1" to "ID=Byte 5" may correspond to the first priority, and the message of "ID=Byte 6" to "ID=Byte 11" may correspond to the second priority.
[0014] In one possible implementation, the correspondence between the message identifier and the priority can also be customized in advance based on the message content, and the correspondence between the message identifier and the priority can be stored in a mapping table. For example, a message carrying control instructions such as vehicle control instructions can be set to the first priority in advance, and the identifier and priority relationship of the message can be stored in the mapping table; for another example, a message carrying entertainment content such as audio and video streams can be set to the second priority in advance, and the identifier and priority relationship of the message can be stored in the mapping table. In actual operation, after obtaining the message, the corresponding priority can be determined directly by searching in the mapping table based on the message identifier. Prioritizing high-priority messages or messages that affect vehicle safety is conducive to ensuring the real-time processing of high-priority messages or messages that affect vehicle safety. Using periodic polling for low-priority or service messages such as audio and video streams can improve processing performance and avoid the impact of high-frequency interruptions on the performance of the message processing system.
[0015] In combination with the first aspect, in certain implementations of the first aspect, the interrupt processing of the first message includes: when the first priority is the third priority, directly interrupt processing the first message; or, when the first priority is the fourth priority, interrupt processing the first message based on a first queue, the first queue being a queue among at least two queues having a priority higher than a first threshold, wherein the third priority is higher than the fourth priority.
[0016] Based on the above scheme, when interrupt processing is performed on a message, the interrupt processing method of the message can be further determined according to the priority of the message. For example, when the priority of the message is higher, the message is directly interrupted and processed, and when the priority of the message is generally high, the message is interrupted and processed based on the first queue. In this way, the real-time processing of higher priority messages can be guaranteed while ensuring that the processing of messages with generally high priority has little impact, thereby improving the reliability and flexibility of message processing.
[0017] The above-mentioned queue can be understood as a linear list that allows deletion operations at the front end of the list (i.e., the head of the queue) and insertion operations at the back end of the list (i.e., the tail of the queue). Based on this, the above-mentioned first queue can be understood as a message arrangement table, and messages are usually added to the first queue from the back end of the arrangement table, but when processing messages, they are processed sequentially starting from the front end of the arrangement table. The above-mentioned interrupt processing of the first message based on the first queue can be understood as: according to the arrangement order of the messages in the first queue, the messages are interrupted in sequence until it is the turn of the first message.
[0018] The first queue being the queue with a priority higher than the first threshold among the at least two queues can also be described as the queue with the higher priority among the at least two queues. In one possible implementation, the priority of each of the at least two queues can be pre-set. For example, the priority of queue 1 is set to 1, the priority of queue 2 is set to 2, and the first threshold is set to 1.5. Based on this, the first queue can be determined to be queue 2.
[0019] In combination with the first aspect, in some implementations of the first aspect, the periodic polling processing of the first message includes: periodic polling processing of the first message based on a second queue, the second queue being a queue of the at least two queues having a priority lower than a second threshold.
[0020] Based on the above solution, when periodically polling the message, the first message can be further periodically polled based on the second queue, thereby improving the orderliness of the message processing and helping to improve the reliability and flexibility of the message processing.
[0021] The above-mentioned periodic polling processing of the first message based on the second queue can be understood as: performing periodic polling processing on the messages in the second queue in sequence until it is the turn of the first message.
[0022] The second queue being the queue with a priority lower than the second threshold among the at least two queues can also be described as the queue with the lower priority among the at least two queues. In one possible implementation, the priority of each of the at least two queues can be pre-set. For example, the priority of queue 1 is set to 1, the priority of queue 2 is set to 2, and the second threshold is set to 1.3. Based on this, the second queue can be determined to be queue 1.
[0023] In one possible implementation, it is also possible to determine which queue of the at least two queues the first queue or the second queue is based on the priority of the queue, but to distinguish different queues by setting an identifier for each queue in advance, so that in practice it is possible to determine which queue of the at least two queues the first queue (or the second queue) is based on the identifier corresponding to the first queue (or the second queue). For example, queue 1 can be set to correspond to identifier 1, and queue 2 can be set to correspond to identifier 2. Then, when the first queue corresponds to identifier 2, it can be determined that the first queue is queue 2.
[0024] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: determining that the first message is associated with the first processing unit based on the first identifier; obtaining a second message, the second message including a second identifier; determining that the second message is associated with the second processing unit based on the second identifier; and processing the first message and the second message based on the first processing unit and the second processing unit, respectively.
[0025] In traditional solutions, messages are usually received uniformly by a target processing unit, and other processing units move messages from the target processing unit, causing a large amount of memory and CPU resources of the target processing unit to be occupied, resulting in high processing pressure and low processing efficiency.
[0026] When processing messages based on the above-mentioned scheme of the present application, different processing units can be determined based on different message identifiers, and then different messages can be processed based on different processing units, so as to balance the use of CPU resources of different processing units, avoid overload of a single processing unit, and improve overall resource utilization and message processing efficiency.
[0027] In one possible implementation, the correspondence between the message identifier and the processing unit can be pre-set, such as by using a mapping table. In actual operation, after obtaining a message, the corresponding processing unit can be determined by searching the mapping table based on the message identifier.
[0028] Optionally, different message identifiers may be pre-set to correspond to different processing units. For example, three different message identifiers (ID1, ID2, and ID3) may be pre-set to correspond to three different processing units (processing unit 1, processing unit 2, and processing unit 3), such as ID1 corresponding to processing unit 1, ID2 corresponding to processing unit 2, and ID3 corresponding to processing unit 3. Alternatively, N message identifiers may be pre-set to correspond to M processing units, where N is greater than M. For example, three message identifiers (ID1, ID2, and ID3) may correspond to two processing units (processing unit 1 and processing unit 2). In this case, some processing units may need to process one message, while some processing units may need to process multiple messages, such as ID1 and ID2 corresponding to processing unit 1, and ID3 corresponding to processing unit 2. Alternatively, a message identifier may be pre-assigned to correspond to multiple different processing units. For example, a message identifier ID1 may be pre-assigned to correspond to three different processing units (processing unit 1, processing unit 2, and processing unit 3). In this case, any one processing unit may be selected to process the message (e.g., processing unit 1), or the message may be processed simultaneously by multiple processing units. It should be understood that in actual operation, the correspondence between processing units and message identifiers is flexible and is not specifically limited in this application.
[0029] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: determining whether the first message needs to be routed and forwarded based on the first identifier; when it is determined that the first message does not need to be routed and forwarded, performing the interrupt processing or the periodic polling processing on the first message.
[0030] In combination with the first aspect, in some implementations of the first aspect, the method further includes: when it is determined that the first message needs to be routed and forwarded, routing and forwarding the first message.
[0031] Based on the above scheme, before interrupting or periodically polling the message, it is possible to first determine whether the message needs to be routed and forwarded based on the message identifier. When the message does not need to be routed and forwarded, the message is interrupted or periodically polled. When the message needs to be routed and forwarded, the message is directly routed and forwarded, thereby reducing the message processing links, reducing the message forwarding waiting and processing time, and improving the message processing efficiency.
[0032] In one possible implementation, a correspondence between a message identifier and whether to route forwarding can be pre-set, such as by setting a plurality of correspondences between message identifiers and whether to route forwarding using a mapping table. In actual operation, after receiving a message, whether the message requires routing forwarding can be determined by searching the mapping table based on the message identifier.
[0033] In combination with the first aspect, in certain implementations of the first aspect, the routing forwarding of the first message includes: when the first message corresponds to the fifth priority, forwarding the first message in real time; or, when the first message corresponds to the sixth priority, periodic polling forwarding of the first message, wherein the fifth priority is higher than the sixth priority.
[0034] Based on the above scheme, when a message needs to be routed and forwarded, the message routing and forwarding method can be determined based on the priority of the message. For example, when the priority of the message is high, the message can be forwarded in real time, and when the priority of the message is low, the message can be forwarded periodically in a round-robin manner. This can ensure the real-time forwarding of high-priority messages and improve the reliability and flexibility of message forwarding.
[0035] In a second aspect, a device for message processing is provided, which may include an acquisition module and a processing module, wherein the acquisition module is used to acquire a first message, and the first message corresponds to a first identifier; the processing module is used to determine the priority of the first message based on the first identifier; when the first message corresponds to a first priority, the first message is interrupted; or, when the first message corresponds to a second priority, the first message is periodically polled, wherein the first priority is higher than the second priority.
[0036] In combination with the second aspect, in certain implementations of the second aspect, the processing module is also used to, when the first priority is the third priority, directly interrupt the first message; or, when the first priority is the fourth priority, interrupt the first message based on the first queue, where the first queue is a queue among at least two queues whose priority is higher than the first threshold, wherein the third priority is higher than the fourth priority.
[0037] In combination with the second aspect, in some implementations of the second aspect, the processing module is further used to perform periodic polling processing on the first message based on a second queue, where the second queue is a queue with a priority lower than a second threshold among the at least two queues.
[0038] In combination with the second aspect, in certain implementations of the second aspect, the acquisition module is also used to acquire a second message, which includes a second identifier; the processing module is also used to determine that the first message is associated with the first processing unit based on the first identifier; determine that the second message is associated with the second processing unit based on the second identifier; and process the first message and the second message based on the first processing unit and the second processing unit, respectively.
[0039] In combination with the second aspect, in certain implementations of the second aspect, the processing module is also used to determine whether the first message needs to be routed and forwarded based on the first identifier; when it is determined that the first message does not need to be routed and forwarded, perform the interrupt processing or the periodic polling processing on the first message.
[0040] In combination with the second aspect, in some implementations of the second aspect, the processing module is further configured to, when determining that the first message needs to be routed and forwarded, route and forward the first message.
[0041] In combination with the second aspect, in certain implementations of the second aspect, the processing module is also used to forward the first message in real time when the first message corresponds to the fifth priority; or to perform periodic polling forwarding on the first message when the first message corresponds to the sixth priority, wherein the fifth priority is higher than the sixth priority.
[0042] In a third aspect, a device for message processing is provided, which includes: a memory for storing a computer program; and a processor for executing the computer program stored in the memory, so that the device executes the method in any possible implementation of the first aspect above.
[0043] In a fourth aspect, a message processing system is provided, comprising: a message transceiver for receiving the first message; and an apparatus according to any possible implementation of the second aspect, for obtaining and processing the first message from the message transceiver.
[0044] In a fifth aspect, a vehicle is provided, which may include the device in any possible implementation of the second aspect, or include the device in the third aspect, or the system in the fourth aspect.
[0045] In a sixth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in any one of the possible implementations of the first aspect.
[0046] It should be noted that the above-mentioned computer program code can be stored in whole or in part on the first storage medium, wherein the first storage medium can be packaged together with the processor or separately packaged with the processor, and the embodiments of the present application do not specifically limit this.
[0047] In a seventh aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a computer, the method in any possible implementation manner of the first aspect is implemented.
[0048] In an eighth aspect, a chip is provided, comprising a processor for calling a computer program or computer instruction stored in a memory so that the processor executes the method in any possible implementation of the first aspect.
[0049] In combination with the eighth aspect, in a possible implementation, the processor is coupled to the memory through an interface.
[0050] In combination with the eighth aspect, in one possible implementation, the chip system also includes a memory, in which a computer program or computer instructions are stored. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] FIG1 is a schematic flowchart of a message processing method provided in an embodiment of the present application.
[0052] FIG2 is a schematic flowchart of another message processing method provided in an embodiment of the present application.
[0053] FIG3 is a schematic diagram of a system architecture for message processing provided in an embodiment of the present application.
[0054] FIG4 is a schematic diagram of another system architecture for message processing provided in an embodiment of the present application.
[0055] FIG5 is a schematic block diagram of a message processing apparatus provided in an embodiment of the present application.
[0056] FIG6 is a schematic block diagram of another message processing apparatus provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in this article is a description of the association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0058] In this application, "at least one item" means one or more items, and "multiple items" means two or more items. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.
[0059] In the embodiments of this application, prefixes such as "first" and "second" are used only to distinguish different description objects and have no limiting effect on the position, order, priority, quantity, or content of the described objects. The use of prefixes such as ordinal numbers in the embodiments of this application to distinguish description objects does not constitute a limitation on the described objects. For a statement of the described objects, please refer to the description in the context of the claims or embodiments, and the use of such prefixes should not constitute an unnecessary limitation.
[0060] The present application scheme can be applied to a vehicle (sometimes referred to as a vehicle for short), which can be understood as a vehicle in a broad sense. The vehicle can be a means of transportation (such as a car, truck, motorcycle, airplane, train, ship, etc.), an industrial vehicle (such as a forklift, trailer, tractor, etc.), an engineering vehicle (such as an excavator, a bulldozer, a crane, etc.), agricultural equipment (such as a lawn mower, a harvester, etc.), amusement equipment, a toy vehicle, etc. The embodiments of the present application do not specifically limit the type of vehicle.
[0061] For example, it can be applied to vehicle control modules (such as vehicle dynamics control systems (VDC), vehicle control units (VCU), vehicle domain controllers (DCU), etc.), vehicle electronic control units (ECU), vehicle microcontroller units (MCU), vehicle terminals such as car computers, chips or circuits in vehicles, etc., and this application does not limit this.
[0062] Currently, information exchange between onboard controllers and sensors (such as lidar, millimeter-wave radar, and ultrasonic radar) on vehicles is primarily achieved through CAN bus communication. As vehicles become more intelligent, the number of CAN messages sent and received by onboard controllers is also increasing.
[0063] In current technology, onboard controllers typically receive multiple messages simultaneously through interrupts or periodic polling, without distinguishing message priorities. This can cause low-priority messages to impact high-priority messages, preventing them from being processed in a timely manner. Furthermore, a sudden increase in the number of messages can cause an overflow of high-priority messages, impacting the execution of some periodic tasks (such as periodic task disruptions, frame loss in signal transmission and reception, and transmission failures). In severe cases, this can cause controller tasks to freeze, rendering all functions inoperable.
[0064] Based on this, when processing messages, the present application solution first determines the message priority based on the message identifier, and then determines the message processing method based on the message priority. For example, when the message priority is high, the message is interrupted first, and when the message priority is low, the message is polled periodically. This can prevent the processing of low-priority messages from affecting high-priority messages, ensuring the real-time processing of high-priority messages. It can also improve the reliability and flexibility of message processing, helping to improve vehicle safety.
[0065] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0066] FIG1 is a schematic flow chart of a message processing method provided by an embodiment of the present application. The steps or operations of the message processing method shown in FIG1 are merely exemplary. The embodiment of the present application may also perform other operations or variations of the operations in FIG1. The method 100 includes:
[0067] S110: Obtain a first message, wherein the first message corresponds to a first identifier (Identity, ID).
[0068] For example, the first message may be a CAN message, or other messages, which are not limited in the present embodiment. For ease of description, the following description will take the CAN message as an example.
[0069] The obtaining of the first message may be obtaining the first message from a CAN transceiver.
[0070] S120: Determine the priority of the first message according to the first identifier.
[0071] Taking CAN messages as an example, the priority of a CAN message can be determined by the identification ID of the CAN message. It should be noted that there are usually two types of level states on the CAN bus, namely, explicit level and implicit level. The explicit level is defined as logic 0, and the implicit level is logic 1. The explicit level has a higher priority than the implicit level. Taking the 11-bit CAN ID as an example, the 11-bit CAN ID includes 11 bytes, which are byte 1 to byte 11 from left to right, and each byte has a value of 0 or 1. Usually, when judging the priority of different IDs, the byte values of different IDs can be compared bit by bit from left to right. When the values at a certain byte are different, the comparison ends, the explicit level wins, is sent first, and the byte number is recorded. The priority of the ID can be represented by the byte number. For example, for ID1, ID2, and ID3, if the value of ID1 at byte 1 is different from that of other IDs, and byte 1 of ID1 is dominant, then ID1's priority can be considered higher than that of other IDs, and "ID1 = byte 1" can be used to represent ID1's priority. Comparing the bytes of ID2 and ID3, if the value of ID2 at byte 5 begins to differ from that of ID3, and byte 5 of ID2 is dominant, then "ID2 = byte 5" can be used to represent ID2's priority. In summary, the priority of an ID can be represented by "ID = byte x." Generally, a smaller x means a higher priority ID. For example, a CAN message with "ID = byte 1" has a higher priority than a CAN message with "ID = byte 2," and so on.
[0072] Based on the above description, as an example, the message from "ID = byte 1" to "ID = byte 5" may correspond to the first priority, the message from "ID = byte 6" to "ID = byte 11" may correspond to the second priority. Furthermore, the message from "ID = byte 1" to "ID = byte 2" may correspond to the third priority, and the message from "ID = byte 3" to "ID = byte 5" may correspond to the fourth priority.
[0073] In one possible implementation, the correspondence between the message identifier and the priority can also be customized in advance based on the message content, and the correspondence between the message identifier and the priority can be stored in a mapping table. For example, a message carrying control instructions such as vehicle control instructions can be set to the first priority in advance, and the identifier and priority relationship of the message can be stored in the mapping table; for another example, a message carrying entertainment content such as audio and video streams can be set to the second priority in advance, and the identifier and priority relationship of the message can be stored in the mapping table. In actual operation, after obtaining the message, the corresponding priority can be determined directly by searching in the mapping table based on the message identifier. Prioritizing high-priority messages or messages that affect vehicle safety is conducive to ensuring the real-time processing of high-priority messages or messages that affect vehicle safety. Using periodic polling for low-priority or service messages such as audio and video streams can improve processing performance and avoid the impact of high-frequency interruptions on the performance of the message processing system.
[0074] S130: When the first message corresponds to a first priority, interrupt processing is performed on the first message; or when the first message corresponds to a second priority, periodic polling is performed on the first message, where the first priority is higher than the second priority.
[0075] Interrupt handling refers to the following: when the CPU receives an interrupt or exception signal, it suspends execution of the currently executing program and, through a specific mechanism, jumps to the relevant processing routine responsible for handling the signal. After processing the signal, it then jumps back to the interrupted program. Therefore, interrupt handling of the first message refers to the CPU suspending execution of the currently executing program upon receiving a signal to interrupt handling of the first message, prioritizing processing of the first message, and then returning to the interrupted program after processing the first message.
[0076] In a possible implementation, when the first priority is the third priority, interrupt processing may be directly performed on the first message.
[0077] In another possible implementation, when the first priority is the fourth priority, the first message can be interrupted based on the first queue, where the first queue is a queue with a priority higher than the first threshold among at least two queues, and the third priority is higher than the fourth priority.
[0078] The above-mentioned queue can be understood as a linear list that allows deletion operations at the front end of the list (i.e., the head of the queue) and insertion operations at the back end of the list (i.e., the tail of the queue). Based on this, the above-mentioned first queue can be understood as a message arrangement table, and messages are usually added to the first queue from the back end of the arrangement table, but when processing messages, they are processed sequentially starting from the front end of the arrangement table. The above-mentioned interrupt processing of the first message based on the first queue can be understood as: according to the arrangement order of the messages in the first queue, the messages are interrupted in sequence until it is the turn of the first message.
[0079] The first queue being the queue with a priority higher than the first threshold among the at least two queues can also be described as the queue with the higher priority among the at least two queues. In one possible implementation, the priority of each of the at least two queues can be pre-set. For example, the priority of queue 1 is set to 1, the priority of queue 2 is set to 2, and the first threshold is set to 1.5. Based on this, the first queue can be determined to be queue 2.
[0080] Based on the above scheme, when interrupt processing is performed on a message, the interrupt processing method of the message can be further determined according to the priority of the message. For example, when the priority of the message is higher, the message is directly interrupted and processed, and when the priority of the message is generally high, the message is interrupted and processed based on the first queue. In this way, the real-time processing of higher priority messages can be guaranteed while ensuring that the processing of messages with generally high priority has little impact, thereby improving the reliability and flexibility of message processing.
[0081] The above-mentioned periodic polling process refers to the CPU sending queries according to a preset period, sequentially asking each peripheral device whether its service is required. The preset period can be, for example, 100 milliseconds, 300 milliseconds, or 500 milliseconds, and this application does not limit this. Based on this, the above-mentioned periodic polling process of the first message refers to the CPU processing the first message by querying according to the preset period.
[0082] In a possible implementation, the first message may be periodically polled based on a second queue, where the second queue is a queue with a priority lower than a second threshold among the at least two queues.
[0083] The above-mentioned periodic polling processing of the first message based on the second queue can be understood as: performing periodic polling processing on the messages in the second queue in sequence until it is the turn of the first message.
[0084] The second queue being the queue with a priority lower than the second threshold among the at least two queues can also be described as the queue with the lower priority among the at least two queues. In one possible implementation, the priority of each of the at least two queues can be pre-set. For example, the priority of queue 1 is set to 1, the priority of queue 2 is set to 2, and the second threshold is set to 1.3. Based on this, the second queue can be determined to be queue 1.
[0085] In one possible implementation, it is also possible to determine which queue of the at least two queues the first queue or the second queue is based on the priority of the queue, but to distinguish different queues by setting an identifier for each queue in advance, so that in practice it is possible to determine which queue of the at least two queues the first queue (or the second queue) is based on the identifier corresponding to the first queue (or the second queue). For example, queue 1 can be set to correspond to identifier 1, and queue 2 can be set to correspond to identifier 2. Then, when the first queue corresponds to identifier 2, it can be determined that the first queue is queue 2.
[0086] Based on the above solution, when periodically polling the message, the first message can be further periodically polled based on the second queue, thereby improving the orderliness of the message processing and helping to improve the reliability and flexibility of the message processing.
[0087] In a possible implementation, the above method 100 may also include: determining that the first message is associated with the first processing unit based on the above first identifier; obtaining a second message, the second message including a second identifier; determining that the second message is associated with the second processing unit based on the second identifier; and processing the first message and the second message based on the first processing unit and the second processing unit respectively.
[0088] In traditional solutions, messages are usually received uniformly through a target processing unit, and other processing units move messages from the target processing unit, causing a large amount of memory and CPU resources of the target processing unit to be occupied, resulting in high processing pressure and low processing efficiency. Based on this, when processing messages, the present application can first determine different processing units based on different message identifiers, and then process different messages based on different processing units, thereby balancing the use of CPU resources of different processing units, avoiding overload of a single processing unit, and improving overall resource utilization and message processing efficiency.
[0089] In one possible implementation, the correspondence between the message identifier and the processing unit can be pre-set, such as by using a mapping table. In actual operation, after obtaining a message, the corresponding processing unit can be determined by searching the mapping table based on the message identifier.
[0090] Optionally, different message identifiers may be pre-set to correspond to different processing units. For example, three different message identifiers (ID1, ID2, and ID3) may be pre-set to correspond to three different processing units (processing unit 1, processing unit 2, and processing unit 3), such as ID1 corresponding to processing unit 1, ID2 corresponding to processing unit 2, and ID3 corresponding to processing unit 3. Alternatively, N message identifiers may be pre-set to correspond to M processing units, where N is greater than M. For example, three message identifiers (ID1, ID2, and ID3) may correspond to two processing units (processing unit 1 and processing unit 2). In this case, some processing units may need to process one message, while some processing units may need to process multiple messages, such as ID1 and ID2 corresponding to processing unit 1, and ID3 corresponding to processing unit 2. Alternatively, a message identifier may be pre-assigned to correspond to multiple different processing units. For example, a message identifier ID1 may be pre-assigned to correspond to three different processing units (processing unit 1, processing unit 2, and processing unit 3). In this case, any one processing unit may be selected to process the message (e.g., processing unit 1), or the message may be processed simultaneously by multiple processing units. It should be understood that in actual operation, the correspondence between processing units and message identifiers is flexible and is not specifically limited in this application.
[0091] In one possible implementation, before executing the above-mentioned step S120, it can be determined whether the first message needs to be routed and forwarded based on the above-mentioned first identifier. When it is determined that the first message does not need to be routed and forwarded, the first message is interrupted or periodically polled; when it is determined that the first message needs to be routed and forwarded, the first message is routed and forwarded.
[0092] Based on the above scheme, before interrupting or periodically polling the message, it is possible to first determine whether the message needs to be routed and forwarded based on the message identifier. When the message does not need to be routed and forwarded, the message is interrupted or periodically polled. When the message needs to be routed and forwarded, the message is directly routed and forwarded, thereby reducing the message processing links, reducing the message forwarding waiting and processing time, and improving the message processing efficiency.
[0093] In one possible implementation, a correspondence between a message identifier and whether to route forwarding can be pre-set, such as by setting a plurality of correspondences between message identifiers and whether to route forwarding using a mapping table. In actual operation, after receiving a message, whether the message requires routing forwarding can be determined by searching the mapping table based on the message identifier.
[0094] Optionally, when the first message corresponds to the fifth priority, the first message is forwarded in real time; or, when the first message corresponds to the sixth priority, the first message is forwarded periodically by polling, wherein the fifth priority is higher than the sixth priority. For example, messages with "ID=byte 1" to "ID=byte 5" may correspond to the fifth priority, and messages with "ID=byte 6" to "ID=byte 11" may correspond to the sixth priority.
[0095] Based on the above scheme, when a message needs to be routed and forwarded, the message routing and forwarding method can be determined based on the priority of the message. For example, when the priority of the message is high, the message can be forwarded in real time, and when the priority of the message is low, the message can be forwarded periodically in a round-robin manner. This can ensure the real-time forwarding of high-priority messages and improve the reliability and flexibility of message forwarding.
[0096] Optionally, when routing and forwarding the first message, the first message may be first sent to a third queue, which may include multiple messages that need to be routed and forwarded. The third queue may also be understood as a routing and forwarding cache queue, without limitation. For other descriptions of the third queue, please refer to the above introduction to the first queue and the second queue, which will not be repeated here. When it is the turn to forward the first message based on the order of the third queue, it can also be determined whether to forward the first message in real time or in periodic polling based on the priority corresponding to the first message.
[0097] As an example, FIG2 is a schematic flow chart of another method for message processing provided in an embodiment of the present application. It should be understood that the steps or operations in the message processing method 200 shown in FIG2 are merely exemplary, and the present application embodiment may also perform other operations or variations of the operations in FIG2. The steps of method 200 are described below.
[0098] S210, obtaining a message.
[0099] S220: Determine whether the message needs to be routed and forwarded. The specific determination method can be found in the above description and will not be repeated here.
[0100] When it is determined that the message does not need to be routed and forwarded, steps S230 to S250 are executed; when it is determined that the message needs to be routed and forwarded, step S260 is executed to route and forward the message.
[0101] S230: Determine the priority and processing unit corresponding to the message according to the identifier of the message. The specific determination method can be found in the above and will not be repeated here.
[0102] S240: Determine a processing method for the message according to the priority corresponding to the message.
[0103] Exemplarily, whether to perform interrupt processing or periodic polling processing on the message may be determined according to the priority corresponding to the message.
[0104] In one example, when the message corresponds to the first priority, it may be determined to perform interrupt processing on the message.
[0105] In another example, when the message corresponds to the second priority, it may be determined to perform periodic polling processing on the message; or it may be determined to perform periodic polling processing on the message based on the second queue.
[0106] As another example, when the message corresponds to the third priority, it may be determined to directly perform interrupt processing on the message.
[0107] In another example, when the message corresponds to the fourth priority, it can be determined to perform interrupt processing on the message based on the first queue.
[0108] S250: Process the message according to the processing method and processing unit corresponding to the message.
[0109] In one example, when the processing mode corresponding to the message is interrupt processing and the corresponding processing unit is the first processing unit, the message may be interrupt processed based on the first processing unit.
[0110] In another example, when the processing mode corresponding to the message is periodic polling processing and the corresponding processing unit is the second processing unit, the message can be periodically polled based on the second processing unit;
[0111] As another example, when the processing mode corresponding to the message is direct interrupt processing, and the corresponding processing unit is the third processing unit, the message can be directly interrupted based on the third processing unit.
[0112] In another example, when the processing method corresponding to the message is to perform interrupt processing on the message based on the first queue, and the corresponding processing unit is the fourth processing unit, the message can be interrupted based on the fourth processing unit and the first queue.
[0113] S260: Routing and forwarding the message.
[0114] When routing a message, the message may be first sent to the third queue and then routed based on the third queue. When it is the turn to forward the message based on the order of the third queue, whether to forward the message in real time or in periodic round-robin fashion may be determined based on the priority of the message.
[0115] In one example, when the message corresponds to the fifth priority, it can be determined that the message is forwarded in real time.
[0116] In another example, when the message corresponds to the sixth priority, it may be determined to perform periodic polling and forwarding on the message.
[0117] It should also be noted that other explanations about the above steps and the introduction of beneficial effects can be found above and will not be repeated here.
[0118] Optionally, in a possible implementation, each step in the above method 100 or 200 can be implemented by software coding, and its running or carrying body may include but is not limited to hardware chips or boards or products that integrate the functions of the above method, such as MCU, microprocessor unit (MPU), system on chip (SoC), field programmable gate array (FPGA), digital signal processor (DSP), message transceiver module, driver chip, power chip, etc.; or software programs that integrate the functions of the above method may be implemented but are not limited to programming languages such as C, C++, JAVA, Python, etc.
[0119] In another possible implementation, the steps of method 100 or 200 can be implemented through a combination of software and hardware. For example, chip hardening can be used to accelerate the processing process, and this can include, but is not limited to, implementing chip hardening through circuits or modules designed with digital or logic gate combinations. Related parameters (such as CAN ID, processing mode, processing unit number, message period, length, cache size, number of messages, and rate) can be implemented through register configuration or software coding to increase processing speed.
[0120] In another possible implementation, some steps in the above method 100 or 200 can be implemented by software coding, and other steps can be implemented by a combination of software and hardware, which is not limited in this application.
[0121] The system architecture involved in this application is described below with reference to Figures 3 and 4. It should be understood that the system architectures shown in Figures 3 and 4 are merely examples and do not constitute a limitation on the solution of this application. In actual applications, the system architecture may also include more or fewer modules, and this application does not impose any limitation on this.
[0122] 3 is a schematic diagram of a message processing system architecture provided by an embodiment of the present application. The system 300 includes a CAN transceiver module 310, a processing module 320, and at least one processing unit 330. These modules are described below.
[0123] The CAN transceiver module 310 may include at least one CAN transceiver (e.g., CAN0 to CANn), and each CAN transceiver may include a CAN receiving module (CANRx) and a CAN transmitting module (CANTx). The CAN receiving module may be used to receive messages on the CAN bus, i.e., receive messages from the CAN bus and upload them to the processing module 320; the CAN transmitting module may be used to send messages on the CAN bus, i.e., receive messages from the processing module 320 and send them to the CAN bus.
[0124] Optionally, the messages received and sent by the CAN transceiver may include, but are not limited to, CAN, CAN with flexible data rate (CANFD), highly scalable CANXL, standard frames, extended frames and other CAN message formats.
[0125] The form of the CAN transceiver may include, but is not limited to, an independent CAN transceiver, a CAN transceiver built into the MCU, or other independent devices with transceiver capabilities, etc., without limitation.
[0126] The at least one processing unit 330 may include processing units 1 to m. Each processing unit may obtain messages from the processing module 320 and process the obtained messages; it may also send processed messages to the processing module 320, which then passes them to the CAN transceiver for transmission after processing by the processing module 320. It should be understood that communication between each processing unit and the processing module 320 can be bidirectional, supporting various modes such as full-duplex and half-duplex.
[0127] The processing module 320 can obtain a message from the CAN transceiver module 310 and process the message according to the above method 100 or 200. For example, the priority corresponding to the message can be determined based on the identifier of the obtained message, and then the message can be interrupted or periodically polled based on the priority corresponding to the message. For another example, the message identifier can be used to determine whether the message needs to be routed and forwarded. If the message does not need to be routed and forwarded, the message can be interrupted or periodically polled based on the priority corresponding to the message. If the message needs to be routed and forwarded, the message can be directly routed and forwarded. For another example, the processing unit corresponding to the message can be determined based on the identifier of the message, and the message can be uploaded to the corresponding processing unit so that the processing unit corresponding to the message can process the message.
[0128] The processing module 320 may also obtain a message from the processing unit and process the obtained message. For example, the processing module 320 may obtain a message from the processing unit and determine whether to send the message immediately or periodically based on the priority of the message, and determine the CAN transceiver corresponding to the message.
[0129] In a possible implementation, the processing module 320 may execute the steps in the method 100 or 200 as a whole.
[0130] In another possible implementation, the processing module 320 may also include multiple sub-processing modules, and the steps in the method 100 or 200 may be implemented through the joint action of the sub-processing modules.
[0131] As an example, FIG4 is a schematic diagram of another system architecture for message processing provided in an embodiment of the present application. As shown in FIG4 , the system 400 may include a CAN transceiver module 410, a processing module 420, and at least one processing unit 430. The processing module 420 includes a first sub-processing module 421, a second sub-processing module 422, and a third sub-processing module 423, and these three sub-processing modules can communicate and interact through an internal bus. The tasks performed by each sub-processing module and the related functional modules are exemplarily introduced below. It should be noted that the division method of the sub-processing module and the following functional introduction are only used as an example and cannot constitute a limitation on the scheme of the present application. In actual operation, more or fewer sub-processing modules may be included, and the tasks performed by each sub-processing module and the related functional modules may also have other possibilities and are not limited.
[0132] Each CAN transceiver in the CAN transceiver module 410 can receive messages from the CAN bus and upload them to the first sub-processing module 421, or can obtain messages from the first sub-processing module 421 and send them to the CAN bus. For other details about the CAN transceiver module 410, please refer to the above description of the CAN transceiver module 310 and will not be repeated here.
[0133] Each processing unit in the at least one processing unit 430 can obtain and process message data from the third sub-processing module 423, and each processing unit can send relevant processing results to the third sub-processing module 423, which then implements routing and forwarding. For other details about the at least one processing unit 430, refer to the above description of the at least one processing unit 330 and are not further described here.
[0134] The first sub-processing module 421 can be used to obtain a message from the CAN transceiver module 410, and then determine the priority corresponding to the message and the processing unit corresponding to the message based on the message identifier (i.e., CAN ID). Furthermore, the processing method of the message (i.e., determining whether to perform interrupt processing or periodic polling processing on the message, or determining whether to perform direct interrupt processing, interrupt processing based on the first queue, or periodic polling processing on the message) is determined based on the message priority. The first sub-processing module 421 can also determine whether the message needs to be routed and forwarded based on the CAN ID. The specific determination method can be found above and will not be repeated here.
[0135] The above-mentioned “determining the message processing method” can also be understood as determining the message processing path (or channel), or determining the message transmission path (or channel), etc., and this application does not limit this.
[0136] The first sub-processing module 421 may include any one or more of a message identification mapping table (ie, a CAN ID table), a cache module 1, a cache module 2, a periodic polling module 1, a periodic polling module 2, an immediate sending module, and the like.
[0137] Among them, the CAN ID table can be understood as a CAN ID mapping table. Based on the CAN ID table, after obtaining the message from the CAN transceiver module 410, the priority corresponding to the message can be determined by the message ID, or the processing unit corresponding to the message can be determined by the mapping relationship between the message ID and the processing unit, or whether the message needs to be routed and forwarded can be determined by the mapping relationship between the message ID and whether to route and forward.
[0138] The cache module 1 can be a memory space for caching high-priority (e.g., the first priority, the third priority, or the fourth priority mentioned above) message data. That is, when the priority of a message is determined to be relatively high based on the message ID, the data of the message can be cached in the cache module 1. It should be understood that the message data cached by the cache module 1 can be directly transmitted to the third sub-processing module 423. For example, when the priority of the message is higher (e.g., the third priority mentioned above), the message data can be directly transmitted to the third sub-processing module 423; the message data cached by the cache module 1 can also be passed to the second sub-processing module 422. For example, when the priority of the message is generally high (e.g., the fourth priority mentioned above), the message data can be passed to the second sub-processing module 422.
[0139] The cache module 2 can be a memory space for caching low-priority (eg, second-priority) message data. That is, when the priority of a message is determined to be low based on the message ID, the data of the message can be cached in the cache module 2.
[0140] The periodic polling module 1 can be understood as a module that periodically reads message information during the message reception process. The periodic polling module 1 can receive message data from the cache module 2 and support the transmission of message data to the second sub-processing module 422 .
[0141] The periodic polling module 2 can be understood as a periodic writing module for message information during the message sending process. The periodic polling module 2 supports writing message data from the second sub-processing module 422 and transmits the message data to CANTx of a CAN transceiver to realize the sending of message data.
[0142] The instant sending module can be understood as an instant writing module for message information during the message sending process. It also supports writing message data from the second sub-processing module 422 and transferring the message data to CANTx of a CAN transceiver to realize the sending of message data.
[0143] When processing messages based on the above-mentioned first sub-processing module 421, on the one hand, the importance of messages can be distinguished from the source, taking into account the processing efficiency and real-time performance of the messages; on the other hand, it can be determined from the source whether the message needs to be routed and forwarded, thereby reducing the processing links of the message and reducing the routing waiting time and processing time of the message; on the other hand, the processing unit corresponding to the message can be specified, so as to balance the use of CPU resources of different processing units, avoid overload of a single processing unit, and improve overall resource utilization and message processing efficiency.
[0144] The second sub-processing module 422 can obtain the message from the first sub-processing module 421 and manage the message upload and processing path based on the message data. For example, the second sub-processing module 422 can configure the processing path of the message uploaded by the first sub-processing module 421 so that it can be delivered to the third sub-processing module 423 via different receiving queues or routed and forwarded via the sending queue.
[0145] The second sub-processing module 422 may include any one or more of a first queue, a second queue, a third queue, and the like.
[0146] The first queue can be understood as a receiving queue for generally high-priority messages (e.g., the fourth priority mentioned above). The first queue can receive message data from the buffer module 1 in the first sub-processing module 421 through an interrupt and then pass it to the third sub-processing module 423 at a higher level.
[0147] The second queue can be understood as a receiving queue for low-priority (e.g., the second priority mentioned above) messages. The second queue can periodically receive message data from the periodic polling module 1 in the first sub-processing module 421 and then pass it to the third sub-processing module 423 at a higher level.
[0148] The third queue can be understood as a sending cache queue. The third queue can obtain the message data processed by the processing unit from the third sub-processing module 423, and can also obtain the message data that needs to be routed and forwarded from the first sub-processing module 421; the third queue can also send the message data to the periodic polling module 2 or the instant sending module in the first sub-processing module 421 to send and deliver the message.
[0149] When processing messages based on the above-mentioned second sub-processing module 422, it is possible to avoid the situation where a large number of messages are queued and wait for processing, and it can ensure that high-priority messages are processed first, and higher-priority messages are directly processed without waiting, thereby greatly improving the reliability of message processing.
[0150] The third sub-processing module 423 can receive a message from the first sub-processing module 421 or the second sub-processing module 422 and pass the message to the corresponding processing unit; it can also be used to receive a message from the processing unit and pass the message to the second sub-processing module 422.
[0151] The third sub-processing module 423 may include a configuration management module for the processing unit, which may be used to manage at least one processing unit 430. For example, the configuration management module for the processing unit may be used to manage the matching mapping relationship between the processing unit and the message ID (or the message transceiver queue, etc.), and may configure whether each processing unit needs to support CAN message transceiver information processing. The configuration management module for the processing unit supports any flexible combination configuration, for example, one message ID may be configured to correspond to one processing unit, or one message ID may be configured to correspond to multiple processing units, or N message identifiers may be configured to correspond to M processing units, where N is greater than M; for another example, a first queue may be configured to correspond to a first processing unit set, which may include any one or more processing units, and a second queue may correspond to a second processing unit set, which may include any one or more processing units.
[0152] When the first sub-processing module 421 processes the message, the use of the CPU resources of the processing units can be balanced, thereby preventing the CPU resources of some processing units from being overloaded while other processing units are substantially idle.
[0153] Based on the above system 400 , a message received by CANRx in CAN0 is taken as an example to exemplify the specific processing flow of the message (including steps S1 to S8 , see FIG. 4 ).
[0154] In step S1, the CAN transceiver (e.g., CAN0) in the CANRx transmits the message received from the CAN bus to the first sub-processing module 421 to determine the priority, processing unit, and whether the message needs to be routed through the CAN ID table in the first sub-processing module 421.
[0155] When it is determined based on the CAN ID table in the first sub-processing module 421 that the priority of the message is higher and does not need to be routed forwarding, continue to execute step S2; when it is determined based on the CAN ID table in the first sub-processing module 421 that the priority of the message is lower and does not need to be routed forwarding, continue to execute step S5; when it is determined based on the CAN ID table in the first sub-processing module 421 that the message needs to be routed forwarding, continue to execute step S6.
[0156] Step S2: uploading the message to the cache module 1 and determining the interrupt processing method for the message based on the priority corresponding to the message.
[0157] When the priority of the message is higher, continue to execute step S3 to directly interrupt the message; when the priority of the message is generally high, continue to execute step S4 to interrupt the message based on the first queue in the second sub-processing module 422.
[0158] In step S3 , the cache module 1 directly uploads the message to the third sub-processing module 423 , and transmits the message to the corresponding processing unit via the third sub-processing module 423 to implement direct interrupt processing of the message.
[0159] In step S4, the cache module 1 uploads the message to the first queue in the second sub-processing module 422, and then passes it to the third sub-processing module 423 based on the first queue in the second sub-processing module 422, and passes the message to the corresponding processing unit via the third sub-processing module 423 to realize interrupt processing of the message based on the first queue in the second sub-processing module 422.
[0160] In step S5, the message is uploaded to the cache module 2, and the cache module 2 uploads the message to the periodic polling module 1. The periodic polling module 1 uploads the message to the second queue in the second sub-processing module 422, and then passes the message to the third sub-processing module 423 based on the second queue in the second sub-processing module 422, and passes the message to the corresponding processing unit via the third sub-processing module 423 to realize periodic polling processing of the message based on the second queue in the second sub-processing module 422.
[0161] In step S6, the message is uploaded to the third queue in the second sub-processing module 422, and step S7 or S8 is continued to be executed to implement routing forwarding of the message.
[0162] In step S7, when the priority corresponding to the message is low, the message is passed to the periodic polling module 2 in the first sub-processing module 421 based on the third queue, and the periodic polling module 2 then passes the message data to CANTx of a CAN transceiver (for example, CANn) in the CAN transceiver module 410 to realize periodic polling and sending of the message data based on CANTx of the CAN transceiver.
[0163] Step S8, when the priority corresponding to the message is higher, the message is passed to the immediate sending module in the first sub-processing module 421 based on the third queue, and the immediate sending module then passes the message data to CANTx of a CAN transceiver (for example, CANn) in the CAN transceiver module 410 to realize immediate sending of the message data based on CANTx of the CAN transceiver.
[0164] In a possible implementation, the above processing flow may be implemented by software coding. For other introductions, please refer to the above and will not be repeated here.
[0165] In another possible implementation, the above processing flow may be implemented by combining software and hardware to accelerate the processing process. For other introductions, please refer to the above and will not be repeated here.
[0166] In another possible implementation, some operations in the above process flow can be implemented through software coding, while other operations can be implemented through a combination of software and hardware. For example, the operations involved in the first sub-processing module 421 can be implemented through chip hardening; the operations involved in the second sub-processing module 422 and the third sub-processing module 423 can be implemented through software coding.
[0167] In the various embodiments of the present application, unless otherwise specified or there is a logical conflict, the terms and / or descriptions between the various embodiments are consistent and can be referenced by each other. The technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships.
[0168] The apparatus provided in the embodiments of the present application will be described in detail below with reference to Figures 5 and 6. It should be understood that the description of the apparatus embodiment corresponds to the description of the method embodiment, and therefore, for matters not described in detail, reference can be made to the method embodiment above, and for the sake of brevity, no further description will be given here.
[0169] FIG5 is a schematic block diagram of a message processing apparatus 500 provided in an embodiment of the present application. The apparatus 500 includes an acquisition module 510 and a processing module 520 .
[0170] The acquisition module 510 is configured to acquire a first message corresponding to a first identifier.
[0171] The processing module 520 is used to determine the priority of the first message based on the first identifier; when the first message corresponds to the first priority, interrupt processing is performed on the first message; or, when the first message corresponds to the second priority, periodic polling processing is performed on the first message, wherein the first priority is higher than the second priority.
[0172] Optionally, the processing module 520 can also be used to directly interrupt the first message when the first priority is the third priority; or, when the first priority is the fourth priority, interrupt the first message based on the first queue, which is a queue among at least two queues with a priority higher than the first threshold, wherein the third priority is higher than the fourth priority.
[0173] Optionally, the processing module 520 may be further configured to perform periodic polling processing on the first message based on a second queue, where the second queue is a queue with a priority lower than a second threshold among the at least two queues.
[0174] Optionally, the acquisition module 510 can also be used to acquire a second message, which includes a second identifier; the processing module 520 can also be used to determine that the first message is associated with the first processing unit based on the first identifier; determine that the second message is associated with the second processing unit based on the second identifier; and process the first message and the second message based on the first processing unit and the second processing unit, respectively.
[0175] Optionally, the processing module 520 may be further configured to determine whether the first message needs to be routed and forwarded according to the first identifier; and when it is determined that the first message does not need to be routed and forwarded, perform interrupt processing or periodic polling processing on the first message.
[0176] Optionally, the processing module 520 may be further configured to, when it is determined that the first message needs to be routed and forwarded, route and forward the first message.
[0177] Optionally, the processing module 520 can also be used to forward the first message in real time when the first message corresponds to the fifth priority; or to perform periodic polling forwarding on the first message when the first message corresponds to the sixth priority, wherein the fifth priority is higher than the sixth priority.
[0178] It should be understood that the division of the various units in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into a physical entity, or they can be physically separated. In addition, the units in the device can be implemented in the form of a processor calling software; for example, the device includes a processor, the processor is connected to a memory, the memory stores instructions, and the processor calls the instructions stored in the memory to implement any of the above methods or the functions of the various units of the device, wherein the processor is, for example, a general-purpose processor, such as a CPU or a microprocessor, and the memory is a memory within the device or a memory outside the device. Alternatively, the units in the device can be implemented in the form of hardware circuits, and the functions of some or all units can be implemented by designing the hardware circuits. The hardware circuit can be understood as one or more processors; for example, in one implementation, the hardware circuit is an application-specific integrated circuit (ASIC), and the functions of some or all of the above units can be implemented by designing the logical relationships of the components within the circuit; for example, in another implementation, the hardware circuit can be implemented by a programmable logic device (PLD). Taking FPGA as an example, it can include a large number of logic gate circuits, and the connection relationship between the logic gate circuits is configured through a configuration file to implement the functions of some or all of the above units. All units of the above apparatus may be implemented entirely in the form of software called by a processor, or entirely in the form of hardware circuits, or partially in the form of software called by a processor and the rest in the form of hardware circuits.
[0179] In an embodiment of the present application, a processor is a circuit with a signal processing capability. In one implementation, the processor may be a circuit with instruction reading and execution capability, such as a CPU, a microprocessor, a graphics processing unit (GPU), or a DSP; in another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit may be fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration may be understood as the process of the processor loading instructions to implement the functions of some or all of the above units. In addition, it may also be a hardware circuit designed for artificial intelligence, which may be understood as an ASIC, such as a neural network processing unit (NPU), a tensor processing unit (TPU), a deep learning processing unit (DPU), and the like.
[0180] It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.
[0181] In addition, the various units in the above apparatus may be fully or partially integrated together, or may be implemented independently. In one implementation, these units are integrated together and implemented in the form of a system-on-chip (SoC). The SoC may include at least one processor for implementing any of the above methods or implementing the functions of the various units of the apparatus. The at least one processor may be of different types, for example, including a CPU and an FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, etc.
[0182] Figure 6 is a schematic block diagram of another message processing device provided in an embodiment of the present application. The message processing device 600 shown in Figure 6 may include: a processor 610, a transceiver 620, and a memory 630. Among them, the processor 610, the transceiver 620, and the memory 630 are connected via an internal connection path, the memory 630 is used to store computer programs (i.e., instructions), the processor 610 is used to execute the computer program stored in the memory 630, and the transceiver 620 receives / sends some parameters. Optionally, the memory 630 can be coupled to the processor 610 through an interface, or can be integrated with the processor 610.
[0183] It should be noted that the transceiver 620 may include but is not limited to a transceiver device such as an input / output interface to implement communication between the device 600 and other devices or a communication network.
[0184] During implementation, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 610 or by instructions in the form of software. The method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 630, and the processor 610 reads the information in the memory 630 and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
[0185] The processor 610 can be a general-purpose CPU, microprocessor, ASIC, GPU, or one or more integrated circuits, configured to execute relevant programs to implement the message processing method of the present invention. The processor 610 can also be an integrated circuit chip with signal processing capabilities. In specific implementations, the various steps of the message processing method of the present invention can be performed by hardware integrated logic circuits or software instructions within the processor 610. The processor 610 can also be a general-purpose processor, DSP, ASIC, FPGA, or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software modules can be located in storage media well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or the like. The storage medium is located in the memory 630, and the processor 610 reads the information in the memory 630 and executes the method for processing messages in the embodiment of the method of the present application in combination with its hardware.
[0186] The memory 630 may be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM).
[0187] The transceiver 620 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the apparatus 600 and other devices or a communication network. For example, the first message can be received by the transceiver 620.
[0188] An embodiment of the present application also provides a message processing system, including: a message transceiver for receiving messages; the above-mentioned message processing device for obtaining messages from the message transceiver and processing the obtained messages according to the above-mentioned method 100 or 200 or the processing flow shown in Figure 4.
[0189] An embodiment of the present application also provides a vehicle, which may include the above-mentioned device 500, or the above-mentioned device 600, or the above-mentioned system 300, or the above-mentioned system 400.
[0190] An embodiment of the present application further provides a computer program product, which includes: computer program code, which, when executed on a computer, enables the computer to execute the above-mentioned method 100 or 200 or the message processing flow shown in FIG4 .
[0191] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a computer, the above-mentioned method 100 or 200 or the message processing flow shown in FIG. 4 is implemented.
[0192] An embodiment of the present application also provides a chip, which includes a processor for calling a computer program or computer instruction stored in a memory so that the processor executes the above-mentioned method 100 or 200 or the message processing flow shown in Figure 4.
[0193] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0194] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0195] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0196] The units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0197] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0198] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program code, such as a USB flash drive, a mobile hard drive, ROM, RAM, a magnetic disk, or an optical disk.
[0199] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A message processing method, characterized in that: include: Obtaining a first message, where the first message corresponds to a first identifier; Determining a priority of the first message according to the first identifier; When the first message corresponds to a first priority, interrupt processing is performed on the first message; or when the first message corresponds to a second priority, periodic polling processing is performed on the first message, wherein the first priority is higher than the second priority.
2. The method according to claim 1, characterized in that The interrupt processing of the first message includes: When the first priority is the third priority, directly interrupt processing is performed on the first message; or, When the first priority is the fourth priority, interrupt processing is performed on the first message based on a first queue, where the first queue is a queue with a priority higher than a first threshold among at least two queues, and the third priority is higher than the fourth priority.
3. The method according to claim 2, characterized in that The periodic polling processing of the first message includes: performing periodic polling processing on the first message based on a second queue, where the second queue is a queue with a priority lower than a second threshold among the at least two queues.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Determining, according to the first identifier, that the first message is associated with a first processing unit; Acquire a second message, where the second message includes a second identifier; Determining, according to the second identifier, that the second message is associated with the second processing unit; The first message and the second message are processed based on the first processing unit and the second processing unit respectively.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Determine whether the first message needs to be routed and forwarded according to the first identifier; When it is determined that the first message does not need to be routed and forwarded, the interrupt processing or the periodic polling processing is performed on the first message.
6. The method according to claim 5, characterized in that The method further comprises: When it is determined that the first message needs to be routed and forwarded, the first message is routed and forwarded.
7. The method according to claim 6, characterized in that The routing and forwarding of the first message includes: When the first message corresponds to the fifth priority, the first message is forwarded in real time; or when the first message corresponds to the sixth priority, the first message is periodically polled and forwarded, wherein the fifth priority is higher than the sixth priority.
8. A message processing device, characterized in that: Including acquisition module and processing module, The acquisition module is used to acquire a first message, where the first message corresponds to a first identifier; The processing module is used to determine the priority of the first message according to the first identifier; when the first message corresponds to a first priority, interrupt processing is performed on the first message; or when the first message corresponds to a second priority, periodically polling processing is performed on the first message, wherein the first priority is higher than the second priority.
9. The device according to claim 8, characterized in that The processing module is also used for: When the first priority is the third priority, the first message is directly interrupted; or, when the first priority is the fourth priority, the first message is interrupted based on a first queue, and the first queue is a queue with a priority higher than a first threshold among at least two queues, wherein the third priority is higher than the fourth priority.
10. The device according to claim 9, characterized in that The processing module is also used for: The first message is periodically polled based on a second queue, where the second queue is a queue with a priority lower than a second threshold among the at least two queues.
11. The device according to any one of claims 8 to 10, characterized in that The acquisition module is further used to acquire a second message, where the second message includes a second identifier; The processing module is also used to determine that the first message is associated with a first processing unit based on the first identifier; determine that the second message is associated with a second processing unit based on the second identifier; and process the first message and the second message based on the first processing unit and the second processing unit, respectively.
12. The device according to any one of claims 8 to 11, characterized in that The processing module is also used for: Determine whether the first message needs to be routed and forwarded according to the first identifier; when it is determined that the first message does not need to be routed and forwarded, perform the interrupt processing or the periodic polling processing on the first message.
13. The device according to claim 12, characterized in that The processing module is also used for: When it is determined that the first message needs to be routed and forwarded, the first message is routed and forwarded.
14. The device according to claim 13, characterized in that The processing module is also used for: When the first message corresponds to the fifth priority, the first message is forwarded in real time; or when the first message corresponds to the sixth priority, the first message is periodically polled and forwarded, wherein the fifth priority is higher than the sixth priority.
15. A message processing device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program stored in the memory, so that the apparatus performs the method according to any one of claims 1 to 7.
16. A message processing system, characterized in that: include: A message transceiver, configured to receive the first message; The message processing device according to any one of claims 8 to 15, configured to obtain the first message from the message transceiver and process the first message.
17. A vehicle, characterized in that: Comprising the apparatus as claimed in any one of claims 8 to 15; and / or comprising the system as claimed in claim 16.
18. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a computer, the method according to any one of claims 1 to 7 is implemented.
19. A chip, characterized in that: The chip includes a processor and a data interface, and the processor reads instructions stored in a memory through the data interface to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Interrupt request method based on time overhead and control device
CN119996514A
Vehicle power system case execution method and device, electronic equipment and storage medium
CN120469925A