Inter-core communication method and device, electronic equipment and storage medium

By setting priorities for different IPC channels and processing messages in order of priority, the problem of high-priority messages not being processed first in the existing technology is solved, and the efficiency of inter-core communication is improved.

CN120704903APending Publication Date: 2025-09-26SHANGHAI LIXIANG AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410317413.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-19
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In existing inter-core communication technologies, messages with higher priorities cannot be processed by the receiving core first, resulting in low message processing efficiency.

Method used

Set different priorities for different IPC channels in the configuration table. When the sending kernel responds to an interrupt signal, it reads messages from the message queue of the IPC channel in descending order of priority and writes the messages to the message queue of the IPC channel with the corresponding priority.

Benefits of technology

This ensures that high-priority messages can be processed first by the receiving core, improving the efficiency of inter-core communication and the priority of message processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704903A_ABST
    Figure CN120704903A_ABST
Patent Text Reader

Abstract

The invention provides an inter-core communication method and device, electronic equipment and a storage medium. The method comprises the following steps: setting different priorities for different IPC channels in a configuration table; in response to an interrupt signal sent by a sending end kernel, reading messages from the message queues of the corresponding IPC channels according to a sequence of priorities from high to low; according to the scheme, different priorities are set for different IPC channels in a configuration table through a receiving end kernel, and a sending end kernel obtains the priority of each message needing to be sent to the receiving end kernel; writing the message into a message queue of the IPC channel with the corresponding priority, and sending an interrupt signal to a receiving end kernel; in the embodiment of the invention, the receiving end kernel responds to the interrupt signal sent by the sending end kernel, and the message with the highest priority can be read from the message queue of the corresponding IPC channel according to the sequence of the priorities from high to low, so that the message with the highest priority can be preferentially processed by the receiving end kernel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of inter-core communication technology, and in particular to an inter-core communication method, device, electronic device, and storage medium. Background Art

[0002] In existing inter-core communication technologies, take the sending core sending a message to the receiving core as an example:

[0003] Both the sending and receiving kernels have built-in configuration tables, which are preset configuration tables for different IPC channels. The sending and receiving kernels can statically establish an inter-process communication (IPC) channel by modifying the channel priority parameters in the configuration table. The sending kernel writes the message to be transmitted into the message queue of the IPC channel, modifies the write index of the control block, and triggers an interrupt to notify the receiving kernel. After receiving the interrupt signal, the receiving kernel reads a message from the message queue of the IPC channel, modifies the read index of the control block, and then continues to process the next message in the IPC channel.

[0004] In the above inter-core communication scheme, messages are processed one by one according to the first-in, first-out principle of the message queue. If the sending core sends a higher-priority message that needs to be passed to the receiving core for processing, the higher-priority message will have to wait in the queue according to the first-in, first-out principle of the message queue and will not be processed by the receiving core first. Summary of the Invention

[0005] The present disclosure provides an inter-core communication method, device, electronic device, and storage medium.

[0006] According to a first aspect of the present disclosure, there is provided an inter-core communication method, comprising:

[0007] Set different priorities for different IPC channels in the configuration table, which is a preset configuration table for different IPC channels;

[0008] In response to the interrupt signal sent by the sending end core, the message is read from the message queue of the corresponding IPC channel in descending order of priority; the interrupt signal is used to indicate that the sending end core has completed writing the message to the message queue of the corresponding IPC channel.

[0009] In some embodiments of the present disclosure, in response to an interrupt signal sent by a sending-end kernel, reading messages from a message queue of a corresponding IPC channel in descending order of priority includes:

[0010] In response to an interrupt signal associated with the highest priority IPC channel sent by the sending end kernel, obtain queue information in the message queue of the highest priority IPC channel in order of priority, where the queue information includes at least a queue head address, a read index, and a write index;

[0011] Read the message in the queue address indicated by the read index and the queue first address;

[0012] Update the read index using the read index incremented by 1 to obtain the updated read index;

[0013] Read the message in the queue address indicated by the updated read index and queue first address;

[0014] Determine whether the read index and write index are the same;

[0015] If the judgment result is yes, the message is read from the message queue of the IPC channel except the one with the highest priority in descending order of priority.

[0016] In some embodiments of the present disclosure, in response to an interrupt signal sent by a sending-end kernel, reading messages from a message queue of a corresponding IPC channel in descending order of priority includes:

[0017] In response to the interrupt signal associated with the highest priority IPC channel sent by the sending end kernel, read the message from the message queue of the corresponding IPC channel in order of priority;

