Inter-core communication method and device, electronic component and electronic equipment
By introducing multiple communication channels into electronic devices and selecting appropriate channels for data transmission, the problem of lack of flexibility in existing dual-core equipment communication methods is solved, and the rate, real-time and stability of data transmission are improved.
Patent Information
- Application Number
- CN202510102980.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-18
- Publication Date
- 2025-05-16
AI Technical Summary
The lack of flexibility in communication methods of existing dual-core electronic devices leads to insufficient data transmission rate, real-time and stability.
Multiple communication channels are introduced in electronic devices, each channel has different communication performance. After obtaining the data to be transmitted, an appropriate channel is selected from the multiple channels for data transmission.
It improves the flexibility of communication mode between dual cores, so that data transmission can be adapted according to the required performance, improving the transmission rate, real-time and stability.
Smart Images

Figure CN120011107A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and more specifically, to an inter-core communication method, device, electronic component and electronic device. Background Art
[0002] In electronic devices, dual-core solutions are used to improve performance and user experience. In some cases, the dual cores of an electronic device communicate with each other to implement some business functions. However, the flexibility of the communication method between the two cores needs to be improved. Summary of the invention
[0003] In view of the above problems, the present application proposes an inter-core communication method, device, electronic component and electronic device to improve the above problems.
[0004] In a first aspect, the present application provides an inter-core communication method, which is applied to an electronic device, wherein the electronic device includes at least a first core and a second core, wherein there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different. The method includes: obtaining data to be transmitted, wherein the data to be transmitted is data transmitted between the first core and the second core; obtaining a communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel; and transmitting the data to be transmitted through the target communication channel.
[0005] In a second aspect, the present application provides an inter-core communication device that runs on an electronic device, wherein the electronic device includes at least a first core and a second core, wherein there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different, and the device includes: a data acquisition unit, used to acquire data to be transmitted, wherein the data to be transmitted is data transmitted between the first core and the second core; a channel selection unit, used to acquire the communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel; and a data communication unit, used to transmit the data to be transmitted through the target communication channel.
[0006] In a third aspect, the present application provides an electronic component, including a first core and a second core, wherein there are multiple communication channels between the first core and the second core, and the multiple communication channels have different communication performances; the first core is used to obtain data to be transmitted; obtain the communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel; and transmit the data to be transmitted to the second core through the target communication channel.
[0007] In a fourth aspect, the present application provides an electronic device, comprising a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the above method.
[0008] In a fifth aspect, the present application provides a computer-readable storage medium, in which program code is stored, wherein the above method is executed when the program code is executed by a processor.
[0009] The present application provides an inter-core communication method, device, electronic component and electronic device. When the electronic device includes at least a first core and a second core, there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different, after obtaining the data to be transmitted between the first core and the second core, the communication channel corresponding to the data to be transmitted can be selected from the multiple communication channels as the target communication channel, and then the data to be transmitted can be transmitted through the target communication channel. Therefore, through the above method, when data needs to be transmitted between the first core and the second core, the data to be transmitted can be transmitted through the communication channel adapted to the required transmission data, thereby improving the flexibility of the communication method between the two cores. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 A schematic diagram of the architecture of a multi-core electronic device proposed in an embodiment of the present application is shown;
[0012] Figure 2 A flow chart of a first core actively transmitting data to a second core according to an embodiment of the present application is shown;
[0013] Figure 3 A flowchart of a first core actively reading data from a second core proposed in an embodiment of the present application is shown;
[0014] Figure 4 A schematic diagram showing a communication architecture in an electronic device proposed in an embodiment of the present application is shown;
[0015] Figure 5 A flow chart of an inter-core communication method proposed in one embodiment of the present application is shown;
[0016] Figure 6A flow chart of an inter-core communication method proposed in another embodiment of the present application is shown;
[0017] Figure 7 A schematic diagram of a sending buffer in an embodiment of the present application is shown;
[0018] Figure 8 A schematic diagram showing the splitting of data to be transmitted in an embodiment of the present application is shown;
[0019] Fig. 9 A schematic diagram showing the most forward transmission position in an embodiment of the present application;
[0020] Fig.10 A flowchart of an inter-core communication method proposed in another embodiment of the present application is shown;
[0021] Fig.11 Shows this application Fig.10 A schematic diagram of a data transmission path in an embodiment;
[0022] Fig.12 A structural block diagram of an inter-core communication device proposed in an embodiment of the present application is shown;
[0023] Fig.13 A structural block diagram of an electronic device for executing an inter-core communication method according to an embodiment of the present application is shown;
[0024] Fig.14 It is a storage unit of an embodiment of the present application for storing or carrying program codes for implementing the inter-core communication method according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] As the functions of electronic devices become increasingly rich, the amount of data that electronic devices need to process is also gradually increasing. In order to have the ability to process more data, electronic devices can be configured with more devices for data processing. For example, data processing can be performed by configuring a multi-core processor in an electronic device. A multi-core processor refers to the integration of two or more complete computing engines (cores) in a processor. At this time, the processor can support multiple processors on the system bus, and all bus control signals and command signals are provided by the bus controller. Furthermore, data processing can also be performed by configuring multiple processors in an electronic device. Exemplarily, data processing can be performed by configuring a CPU and an MCU (Microcontroller Unit). Among them, it should be noted that in the process of data processing by the CPU and the MCU, the data to be processed can be understood as actually being processed by the core in the CPU and the core in the MCU, and the corresponding process of communication between the CPU and the MCU also corresponds to the communication between the core in the CPU and the core in the MCU, wherein the core in the CPU and the core in the MCU can be understood as the module responsible for data processing.
[0027] However, after studying the schemes for data processing by related multi-core processors or multiple processors, the inventors found that there are still problems of poor data communication performance and lack of flexibility between the related multi-core processors and the related multiple processors. For example, when an electronic device has multiple processors, there is only one communication channel between the multiple processors, so that no matter what type of data can only be transmitted through this communication channel, which makes data communication relatively inflexible. In addition, because there is only one communication channel for data transmission, the speed, real-time performance and stability of data transmission need to be improved.
[0028] Therefore, after discovering the above problems in the research, the inventor proposed the inter-core communication method, device, electronic component and electronic device in the present application that can improve the above problems. Thus, when the electronic device includes at least a first core and a second core, there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different, after obtaining the data to be transmitted between the first core and the second core, the communication channel corresponding to the data to be transmitted can be selected from the multiple communication channels as the target communication channel, and then the data to be transmitted can be transmitted through the target communication channel. Therefore, through the above method, when it is necessary to transmit data between the first core and the second core, the data to be transmitted can be transmitted through the communication channel adapted to the required transmission data, thereby improving the flexibility of the communication method between the two cores.
[0029] The following first introduces the hardware architecture of the electronic device involved in the embodiments of the present application.
[0030] like Figure 1 As shown, in Figure 1 In the architecture of the electronic device shown, a first core 10 and a second core 20 are exemplarily shown. There are communication channels 30, 40 and 50 between the first core 10 and the second core 20.
[0031] The communication channel 30 includes a data line 31 for data transmission and a timing line 32 for timing control. Under the control of the timing line 32, the first core 10 and the second core 20 can actively transmit data based on the data line 31. Optionally, the data line 31 is a data line based on the serial peripheral interface SPI (Serial Peripheral Interface) communication protocol. The communication performance of the first communication channel 30 is high data transmission and reception speed, low power consumption and strong robustness.
[0032] Below through Figure 2 and Figure 3 The content shown introduces the timing of data transmission based on the communication channel 30.
[0033] like Figure 2 The timing of the first core 10 actively transmitting data to the second core 20 is shown, including:
[0034] S101: Wait for the first signal line to be set;
[0035] S102: The first signal line triggers a first level signal;
[0036] S103: Lock the SPI bus;
[0037] S104: Wait for the second signal line to be set;
[0038] S105: The second signal line triggers a first level signal;
[0039] S106: writing data to the second core;
[0040] S107: Wait for the second signal line to be reset;
[0041] S108: The second signal line triggers a second level signal;
[0042] S109: unlock the SPI bus;
[0043] S110: The first signal line is reset.
[0044] For example Figure 3 As shown, the timing of the second core 20 actively transmitting data to the first core 10 includes:
[0045] S110: Waiting for data;
[0046] S111: lock the SPI bus;
[0047] S112: prepare data to be sent;
[0048] S113: Wait for the third signal line to be set;
[0049] S114: The third signal line triggers a first level signal;
[0050] S115: Read data from the second core;
[0051] S116: Waiting for the signal of the fourth signal line;
[0052] S117: the fourth signal line triggers a third level signal;
[0053] S118: The third signal line is reset;
[0054] S119: Unlock the SPI bus.
[0055] It should be noted that the aforementioned timing line 32 may include a first signal line, a second signal line, a third signal line and a fourth signal line, wherein the first level signal may be a rising edge signal, the second level signal may be a falling edge signal, and the third level signal may be a high level signal.
[0056] The communication channel 40 includes a data line 41 for data transmission and a flow control line 42 for flow control. The flow control line 42 can be used to control the start and stop of data transmission in the data line 41. Optionally, the data line 41 can be a data line based on an asynchronous serial communication protocol (Universal Asynchronous Receiver / Transmitter). The communication performance of the communication channel 40 is high in real time and stable in transmission.
[0057] The communication channel 50 includes a data line 51 for the first core 10 to request the second core 20 for the working state and register state of the second core 20, and a data line 52 for the second core 20 to output log data to the first core 10. Optionally, the data line 51 may be a line based on the SWD (Serial wire debug) communication protocol, in which case the data line 51 may include a SWDIO data line and a SWCLK clock line.
[0058] It should be noted that Figure 1 The structure shown is only exemplary. Figure 1In addition to the first core 10 and the second core 20 in the embodiment, more cores may be included, and the communication channels between the more cores may also be Figure 1 In the manner shown in . Furthermore, the communication channel between the first core 10 and the second core 20 may also include some of the three communication channels mentioned above. For example, only the communication channel 30 and the communication channel 40 may be included, in which case the data originally transmitted by the communication channel 50 may be transmitted by the communication channel 30 and / or the communication channel 40. For another example, only the communication channel 30 and the communication channel 50 may be included, in which case the data originally transmitted by the communication channel 40 may be transmitted by the communication channel 30.
[0059] Furthermore, it should be noted that the first core 10 and the second core 20 may belong to the same processor or to different processors. For example, the first core 10 may be a core (e.g., a CPU) that carries an operating system (e.g., Android), and the second core 20 may be a core (e.g., an MCU) that carries sensor data.
[0060] The following is an introduction to a communication architecture involved in an embodiment of the present application.
[0061] like Figure 4 As shown, in Figure 4 The first corresponding business in the communication architecture shown will generate the data to be transmitted as the data to be transmitted, and the data to be transmitted will be selected from the subsequent SPI communication protocol, UART communication protocol and SWD communication protocol through the data routing algorithm as the protocol for transmitting the data to be transmitted. Similarly, the data to be transmitted generated by the business corresponding to the second core can also be determined by a protocol in the aforementioned manner. Among them, it should be noted that the aforementioned multiple communication channels are implemented based on different communication protocols, so the selection of a protocol here can be understood as the selection of the target communication channel for the data to be transmitted.
[0062] It should be noted that Figure 4 The SPI communication protocol involved can be understood as the corresponding control line adding Figure 1 SPI communication protocol of the timing line 32.
[0063] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0064] See also Figure 5 An inter-core communication method provided in an embodiment of the present application is applied to an electronic device, wherein the electronic device includes at least a first core and a second core, and there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different. The method includes:
[0065] S210: Acquire data to be transmitted, where the data to be transmitted is data transmitted between the first core and the second core.
[0066] It should be noted that the data to be transmitted in this embodiment is data transmitted between the first core and the second core. Optionally, if the method provided by this embodiment is executed by the first core, the data to be transmitted is data transmitted from the first core to the second core; if the method provided by this embodiment is executed by the second core, the data to be transmitted is data transmitted from the second core to the first core.
[0067] The data to be transmitted may be data generated by the service layer. For example, if the first core transmits the firmware required by the second core to the second core, the data to be transmitted may be the firmware required to be transmitted. Furthermore, the data to be transmitted may also be control instructions or status reply data.
[0068] S220: Acquire a communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel.
[0069] Among them, multiple communication channels are configured between the first core and the second core as shown above, and the communication performances of different communication channels may be different, and then after obtaining the data to be transmitted, at least one communication channel can be selected from the multiple communication channels as the communication channel corresponding to the data to be transmitted. Among them, the communication performance in the embodiment of the present application can be understood as the ability to transmit data, such as transmission rate, real-time performance, and stability.
[0070] S230: Transmit the data to be transmitted through the target communication channel.
[0071] The present application provides an inter-core communication method, in which an electronic device includes at least a first core and a second core, there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different. After obtaining the data to be transmitted between the first core and the second core, a communication channel corresponding to the data to be transmitted can be selected from the multiple communication channels as a target communication channel, and then the data to be transmitted can be transmitted through the target communication channel. Therefore, through the above method, when data needs to be transmitted between the first core and the second core, the data to be transmitted can be transmitted through the communication channel adapted to the required transmission data, thereby improving the flexibility of the communication method between the two cores.
[0072] See also Figure 6An inter-core communication method provided in an embodiment of the present application is applied to an electronic device, wherein the electronic device includes at least a first core and a second core, and there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different. The method includes:
[0073] S310: Acquire data to be transmitted, where the data to be transmitted is data transmitted between the first core and the second core.
[0074] S320: Acquire the current data transmission mode.
[0075] It should be noted that, in this embodiment, the target communication channel for the data to be transmitted can be determined according to the current data transmission model.
[0076] In this embodiment, there are multiple ways to determine the current data transmission mode.
[0077] As a method, the current data transmission mode can be determined according to the throughput between the first core and the second core. It should be noted that the throughput between the first core and the second core may change in real time according to the actual situation. For example, in the process of the electronic device running more programs, there may be more data that needs to be exchanged between the first core and the second core, which will make the throughput between the first core and the second core relatively large. For another example, when the electronic device is in a dormant state, the electronic device does not need to perform more data processing, and the data that needs to be transmitted between the first core and the second core will be relatively small. In this way, when it is detected that the throughput between the first core and the second core is not greater than the specified transmission threshold, it can be determined that the current first data transmission mode is relatively small in data to be transmitted, and when it is detected that the throughput between the first core and the second core is greater than the specified transmission threshold, it can be determined that the current second data transmission mode is relatively large in data to be transmitted.
[0078] Optionally, the throughput can be characterized by obtaining the usage rate of a specified sending buffer. It should be noted that in this embodiment, the data to be transmitted for the determined target communication channel can be first stored in the sending buffer, and then the data to be transmitted can be taken out of the sending buffer and sent through the corresponding target communication channel. For example, Figure 7As shown, it includes a sending buffer 60 and a communication channel 30. After determining that the target communication channel corresponding to the data A to be sent is the communication channel 30, the data A to be sent can be stored in the sending buffer 60, and then the communication channel 30 can directly read the data from the sending buffer 60 for sending. Because the data in the sending buffer also needs to be sent in sequence, the larger the data to be sent in the sending buffer, the higher the utilization rate of the sending buffer. For example, if the utilization rate of the sending buffer is 50%, it means that half of the area of the sending buffer is occupied by the data to be sent.
[0079] Then, when the usage rate of the designated sending buffer is obtained as the throughput, the designated transmission threshold may be a usage rate threshold. Optionally, the usage rate threshold is 50%, and when the usage rate of the designated sending buffer is lower than 50%, it can be determined that the current mode is the aforementioned first data transmission mode, and when the usage rate of the designated sending buffer is not lower than 50%, it can be determined that the current mode is the aforementioned second data transmission mode.
[0080] It should be noted that the throughput between the first core and the second core may fluctuate. In order to be able to more accurately identify the current data transmission mode, it can be further detected that when the throughput between the first core and the second core is not greater than the specified transmission threshold within the specified time period, it is determined that the current mode is the first data transmission mode. Correspondingly, it can be detected that when the throughput between the first core and the second core is greater than the specified transmission threshold within the specified time period, it is determined that the current mode is the second data transmission mode. Exemplarily, taking the usage rate of the specified sending buffer as an example, the specified time period can be 1000ms. Correspondingly, if it is detected that the usage rate of the specified sending buffer is less than 50% within 1000ms, it is determined that the current mode is the aforementioned first data transmission mode. If it is detected that the usage rate of the specified sending buffer is not less than 50% within 1000ms, it is determined that the current mode is the aforementioned second data transmission mode.
[0081] Optionally, the designated sending buffer may be a sending buffer corresponding to a certain communication channel. For example, it may be a sending buffer corresponding to the first communication channel. It should be noted that the sending buffer corresponding to the communication channel may be understood as data buffered in the sending buffer being transmitted through the corresponding communication channel.
[0082] Furthermore, as another way, the data transmission mode may be determined according to the current running scenario. It should be noted that the electronic device may need to collect more data during the running of some programs, which results in more frequent data transmission between different cores.
[0083] For example, taking the electronic device as a wearable device, when the wearable device is in the user's motion data monitoring scenario, it is necessary to obtain the collected data of the sensor for motion monitoring at a higher frequency to perform some state recognition. Optionally, the data collection of the sensor can be controlled by the second core, and the state recognition therein is performed by the first core, then the second core will transmit the collected data of the sensor to the first core at a higher frequency so that the first core can perform faster state recognition. Correspondingly, after completing the state recognition, the first core will also continuously send some control instructions to the second core, which will also cause the first core to have more data to be transmitted to the second core. Furthermore, the electronic device can identify the current scene, and according to the pre-established correspondence between the scene and the data transmission mode, the data transmission mode corresponding to the current scene is used as the current data transmission mode. Optionally, the scene in which the electronic device is located may include a motion detection scene and a sleep scene, wherein the motion detection scene corresponds to the aforementioned second data transmission mode, and the sleep scene corresponds to the aforementioned first data transmission mode.
[0084] S330: Determine, based on the data transmission mode, from the multiple communication channels, a communication channel corresponding to the data to be transmitted as a target communication channel.
[0085] As a mode, the plurality of communication channels include a first communication channel and a second communication channel. The data transmission rate of the first communication channel is higher than the data transmission rate of the second communication channel, the transmission real-time performance of the second communication channel is higher than the transmission real-time performance of the first communication channel, and the power consumption of the first communication channel is lower than the power consumption of the second communication channel.
[0086] In this manner, the communication channel corresponding to the data to be transmitted is determined from the multiple communication channels based on the data transmission mode as the target communication channel, including: if the current mode is the first data transmission mode, the first communication channel among the multiple communication channels is used as the target communication channel; if the current mode is the second data transmission mode, the data type of the data to be transmitted is obtained; based on the data type, the communication channel corresponding to the data to be transmitted is determined from the multiple communication channels as the target communication channel.
[0087] It should be noted that, as shown in the above content, the throughput in the first data transmission mode is lower than the throughput in the second data transmission mode, and when the data transmission mode is the first data transmission mode, only the first communication channel can be used for data transmission between the first core and the second core, so as to reduce power consumption due to the low power consumption characteristics of the first communication channel while ensuring normal data transmission. In the second data transmission mode, the data to be transmitted is relatively more, so that both the first communication channel and the second communication channel can be used as target communication channels, and in order to further improve the flexibility of transmission, different types of data can be transmitted from the first communication channel or from the second communication channel respectively.
[0088] Optionally, determining the communication channel corresponding to the data to be transmitted from the multiple communication channels based on the data type as the target communication channel includes: if the data to be transmitted is real-time type data, using the second communication channel as the target communication channel; if the data to be transmitted is non-real-time type data, at least using the first communication channel as the target communication channel.
[0089] It is understandable that the second communication channel has better real-time performance than the first communication channel, and can enable data to be transmitted to the destination more timely. Then, in the case where both the first communication channel and the second communication channel can be used as the target communication channel, if the data to be transmitted is real-time data, in order to enable the data to be transmitted to be transmitted to the destination more timely, the second communication channel can be used as the target communication channel. If the data to be transmitted is non-real-time data, the data to be transmitted does not have to be transmitted to the destination in a timely manner, and the data to be transmitted can be transmitted alone through the first communication channel, or the data to be transmitted can be transmitted together through the first communication channel and the second communication channel.
[0090] As a common transmission mode, if the data to be transmitted is non-real-time data, at least the first communication channel is used as the target communication channel, including: if the data to be transmitted is non-real-time data, obtaining the occupancy level of the second communication channel; if the occupancy level is higher than the occupancy level threshold, using the first communication channel as the target communication channel; if the occupancy level is not higher than the occupancy level threshold, splitting the data to be transmitted into a first part and a second part, the first part and the second part respectively corresponding to numbers for sequential reorganization; using the first communication channel as the target communication channel of the first part, and using the second communication channel as the target communication channel of the second part.
[0091] It is understandable that the second communication channel has high real-time communication performance, but the electronic device may not always transmit real-time data. In this case, when the second communication channel is relatively idle (for example, the occupancy level of the second communication channel is not higher than the occupancy level threshold), using the second communication channel to transmit non-real-time data can help further improve data transmission efficiency. For example, Figure 8 As shown, both the communication channel 30 and the communication channel 40 can be used as the target communication channel, and the data B to be transmitted can be split into a first part b1 and a second part b2, and the target channel of the first part b1 is configured as the communication channel 30, and the target communication channel of the second part b2 is configured as the communication channel 40. Among them, the communication channel 30 is the first communication channel, and the communication channel 40 is the second communication channel.
[0092] It should be noted that different parts of the split data to be transmitted are transmitted by different communication channels, so that the time points at which different parts are transmitted to the destination may be different. Then, through the corresponding numbers of each part mentioned above, the different parts can be reorganized in a predetermined order to ensure the completeness and order of the data to be transmitted. For example, if the first part b1 is numbered n1 and the second part b1 is numbered n2, and then when it is recognized that n1 is sorted before n2, the second part b2 can be spliced to the end of the first part b1 when the first part b1 and the second part b2 are reorganized.
[0093] As a way, the occupancy degree of the second communication channel in this embodiment can be determined in a variety of ways. Optionally, the occupancy degree of the second communication channel can be characterized by the amount of data transmitted through the second communication channel in a specified time period. Furthermore, a sending buffer can be configured in the electronic device corresponding to each communication channel. Correspondingly, the occupancy degree of the second communication channel can be determined by obtaining the utilization rate of the sending buffer corresponding to the second communication channel. For example, if the utilization rate of the sending buffer corresponding to the second communication channel is greater than 50%, it is determined that the occupancy degree is higher than the occupancy degree threshold. Conversely, if the utilization rate of the sending buffer corresponding to the second communication channel is not greater than 50%, it is determined that the occupancy degree is not higher than the occupancy degree threshold.
[0094] In addition to the aforementioned first communication channel and second communication channel, the communication channel between the first core and the second core may optionally include a third channel, and obtaining the communication channel corresponding to the data to be transmitted from the multiple communication channels as the target communication channel also includes: if the data to be transmitted is status type data, obtaining the third communication channel from the multiple communication channels as the target communication channel.
[0095] S340: Transmit the data to be transmitted through the target communication channel.
[0096] After determining the target communication channel for the data to be transmitted in the aforementioned manner, the data to be transmitted can be transmitted through the corresponding target communication channel. It should be noted that real-time data may need to be transmitted to the destination more immediately. However, in some cases, the second data communication channel may still have a lot of data waiting to be transmitted. In order to facilitate faster transmission of real-time data, optionally, if the second data transmission mode is currently in effect and the data to be transmitted is real-time data, transmitting the data to be transmitted through the second communication channel includes: if the second data transmission mode is currently in effect and the data to be transmitted is real-time data, configuring the data to be transmitted to the frontmost transmission position in the sending buffer of the second communication channel for transmission. Optionally, as Fig. 9 As shown, the second communication channel 40 corresponds to a sending buffer 61, and the data that needs to be transmitted through the second communication channel 40 will be first buffered in the sending buffer 61, and then read into the second communication channel 40 for transmission. Among them, the sending buffer 61 will include multiple transmission positions for storing the buffered data, and each transmission position corresponds to a different transmission order, wherein the transmission order corresponding to the front transmission position has a higher priority.
[0097] It should be noted that the front can be understood as close to the exit of the sending buffer. It can be understood that the data in the sending buffer 61 is moved out of the sending buffer through the exit of the sending buffer and written into the second communication channel 40. Therefore, the closer the transmission position is to the exit of the sending buffer, the closer it is to the front. The data stored in the front transmission position in the sending buffer has the highest priority for transmission. In order to facilitate the transmission of the data to be transmitted to the second core as quickly as possible, the data to be transmitted can be configured to the front transmission position in the sending buffer for transmission when it is determined that the data to be transmitted is real-time data. For example, Fig. 9 As shown, the data currently being transmitted in the second communication channel 40 is the data B to be sent, and the data to be sent subsequently are the data C to be sent and the data D to be sent. Then, the data type currently being judged is the data E to be sent. If it is determined that the data E to be sent is real-time type data, the data E to be sent can be configured to the front transmission position in the sending buffer for transmission.
[0098] It should be noted that, in this embodiment, the first communication channel can be the aforementioned Figure 1 The communication channel 30 in the second communication channel may be Figure 1The communication channel 40 in the middle, the third communication channel can be Figure 1 The communication channel 50 in the embodiment. Furthermore, the first communication channel includes a data line for transmitting data between the first core and the second core, a first timing line for controlling the first core to actively send data to the second core, and a second timing line for controlling the second core to actively send data to the first core. The state type data may include data about the working state, data about the register state, and log data. Then, the third communication channel includes a third line for the first core to request the working state and register state of the second core from the second core, and a fourth line for the second core to output log data to the first core.
[0099] The present application provides an inter-core communication method, which can make it possible to transmit the data to be transmitted through the communication channel adapted to the required transmission data when data needs to be transmitted between the first core and the second core, thereby improving the flexibility of the communication method between the two cores. In addition, the first communication channel among the multiple communication channels in this embodiment has the characteristics of high data transmission rate, and the second communication channel has the characteristics of high transmission real-time performance, so that it is possible to choose whether to transmit data through the first communication channel or through the second communication channel according to the current data transmission mode, so as to improve the data transmission with high flexibility and good transmission real-time performance.
[0100] See also Fig.10 An inter-core communication method provided in an embodiment of the present application is applied to an electronic device, wherein the electronic device includes at least a first core and a second core, and there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different. The method includes:
[0101] S410: Acquire data to be transmitted, where the data to be transmitted is data transmitted between the first core and the second core.
[0102] S420: Obtain the type of the data to be transmitted.
[0103] S430: If the data to be transmitted is status type data, obtain the third communication channel from the multiple communication channels as the target communication channel.
[0104] S440: If the data to be transmitted is non-status type data, determine a communication channel corresponding to the data to be transmitted from the multiple communication channels based on the data transmission mode as a target communication channel.
[0105] S450: Transmit the data to be transmitted through the target communication channel.
[0106] It should be noted that the method of determining the communication channel corresponding to the data to be transmitted from the multiple communication channels based on the data transmission mode in this embodiment is the same as that in the above-mentioned embodiment. Fig.11 The schematic diagram shown is used to illustrate the overall process of this embodiment again. The upper-layer business can be an application layer business, for example, it can be a user's operation data monitoring business, or other debugging business. When the upper-layer business generates data that needs to be transmitted to another core, the data will be used as data to be transmitted. After obtaining the data to be transmitted, the type of the data to be transmitted will be identified first. If the data of the state type is identified, the third communication channel will be used as the target communication channel so that the data to be transmitted can be transmitted through the third communication channel. If the data of the non-state type is identified (wherein, the non-state type data can be understood as business data), the current data transmission mode will be identified. If the current mode is the aforementioned first data transmission mode, the first communication channel will be directly determined as the target communication channel, and the data to be transmitted will be stored in the first sending buffer corresponding to the first communication channel. If the current mode is the aforementioned second data transmission mode, the first data selector will be used to determine whether the data to be transmitted is real-time data. If it is real-time data, the first data selector can transmit the data to be transmitted to the queue-jumping module so that the queue-jumping module can store it in the second sending buffer corresponding to the second communication channel.
[0107] If the data is non-real-time type, the data to be transmitted will be further transmitted to the second data selector, and then the second data selector can determine whether to store the data to be transmitted in the first sending buffer or to split the data to be transmitted into a first part stored in the first sending buffer and a second part stored in the second sending buffer according to the aforementioned method.
[0108] It should be noted that, in the present embodiment, an identification table of real-time type data and a sequential dependency identification table may be pre-configured. Optionally, after obtaining the data to be transmitted, the first data selector may query whether there is an identification of the data to be transmitted in the identification table of the real-time type data. If the query finds that there is, it is determined that the data to be transmitted is real-time type data. Furthermore, when it is determined that the data to be transmitted is real-time type data, it may be further queried through the sequential dependency identification table whether the data to be transmitted can be queued to the front transmission position in the second communication channel for transmission. Optionally, if it is detected that the data to be transmitted also needs to rely on the data that has not been sent in the first buffer or the second buffer, even if the data to be transmitted is identified as real-time type data, it will not be queued to the front transmission position in the second communication channel for transmission, but will be configured to be transmitted after the unsent data it depends on.
[0109] The present application provides an inter-core communication method, which can first obtain the type of data to be transmitted, and directly transmit the status type data through the third communication channel, while the corresponding target communication channel can be determined in combination with the current data transmission mode for the non-status type data. Through the above method, when data needs to be transmitted between the first core and the second core, the data to be transmitted can be transmitted through the communication channel adapted to the required transmission data, thereby improving the flexibility of the communication method between the two cores, and different types of data can be transmitted through different communication channels, which is beneficial to isolating different types of data transmission from each other to avoid interference, thereby improving the data transmission rate while also improving the stability of data transmission.
[0110] See also Fig.12 An inter-core communication device 400 provided in an embodiment of the present application runs on an electronic device, the electronic device comprising at least a first core and a second core, a plurality of communication channels between the first core and the second core, and the plurality of communication channels have different communication performances, the device 400 comprising:
[0111] A data acquisition unit 510, configured to acquire data to be transmitted, where the data to be transmitted is data transmitted between the first core and the second core;
[0112] The channel selection unit 520 is used to obtain the communication channel corresponding to the data to be transmitted from the multiple communication channels as the target communication channel;
[0113] The data communication unit 530 is configured to transmit the data to be transmitted through the target communication channel.
[0114] As a method, the channel selection unit 520 is specifically used to obtain a current data transmission mode; and based on the data transmission mode, determine a communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel.
[0115] Wherein, optionally, the communication performance includes data transmission rate and transmission real-time performance. Correspondingly, the channel selection unit 520 is specifically used to, if the current mode is the first data transmission mode, use the first communication channel among the multiple communication channels as the target communication channel; if the current mode is the second data transmission mode, obtain the data type of the data to be transmitted; based on the data type, determine the communication channel corresponding to the data to be transmitted from the multiple communication channels as the target communication channel; wherein the data transmission rate of the first communication channel is higher than the data transmission rate of the second communication channel, and the transmission real-time performance of the second communication channel is higher than the transmission real-time performance of the first communication channel. wherein the data transmission rate of the first communication channel is higher than the data transmission rate of the second communication channel, and the transmission real-time performance of the second communication channel is higher than the transmission real-time performance of the first communication channel.
[0116] Among them, optionally, the channel selection unit 520 is specifically used to use the second communication channel as the target communication channel if the data to be transmitted is real-time type data; if the data to be transmitted is non-real-time type data, at least use the first communication channel as the target communication channel.
[0117] The channel selection unit 520 is specifically used to obtain the occupancy level of the second communication channel if the data to be transmitted is non-real-time type data; if the occupancy level is higher than the occupancy level threshold, use the first communication channel as the target communication channel; if the occupancy level is not higher than the occupancy level threshold, split the data to be transmitted into a first part and a second part, the first part and the second part respectively corresponding to numbers for sequential reorganization; use the first communication channel as the target communication channel of the first part, and use the second communication channel as the target communication channel of the second part.
[0118] Furthermore, the channel selection unit 520 is further specifically configured to configure the data to be transmitted to the frontmost transmission position in the sending buffer of the second communication channel for transmission if the current mode is the second data transmission mode and the data to be transmitted is real-time data.
[0119] Wherein, as a mode, the channel selection unit 520 is specifically used to obtain the usage rate of the sending buffer; and determine the current data transmission mode based on the usage rate. Optionally, the channel selection unit 520 is specifically used to determine that the current mode is the first data transmission mode if the usage rate is greater than the usage rate threshold; and determine that the current mode is the second data transmission mode if the usage rate is not greater than the usage rate threshold.
[0120] Also, as a mode, the channel selection unit 520 is specifically configured to obtain a third communication channel from the multiple communication channels as a target communication channel if the data to be transmitted is status type data.
[0121] The present application provides an inter-core communication device, which can transmit the data to be transmitted through the communication channel adapted to the required transmission data when data needs to be transmitted between the first core and the second core through the above method, thereby improving the flexibility of the communication method between the two cores. In addition, the first communication channel among the multiple communication channels in this embodiment has the characteristics of high data transmission rate, and the second communication channel has the characteristics of high transmission real-time performance, thereby making it possible to choose whether to transmit data through the first communication channel or through the second communication channel according to the current data transmission mode, so as to improve the data transmission with higher flexibility and good transmission real-time performance.
[0122] An electronic component provided by an embodiment of the present application includes a first core and a second core, wherein there are multiple communication channels between the first core and the second core, and the multiple communication channels have different communication performances;
[0123] The first core is used to obtain data to be transmitted; obtain a communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel; and transmit the data to be transmitted to the second core through the target communication channel.
[0124] An electronic component provided by the present application can, through the above method, transmit the data to be transmitted through a communication channel adapted to the required data transmission when data needs to be transmitted between the first core and the second core, thereby improving the flexibility of the communication method between the two cores.
[0125] It should be noted that the device embodiments and electronic component embodiments in the present application correspond to each other with the aforementioned method embodiments. The specific principles in the device embodiments and electronic component embodiments can be found in the contents of the aforementioned method embodiments and will not be repeated here.
[0126] The following will be combined Fig.13 An electronic device provided by the present application is described.
[0127] See also Fig.13 Based on the above inter-core communication method, the embodiment of the present application also provides another electronic device 200 that can execute the above inter-core communication method. The electronic device 200 can be a wearable device such as a smart bracelet, a smart watch, or a smart phone and a tablet computer.
[0128] The electronic device 200 includes a processor 102, a memory 104, a network module 106, and a microcontroller unit 108 (MCU). The memory 104 stores a program that can execute the contents of the aforementioned embodiments, and the processor 102 can execute the program stored in the memory 104. The internal structure of the processor 102 can be as follows: Figure 1 shown.
[0129] Among them, the processor 102 may include one or more cores for processing data and a message matrix unit. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 200, and executes various functions and processes data of the electronic device 200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 102 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 102 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 102, but may be implemented separately through a communication chip.
[0130] The memory 104 may include a random access memory (RAM) or a read-only memory (ROM). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the terminal 100 during use.
[0131] The network module 106 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, such as communicating with an audio playback device. The network module 106 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity modules (SIM) cards, memories, etc. The network module 106 may communicate with various networks such as the Internet, corporate intranets, wireless networks, or communicate with other devices via wireless networks. The above-mentioned wireless networks may include cellular telephone networks, wireless local area networks, or metropolitan area networks. For example, the network module 106 may exchange information with a base station.
[0132] Please refer to Fig.14 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 1100 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0133] The computer readable storage medium 1100 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 1100 includes a non-transitory computer-readable storage medium. The computer readable storage medium 1100 has storage space for program code 1110 that executes any method step in the above method. These program codes can be read from or written to one or more computer program products. The program code 1110 can be compressed, for example, in an appropriate form.
[0134] In summary, the present application provides an inter-core communication method, device, electronic component, and electronic device. When the electronic device includes at least a first core and a second core, and there are multiple communication channels between the first core and the second core, and the communication performance of each of the multiple communication channels is different, after obtaining the data to be transmitted between the first core and the second core, the communication channel corresponding to the data to be transmitted can be selected from the multiple communication channels as the target communication channel, and then the data to be transmitted can be transmitted through the target communication channel. Therefore, through the above method, when data needs to be transmitted between the first core and the second core, the data to be transmitted can be transmitted through the communication channel adapted to the required transmission data, thereby improving the flexibility of the communication method between the two cores.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for inter-core communication, characterized in that: Applied to an electronic device, the electronic device includes at least a first core and a second core, there are multiple communication channels between the first core and the second core, and the multiple communication channels have different communication performances, the method includes: Acquire data to be transmitted, where the data to be transmitted is data transmitted between the first core and the second core; Acquire a communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel; The data to be transmitted is transmitted through the target communication channel.
2. The method according to claim 1, characterized in that: The multiple communication channels include a first communication channel and a second communication channel, and obtaining a communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel includes: Get the current data transmission mode; Based on the data transmission mode, a communication channel corresponding to the data to be transmitted is determined from the multiple communication channels as a target communication channel.
3. The method according to claim 2, characterized in that The determining, based on the data transmission mode, from the multiple communication channels, a communication channel corresponding to the data to be transmitted as a target communication channel includes: If the current mode is the first data transmission mode, taking the first communication channel among the multiple communication channels as the target communication channel; If the current mode is the second data transmission mode, obtaining the data type of the data to be transmitted; Determining, based on the data type, from the plurality of communication channels, a communication channel corresponding to the data to be transmitted as a target communication channel; The data transmission rate of the first communication channel is higher than the data transmission rate of the second communication channel, and the transmission real-time performance of the second communication channel is higher than the transmission real-time performance of the first communication channel; and the step of determining, based on the data type, from the plurality of communication channels, the communication channel corresponding to the data to be transmitted as the target communication channel comprises: If the data to be transmitted is real-time data, taking the second communication channel as the target communication channel; If the data to be transmitted is non-real-time data, at least the first communication channel is used as a target communication channel.
4. The method according to claim 3, characterized in that If the data to be transmitted is non-real-time data, at least taking the first communication channel as a target communication channel comprises: If the data to be transmitted is non-real-time data, obtaining the occupancy level of the second communication channel; If the occupancy level is higher than an occupancy level threshold, taking the first communication channel as a target communication channel; If the occupancy level is not higher than the occupancy level threshold, splitting the data to be transmitted into a first part and a second part, the first part and the second part respectively corresponding to numbers for sequential reorganization; The first communication channel is used as a target communication channel of the first part, and the second communication channel is used as a target communication channel of the second part.
5. The method according to claim 2, characterized in that: The transmitting the data to be transmitted through the target communication channel comprises: If the data to be transmitted is real-time data, the data to be transmitted is configured to be transmitted at the front transmission position in the sending buffer of the second communication channel; or, if the data to be transmitted is real-time data and the data to be transmitted also needs to rely on the data that has not been sent in the sending buffer of the second communication channel, the data to be transmitted will be configured to be transmitted after the dependent unsent data.
6. The method according to claim 2, characterized in that The obtaining of the current data transmission mode includes: Get the usage of the send buffer; A current data transmission mode is determined based on the usage rate.
7. The method according to claim 6, characterized in that The determining the current data transmission mode based on the usage rate includes: If the usage rate is greater than the usage rate threshold, determining that the first data transmission mode is currently in use; If the usage rate is not greater than the usage rate threshold, it is determined that the second data transmission mode is currently in use.
8. The method according to claim 2, characterized in that: The plurality of communication channels further include a third channel, and before acquiring the current data transmission mode, the method further includes: If the data to be transmitted is status type data, acquiring the third communication channel from the multiple communication channels as the target communication channel; If the data to be transmitted is non-status type data, the step of obtaining the current data transmission mode is performed.
9. An electronic component, characterized in that: comprising a first core, a second core, and a plurality of communication channels between the first core and the second core, wherein the plurality of communication channels have different communication performances; The first core is used to obtain data to be transmitted; Acquire the communication channel corresponding to the data to be transmitted from the multiple communication channels as the target communication channel; The data to be transmitted is transmitted to the second core through the target communication channel.
10. The electronic component according to claim 9, characterized in that The multiple communication channels include a first communication channel and a second communication channel; wherein the data transmission rate of the first communication channel is higher than the data transmission rate of the second communication channel, and the transmission real-time performance of the second communication channel is higher than the transmission real-time performance of the first communication channel; The first core is specifically used to obtain a current data transmission mode; based on the data transmission mode, determine a communication channel corresponding to the data to be transmitted from the multiple communication channels as a target communication channel.
11. The electronic component according to claim 9 or 10, characterized in that: The plurality of communication channels further include a third channel, and the first core is specifically configured to obtain the third communication channel from the plurality of communication channels as a target communication channel if the data to be transmitted is status type data; If the data to be transmitted is non-status type data, the step of obtaining the current data transmission mode is performed.
12. The electronic component according to claim 11, characterized in that The first communication channel includes a data line for transmitting data between the first core and the second core, a first timing line for controlling the first core to actively send data to the second core, and a second timing line for controlling the second core to actively send data to the first core; And / or, the third communication channel includes a third line for the first core to request the second core for the working state and register state of the second core, and a fourth line for the second core to output log data to the first core.
13. An electronic device, characterized in that: including a first core, a second core and a memory; One or more programs are stored in the memory and are configured to be executed by the first core and the second core to implement the method of any one of claims 1-8.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, wherein when the program codes are executed by the first core and the second core, the method according to any one of claims 1 to 8 is executed.