[0018] During the message reading process, if a new interrupt signal sent by the sending end kernel is obtained, it is determined whether the IPC channel associated with the new interrupt signal is marked with the priority ignored;

[0019] If the judgment result is no, read the message from the message queue of the corresponding IPC channel in descending order of priority.

[0020] According to a second aspect of the present disclosure, there is provided an inter-core communication method, comprising:

[0021] Obtaining the priority of each message in at least one message that needs to be sent to the receiving end kernel;

[0022] Write the message to the message queue of the IPC channel of the corresponding priority and send an interrupt signal to the receiving end kernel; the interrupt signal is used to enable the receiving end kernel to read the messages from the message queue of the corresponding IPC channel in descending order of priority.

[0023] In some embodiments of the present disclosure, writing a message to a message queue of an IPC channel of a corresponding priority includes:

[0024] Get the queue information of the message queue of the IPC channel corresponding to the message priority. The queue information includes at least the queue head address and write index.

[0025] Write the message to the queue address indicated by the write index and the queue first address;

[0026] Update the write index using the write index that has been incremented by 1.

[0027] In some embodiments of the present disclosure, after writing each message into the message queue of the IPC channel of the corresponding priority, the inter-core communication method provided by the present disclosure further includes:

[0028] In response to a new message that needs to be sent to the receiving end kernel, obtaining a priority corresponding to the new message;

[0029] Write the new message into the message queue of the IPC channel of the corresponding priority and send an interrupt signal to the receiving kernel.

[0030] In some embodiments of the present disclosure, sending an interrupt signal to a receiving-end core includes:

[0031] Determine whether the receiving core and the sending core belong to the same processor;

[0032] If the judgment result is yes, a software-triggered interrupt type interrupt signal is sent to the receiving end kernel;

[0033] If the judgment result is no, a shared peripheral interrupt type interrupt signal is sent to the receiving end core.

[0034] According to a third aspect of the present disclosure, an inter-core communication apparatus is provided, which is applied to a receiving-end core and includes:

[0035] A setting unit, used to set different priorities for different IPC channels in a configuration table, where the configuration table is a preset configuration table for different IPC channels;

[0036] The reading unit is used to respond to the interrupt signal sent by the sending end core and read the message from the message queue of the corresponding IPC channel in order of priority from high to low; the interrupt signal is used to indicate that the sending end core has completed writing the message to the message queue of the corresponding IPC channel.

[0037] According to a fourth aspect of the present disclosure, an inter-core communication apparatus is provided, which is applied to a sending-end kernel and includes:

[0038] an acquiring unit, configured to acquire the priority of each message in at least one message to be sent to the receiving end core;

[0039] The writing unit is used to write messages into the message queue of the IPC channel of the corresponding priority and send an interrupt signal to the receiving end kernel; the interrupt signal is used to enable the receiving end kernel to read messages from the message queue of the corresponding IPC channel in descending order of priority.

[0040] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:

[0041] at least one processor; and

[0042] a memory communicatively connected to at least one processor; wherein,

[0043] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of the first aspect or the second aspect.

[0044] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method of the aforementioned first aspect or second aspect.

[0045] The present disclosure provides an inter-core communication method, device, electronic device and storage medium. The inter-core communication method includes: the receiving end core sets different priorities for different IPC channels in the configuration table, and the configuration table is a preset configuration table of different IPC channels; the sending end core obtains the priority of each message in at least one message that needs to be sent to the receiving end core; writes the message to the message queue of the IPC channel of the corresponding priority, and sends an interrupt signal to the receiving end core; the interrupt signal is used to enable the receiving end core to read the message from the message queue of the corresponding IPC channel in order from high to low priority. The receiving end core responds to the interrupt signal sent by the sending end core and reads the message from the message queue of the corresponding IPC channel in order from high to low priority; the interrupt signal is used to indicate that the sending end core has completed writing the message to the message queue of the corresponding IPC channel.

[0046] According to the solution disclosed in the present invention, different priorities are set for different IPC channels in the configuration table by the receiving-end kernel, and the sending-end kernel obtains the priority of each message in at least one message that needs to be sent to the receiving-end kernel; the message is written into the message queue of the IPC channel of the corresponding priority, and an interrupt signal is sent to the receiving-end kernel; the receiving-end kernel responds to the interrupt signal sent by the sending-end kernel, and can read the highest priority message from the message queue of the corresponding IPC channel in order from high to low priority, so that the high-priority message can be processed first by the receiving-end kernel.

[0047] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.

[0049] Figure 1 A flowchart of the first inter-core communication method provided in an embodiment of the present disclosure;

[0050] Figure 2 A flowchart of a second inter-core communication method provided in an embodiment of the present disclosure;

[0051] Figure 3 A schematic structural diagram of the first inter-core communication device provided in an embodiment of the present disclosure;

[0052] Figure 4 A schematic diagram of the structure of a second inter-core communication device provided in an embodiment of the present disclosure;

[0053] Figure 5 A flowchart of an inter-core communication method provided for an application example of the present disclosure;

[0054] Figure 6 A schematic diagram of the multi-priority message processing process of the receiving end kernel provided by the application example of the present disclosure;

[0055] Figure 7 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION

[0056] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0057] In order to facilitate those skilled in the art to better understand the technical solutions described in the embodiments of the present disclosure, before introducing the embodiments of the present disclosure, a brief introduction to the relevant terms in this application is first given:

[0058] Inter-core communication / inter-process communication: In this application, it refers to the mechanism for different processor cores / processes to pass messages and share resources.

[0059] Mailbox interrupt: In this application, it refers to an IPC implementation based on hardware-specific memory access, which is mostly used for lightweight data communication (such as control information) between on-chip processors. It has the advantages of good real-time performance, high communication efficiency, and a wide range of applications. It is often used as an effective solution for heterogeneous core communication in real-time vehicle systems.

[0060] System on Chip (SoC): In this application, it refers to a dedicated integrated circuit product that includes a complete operating system and embedded software.

[0061] First In First Out (FIFO): in this application, it refers to a first-in-first-out data storage buffer.

[0062] An inter-core communication method provided by an embodiment of the present disclosure can be applied to a file system for managing a flash memory device. The execution subject of the method can be a file system or a file management module in an operating system kernel.

[0063] like Figure 1 As shown, the first inter-core communication method provided by the embodiment of the present disclosure is executed by a receiving end of the inter-core communication, and the method includes the following steps:

[0064] Step 101, setting different priorities for different IPC channels in a configuration table, where the configuration table is a preset configuration table for different IPC channels;

[0065] In one embodiment, the IPC channel refers to a channel for data communication between a sending-end core and a receiving-end core.

[0066] In one embodiment, both the sending end core and the receiving end core have a configuration table, and the configuration table is used to configure the priority, interrupt type, etc. for the IPC channel.

[0067] In one embodiment, the receiving end kernel sets different priorities for different IPC channels in the configuration table.

[0068] In one embodiment, the configuration table includes information such as channel ID, reverse channel ID, channel type, channel priority, buffer queue size, and first address.

[0069] In one embodiment, different IPC channels correspond to different channel IDs.

[0070] In one embodiment, different priorities may be set for different IPC channels in the configuration table by changing the channel priority parameters corresponding to different IPC channels in the configuration table.

[0071] In one embodiment, different priorities are set for different IPC channels in the configuration table in a static configuration manner.

[0072] In one embodiment, the channel type is used to indicate the type of interruption that triggers the message notification.

[0073] In one embodiment, the channel types include software-triggered interrupt types (such as SGI) and shared peripheral interrupt types (such as Mailbox).

[0074] In one embodiment, multiple priority levels can be set according to the needs of the message to be sent. If the priority level of the message to be sent is relatively low, a relatively low priority level can be roughly divided; if the priority level of the message to be sent is relatively high, a relatively high priority level can be further divided.

[0075] In one embodiment, the priority of the IPC channel is used to indicate the order in which messages in different IPC channels are sent, and messages in IPC channels with higher priorities are processed first.

[0076] Step 102: In response to the interrupt signal sent by the sending end kernel, read the message from the message queue of the corresponding IPC channel in descending order of priority;

[0077] In one embodiment, the message may be control information, status information, image information, and voice information.

[0078] In one embodiment, the interrupt signal is used to indicate that the sending end kernel has completed writing a message to the message queue of the corresponding IPC channel.

[0079] In one embodiment, the interrupt signal may be sent by an interrupt controller of the sending-end core.

[0080] In one embodiment, each interrupt signal corresponds to an IPC channel.

[0081] In one embodiment, the IPC channel corresponding to the interrupt signal sent by the sending end kernel is obtained, the message queue of the current IPC channel and all message queues with higher priorities than the current IPC channel are traversed, and the message with the highest priority is read.

[0082] The inter-core communication method provided by the embodiment of the present disclosure includes: setting different priorities for different IPC channels in a configuration table, where the configuration table is a preset configuration table of different IPC channels; responding to an interrupt signal sent by a sending-end core, reading messages from the message queue of the corresponding IPC channel in descending order of priority; the interrupt signal is used to indicate that the sending-end core has completed writing messages to the message queue of the corresponding IPC channel.

[0083] According to the solution disclosed in the present invention, different priorities are set for different IPC channels in the configuration table by the receiving-end kernel, and the sending-end kernel obtains the priority of each message in at least one message that needs to be sent to the receiving-end kernel; the message is written into the message queue of the IPC channel of the corresponding priority, and an interrupt signal is sent to the receiving-end kernel; the receiving-end kernel responds to the interrupt signal sent by the sending-end kernel, and can read the highest priority message from the message queue of the corresponding IPC channel in order from high to low priority, so that the high-priority message can be processed first by the receiving-end kernel.

[0084] In one embodiment, in response to an interrupt signal sent by a sending end kernel, reading messages from a message queue of a corresponding IPC channel in descending order of priority includes:

[0085] In response to an interrupt signal associated with the highest priority IPC channel sent by the sending end kernel, queue information in the message queue of the highest priority IPC channel is obtained in order of priority;

[0086] In one embodiment, the queue information includes at least a queue head address, a read index, and a write index.

[0087] In one embodiment, the queue information of the message queue of the IPC channel is usually stored in the control block of the IPC channel.

[0088] In one embodiment, the queue first address is used to indicate the address of the first message in the current message queue.

[0089] In one embodiment, the read index is used to indicate index information of a message to be read, that is, an offset based on the first address of the queue.

[0090] In one embodiment, the write index is used to indicate index information of a message that needs to be written.

[0091] Read the message in the queue address indicated by the read index and the queue first address;

[0092] In one embodiment, after reading the message in the queue address indicated by the read index and the queue head address, the read message is passed to the IPC callback function registered in the control block for processing.

[0093] Update the read index using the read index incremented by 1 to obtain the updated read index;

[0094] In one embodiment, the updated read index is used to indicate index information of a message that needs to be read next in the current priority message queue.

[0095] In one embodiment, by updating the read index with a read index that is incremented by 1, the messages in the current priority message queue can be read in sequence.

[0096] Read the message in the queue address indicated by the updated read index and queue first address;

[0097] In one embodiment, the message in the queue address indicated by the updated read index and the queue first address is adjacent to the message in the queue address indicated by the read index and the queue first address before the update.

[0098] Determine whether the read index and write index are the same;

[0099] In one embodiment, when the read index and the write index are the same, it indicates that the message queue is empty, that is, there is no message in the message queue.

[0100] If the judgment result is yes, the message is read from the message queue of the IPC channel except the one with the highest priority in descending order of priority.

[0101] In one embodiment, if the read index and the write index are the same, it means that the messages in the message queue of the highest priority IPC channel have been read, and it is necessary to read messages from the message queue of the IPC channel other than the highest priority IPC channel.

[0102] In one embodiment, if the read index and the write index are different, the message is continued to be read from the message queue of the highest priority IPC channel.

[0103] In one embodiment, step 102 includes:

[0104] In response to the interrupt signal associated with the highest priority IPC channel sent by the sending end kernel, read the message from the message queue of the corresponding IPC channel in order of priority;

[0105] In one embodiment, the interrupt signal is used to indicate that there is a new message written into the message queue.

[0106] In one embodiment, after each message is read, it is necessary to traverse all addresses in the message queue of each IPC channel in descending order of priority, and read the message in the address with the highest priority.

[0107] During the message reading process, if a new interrupt signal sent by the sending end kernel is obtained, it is determined whether the IPC channel associated with the new interrupt signal is marked with the priority ignored;

[0108] In one embodiment, the interrupt controller of the receiving-end core may obtain the new interrupt signal sent by the transmitting-end core.

[0109] In one embodiment, the processor used by the receiving core may be the same as or different from that used by the transmitting core.

[0110] In one embodiment, the IPC channel associated with the new interrupt signal refers to the IPC channel that receives the new interrupt signal.

[0111] In one embodiment, the tag-ignored priority refers to the IPC channel untagged priority.

[0112] In one embodiment, if the IPC channel tag associated with the interrupt signal ignores the priority, it does not conform to the application scenario of the inter-core communication method proposed in the present disclosure.

[0113] If the judgment result is no, read the message from the message queue of the corresponding IPC channel in descending order of priority.

[0114] In one embodiment, if the IPC channel associated with the interrupt signal is not marked to ignore priority, that is, the priority of the IPC channel is marked, it meets the application scenario of the inter-core communication method proposed in the present disclosure, and it is necessary to obtain the message in the first address of the message queue of the IPC channel with the highest priority in order from high to low priority of the IPC channel.

[0115] like Figure 2 As shown, the second inter-core communication method provided by the embodiment of the present disclosure is executed by the sending end of the inter-core communication, and the method includes the following steps:

[0116] Step 201, obtaining the priority of each message in at least one message to be sent to the receiving end kernel;

[0117] In one embodiment, the priority of each message in the at least one message may be the same or different.

[0118] In one embodiment, the priority of each message in at least one message that needs to be sent to the receiving end kernel may be obtained by setting a priority parameter in RabbitMQ.

[0119] Step 202: Write the message into the message queue of the IPC channel of the corresponding priority, and send an interrupt signal to the receiving end kernel; the interrupt signal is used to enable the receiving end kernel to read the messages from the message queue of the corresponding IPC channel in descending order of priority.

[0120] In one embodiment, when the IPC channel is marked to ignore priority, messages in the message queue of the IPC channel may be read according to a first-in-first-out principle.

[0121] In one embodiment, when the IPC channel is not marked to ignore priority, messages in the message queue of the IPC channel may be read in order of priority.

[0122] In one embodiment, writing a message to a message queue of an IPC channel of a corresponding priority level includes:

[0123] Get the queue information of the message queue of the IPC channel corresponding to the message priority;

[0124] In one embodiment, the queue information includes at least a queue head address and a write index.

[0125] In one embodiment, an IPC channel corresponding to the message priority is obtained. For example, if there are three IPC channels with high, medium and low priorities, message 1 is a very urgent message and belongs to the high-priority IPC channel. Message 4 is a generally urgent message and belongs to the medium-priority IPC channel. Message 7 is a non-urgent message and belongs to the low-priority IPC channel.

[0126] In one embodiment, the queue information of the message queue of the IPC channel corresponding to the message priority is obtained, including at least the queue first address and the write index, that is, the queue information of the message queue of the IPC channel corresponding to the message priority in the aforementioned embodiment is obtained, such as the queue information of the message queue of the high-priority IPC channel corresponding to the priority of message 1, including at least the queue first address and the write index.

[0127] Write the message to the queue address indicated by the write index and the queue first address;

[0128] In one embodiment, the queue address of the message queue is limited and may be 100 or 1000, which is not limited in the present disclosure.

[0129] In one embodiment, the message is written into the message queue of the IPC channel corresponding to the message priority, into the queue address indicated by the write index and the queue head address.

[0130] Update the write index using the write index that has been incremented by 1.

[0131] In one embodiment, the updated write index is used to indicate index information of a message to be written to the message queue of the current priority IPC channel next time.

[0132] In one embodiment, after writing the message into the message queue of the IPC channel of the corresponding priority, the inter-core communication method further includes:

[0133] In response to a new message that needs to be sent to the receiving end kernel, obtaining a priority corresponding to the new message;

[0134] In one embodiment, the new message is a message newly written into the message queue by the sending kernel.

[0135] In one embodiment, there may be one or more new messages.

[0136] Write the new message into the message queue of the IPC channel of the corresponding priority and send an interrupt signal to the receiving kernel.

[0137] In one embodiment, after receiving the interrupt signal, the receiving end kernel will re-traverse the message queues of all IPC channels and obtain the message in the message queue with the highest current priority.

[0138] In one embodiment, sending an interrupt signal to a receiving end core includes:

[0139] Determine whether the receiving core and the sending core belong to the same processor;

[0140] In one embodiment, the processor information of the receiving-end core and the transmitting-end core may be obtained from configuration information related to the receiving-end core and the transmitting-end core.

[0141] If the judgment result is yes, a software-triggered interrupt type interrupt signal is sent to the receiving end kernel;

[0142] In one embodiment, the software-triggered interrupt type interrupt signal refers to an interrupt signal generated by software by writing into a dedicated register.

[0143] If the judgment result is no, a shared peripheral interrupt type interrupt signal is sent to the receiving end core.

[0144] In one embodiment, the shared peripheral interrupt type interrupt signal refers to an interrupt signal sent by an external device accessible to the system.

[0145] In one embodiment, the external device may be a keyboard, a network adapter, a hard disk drive, or the like.

[0146] In one embodiment, the shared peripheral interrupt type interrupt signal may be level triggered or edge triggered.

[0147] In one embodiment, a Mailbox may be used to generate a shared peripheral interrupt type interrupt signal.

[0148] According to the solution of this disclosure:

[0149] First, the receiving-end kernel sets different priorities for different IPC channels in the configuration table, and the sending-end kernel obtains the priority of each message in at least one message that needs to be sent to the receiving-end kernel; the message is written into the message queue of the IPC channel of the corresponding priority, and an interrupt signal is sent to the receiving-end kernel; the receiving-end kernel responds to the interrupt signal sent by the sending-end kernel, and reads the highest-priority message from the message queue of the corresponding IPC channel in descending order of priority, so that the high-priority message can be processed first by the receiving-end kernel.

[0150] Secondly, in the order of message priority, the highest priority message is written to the first address of the message queue of the IPC channel of the corresponding priority. Considering that the message queue reads and writes messages according to the first-in-first-out principle, higher priority messages can be written at the front of the message queue to facilitate the reading of high priority messages first.

[0151] Corresponding to the above-mentioned inter-core communication method, the present invention also provides an inter-core communication device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment and will not be repeated in this invention.

[0152] Figure 3 A schematic diagram of the structure of the first inter-core communication device provided in the embodiment of the present disclosure is shown as follows: Figure 3 As shown, the inter-core communication device 300 includes:

[0153] A setting unit 301 is used to set different priorities for different IPC channels in a configuration table, where the configuration table is a preset configuration table for different IPC channels;

[0154] The reading unit 302 is used to respond to the interrupt signal sent by the sending end core and read the message from the message queue of the corresponding IPC channel in order of priority from high to low; the interrupt signal is used to indicate that the sending end core has completed writing the message to the message queue of the corresponding IPC channel.

[0155] In one embodiment, the reading unit 302 is specifically configured to:

[0156] In response to an interrupt signal associated with the highest priority IPC channel sent by the sending end kernel, obtain queue information in the message queue of the highest priority IPC channel in order of priority, where the queue information includes at least a queue head address, a read index, and a write index;

[0157] Read the message in the queue address indicated by the read index and the queue first address;

[0158] Update the read index using the read index incremented by 1 to obtain the updated read index;

[0159] Read the message in the queue address indicated by the updated read index and queue first address;

[0160] Determine whether the read index and write index are the same;

[0161] If the judgment result is yes, the message is read from the message queue of the IPC channel except the one with the highest priority in descending order of priority.

[0162] In one embodiment, the reading unit 302 is specifically configured to:

[0163] In response to the interrupt signal associated with the highest priority IPC channel sent by the sending end kernel, read the message from the message queue of the corresponding IPC channel in order of priority;

[0164] During the message reading process, if a new interrupt signal sent by the sending end kernel is obtained, it is determined whether the IPC channel associated with the new interrupt signal is marked with the priority ignored;

[0165] If the judgment result is no, read the message from the message queue of the corresponding IPC channel in descending order of priority.

[0166] Figure 4 A schematic diagram of the structure of the second inter-core communication device provided in the embodiment of the present disclosure is shown in FIG. Figure 4 As shown, the inter-core communication device 400 includes:

[0167] An acquiring unit 401 is configured to acquire the priority of each message in at least one message to be sent to a receiving end core;

[0168] The writing unit 402 is used to write the message into the message queue of the IPC channel of the corresponding priority and send an interrupt signal to the receiving end kernel; the interrupt signal is used to enable the receiving end kernel to read the message from the message queue of the corresponding IPC channel in descending order of priority.

[0169] In one embodiment, the writing unit 402 is specifically configured to:

[0170] Get the queue information of the message queue of the IPC channel corresponding to the message priority. The queue information includes at least the queue head address and write index.

[0171] Write the message to the queue address indicated by the write index and the queue first address;

[0172] Update the write index using the write index that has been incremented by 1.

[0173] In one embodiment, the inter-core communication device 400 further includes an interrupt sending unit, which is configured to:

[0174] In response to a new message that needs to be sent to the receiving end kernel, obtaining a priority corresponding to the new message;

[0175] Write the new message into the message queue of the IPC channel of the corresponding priority and send an interrupt signal to the receiving kernel.

[0176] In one embodiment, the interrupt sending unit is further configured to:

[0177] Determine whether the receiving core and the sending core belong to the same processor;

[0178] If the judgment result is yes, a software-triggered interrupt type interrupt signal is sent to the receiving end kernel;

[0179] If the judgment result is no, a shared peripheral interrupt type interrupt signal is sent to the receiving end core.

[0180] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and the principles are the same, which is not limited in this embodiment.

[0181] The inter-core communication method disclosed in the present invention is further illustrated below with reference to specific application examples.

[0182] Figure 5 A flow chart of an inter-core communication method provided for an application example of the present disclosure is shown as follows: Figure 5 As shown, the inter-core communication method provided by the application example of the present disclosure includes the following steps:

[0183] Step 501: The receiving end kernel sets different priorities for different IPC channels in a configuration table, where the configuration table is a preset configuration table for different IPC channels.

[0184] Step 502: The sending end core obtains the priority of each message in at least one message to be sent to the receiving end core;

[0185] Step 503: The sending end kernel obtains queue information of the message queue of the IPC channel corresponding to the priority of the message, where the queue information includes at least the queue head address and the write index.

[0186] Step 504: The sending end kernel writes the message to the queue address indicated by the write index and the queue first address;

[0187] In one embodiment, the sending end kernel updates the write index using the write index incremented by 1;

[0188] Step 505: In response to the presence of a new message that needs to be sent to the receiving end core, the sending end core obtains the priority corresponding to the new message;

[0189] Step 506: The sending end kernel writes the new message into the message queue of the IPC channel of the corresponding priority.

[0190] Step 507, determining whether the receiving end core and the sending end core belong to the same processor;

[0191] If the judgment result is yes, then go to step 508;

[0192] If the judgment result is no, then go to step 509;

[0193] Step 508: The sending end core sends a software-triggered interrupt signal to the receiving end core.

[0194] Step 509: The sending end core sends a shared peripheral interrupt type interrupt signal to the receiving end core;

[0195] Step 510: The receiving end core responds to the interrupt signal sent by the sending end core and obtains the interrupt signal sent by the sending end core; the interrupt signal is used to indicate that the sending end core has completed writing the message to the message queue of the corresponding IPC channel;

[0196] Step 511: In response to an interrupt signal associated with the highest-priority IPC channel sent by the sending-end core, the receiving-end core obtains queue information of the message queue of the highest-priority IPC channel in order of priority. The queue information includes at least a queue head address, a read index, and a write index.

[0197] Step 512: The receiving end kernel reads the message in the queue address indicated by the read index and the queue first address;

[0198] Step 513: The receiving end kernel updates the read index using the read index incremented by 1 to obtain an updated read index.

[0199] Step 514: The receiving end kernel reads the updated read index and the message in the queue address indicated by the queue first address;

[0200] Step 515, determine whether the read index and the write index are the same;

[0201] If the judgment result is yes, then go to step 516;

[0202] If the judgment result is no, return to step 513;

[0203] Step 516: Read messages from the message queue of the IPC channel except the one with the highest priority in descending order of priority.

[0204] In one embodiment, the receiving end core updates the read index using the read index incremented by 1 until the read index and the write index are the same.

[0205] In one embodiment, if Figure 6 Figure 2 shows a schematic diagram of the multi-priority message processing process in the receiving kernel.

[0206] Four IPC channels are established between the sending and receiving cores, with priorities increasing from bottom to top. The numbers in the blocks in the figure indicate the order in which messages are processed. Messages 1, 2, 3, 5, 6, 8, and 9 correspond to messages to be processed in each channel at the initial moment (when the interrupt service is initiated after receiving the L1 channel interrupt notification). Message 4 corresponds to a message sent during the processing of message 3, and message 7 corresponds to a message sent during the processing of message 6. The specific processing flow is as follows:

[0207] Prepare to process messages on the L1 channel. First, detect and process message 1 on the L3 channel. Then process message 2 on the L3 channel. At this time, there are no unprocessed messages in the L3 channel, and enter the L2 channel.

[0208] After processing message 3 of the L2 channel, if it detects that message 4 is put into the higher priority L3 channel, it will switch to the L3 channel to process message 4. At this time, there are no unprocessed messages in the L3 channel, so it enters the L2 channel.

[0209] After processing message 5 of the L2 channel, it is detected that there are no unprocessed messages in the L3 channel and the L2 channel, and then enters the L1 channel.

[0210] After processing message 6 of the L1 channel, if it is detected that there is no unprocessed message on the L3 channel but a new message 7 is put into the L2 channel, message 7 of the L2 channel will be processed first, and then messages 8 and 9 of the L1 channel will be processed.

[0211] In one embodiment, multiple message queues of different priorities may be placed in different buffers of an IPC channel to save interrupt resources.

[0212] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device and a non-transitory computer-readable storage medium storing computer instructions.

[0213] Specifically, an embodiment of the present disclosure provides an electronic device, including:

[0214] at least one processor; and

[0215] a memory communicatively connected to at least one processor; wherein,

[0216] The memory stores instructions that can be executed by at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the above-mentioned inter-core communication method.

[0217] An embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the steps of the aforementioned inter-core communication method.

[0218] Figure 7A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, in-vehicle devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0219] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 702 or a computer program loaded from a storage unit 708 into a RAM (Random Access Memory) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An I / O (Input / Output) interface 705 is also connected to the bus 704.

[0220] Various components in device 700 are connected to I / O interface 705, including an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0221] The computing unit 701 can be various general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various specialized AI (Artificial Intelligence) computing chips, various computing units that run machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as the inter-core communication method. For example, in some embodiments, the inter-core communication method can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the method described above can be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to execute the aforementioned inter-core communication method in any other appropriate manner (eg, by means of firmware).

[0222] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System on Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0223] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0224] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0225] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0226] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. An inter-core communication method, applied to a receiving end core, characterized in that: include: Setting different priorities for different IPC channels in a configuration table, where the configuration table is a preset configuration table for different IPC channels; In response to an interrupt signal sent by the sending end core, messages are read from the message queue of the corresponding IPC channel in order of priority from high to low; the interrupt signal is used to indicate that the sending end core has completed writing messages to the message queue of the corresponding IPC channel.

2. The method according to claim 1, characterized in that The method of responding to the interrupt signal sent by the sending end kernel and reading the message from the message queue of the corresponding IPC channel in descending order of priority includes: In response to an interrupt signal associated with the highest priority IPC channel sent by the sending end kernel, obtaining queue information in a message queue of the highest priority IPC channel in order of priority, wherein the queue information includes at least a queue head address, a read index, and a write index; Reading a message in a queue address indicated by the read index and the queue first address; Updating the read index using the read index incremented by 1 to obtain an updated read index; Read the updated read index and the message in the queue address indicated by the queue first address; Determining whether the read index and the write index are the same; If the judgment result is yes, then read the messages from the message queue of the IPC channel except the one with the highest priority in descending order of priority.

3. The method according to claim 1, characterized in that The responding to the interrupt signal sent by the sending end kernel, reading the message from the message queue of the corresponding IPC channel in descending order of priority, includes: In response to an interrupt signal associated with the IPC channel with the highest priority sent by the sending end kernel, read messages from the message queue of the corresponding IPC channel in order of the priority; During the message reading process, if a new interrupt signal sent by the sending end kernel is obtained, determining whether the IPC channel associated with the new interrupt signal is marked with an ignore priority; If the judgment result is no, read the messages from the message queue of the corresponding IPC channel in descending order of priority.

4. An inter-core communication method, applied to a sending end core, characterized in that: include: Obtaining the priority of each of at least one message that needs to be sent to the receiving end kernel; The message is written into the message queue of the IPC channel of the corresponding priority, and an interrupt signal is sent to the receiving end core; the interrupt signal is used to enable the receiving end core to read messages from the message queue of the corresponding IPC channel in order of the priority from high to low.

5. The method according to claim 4, characterized in that Writing the message into the message queue of the IPC channel of the corresponding priority includes: Obtain queue information of a message queue of the IPC channel corresponding to the priority of the message, wherein the queue information includes at least a queue head address and a write index; Writing the message into the queue address indicated by the write index and the queue first address; The write index is updated using the write index that is incremented by 1.

6. The method according to claim 4, characterized in that After writing each of the messages into the message queue of the IPC channel of the corresponding priority, the method further comprises: In response to a new message that needs to be sent to the receiving end kernel, obtaining a priority corresponding to the new message; The new message is written into the message queue of the IPC channel of the corresponding priority, and an interrupt signal is sent to the receiving end kernel.

7. The method according to claim 4, characterized in that The sending of an interrupt signal to the receiving end core includes: Determining whether the receiving-end core and the sending-end core belong to the same processor; If the judgment result is yes, sending a software-triggered interrupt type interrupt signal to the receiving end kernel; If the judgment result is no, a shared peripheral interrupt type interrupt signal is sent to the receiving end core.

8. An inter-core communication device, applied to a receiving end core, characterized in that: include: A setting unit, configured to set different priorities for different IPC channels in a configuration table, wherein the configuration table is a preset configuration table for different IPC channels; A reading unit is used to respond to an interrupt signal sent by the sending end core and read messages from the message queue of the corresponding IPC channel in order of priority from high to low; the interrupt signal is used to indicate that the sending end core has completed writing messages to the message queue of the corresponding IPC channel.

9. An inter-core communication device, applied to a sending end core, characterized in that: include: an acquiring unit, configured to acquire the priority of each of at least one message to be sent to the receiving end core; A writing unit is used to write the message into the message queue of the IPC channel of the corresponding priority and send an interrupt signal to the receiving end core; the interrupt signal is used to enable the receiving end core to read messages from the message queue of the corresponding IPC channel in the order of the priority from high to low.

10. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 3 or claims 4 to 7.

11. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 3 or claims 4 to 7.