Multi-core communication method and apparatus, electronic device, and storage medium
By establishing an open asymmetric multiprocessing framework communication layer connection between the main control core and the remote core in the embedded system, the problem that the kernel cannot access the storage medium when no storage medium is configured is solved, and reliable data access and storage are realized.
Patent Information
- Application Number
- CN202210295783.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-03-23
AI Technical Summary
In embedded systems, a kernel without configured storage media cannot access the storage media for operation, leading to data loss or corruption.
By establishing a communication layer connection of an open asymmetric multiprocessing framework between the master core and the remote core, the master core receives operation requests from the remote core, performs operations on the target storage medium, obtains the results, and sends them to the remote core.
This technology enables data reliability and integrity to be ensured by establishing a communication connection with the main control core when the remote core cannot directly access the storage medium, thus preventing data loss and corruption.
Smart Images

Figure CN116841947B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of communication technology, and in particular to a multi-core communication method, apparatus, electronic device and storage medium. Background Technology
[0002] Embedded systems are widely used in electronic devices such as mobile phones and Internet of Things (IoT) devices. With the continuous advancement of technology, embedded systems have evolved from single-core to multi-core.
[0003] In related technologies, the AMP (Asymmetric Multi-Processing) architecture includes multiple cores. In order to save the area of the SOC (System on chip), it does not configure flash storage media, eMMC storage media, or other storage media for each core. This will cause some cores to be unable to access the storage media to operate, which is a problem that urgently needs to be solved. Summary of the Invention
[0004] This disclosure provides a multi-core communication method, apparatus, electronic device, and storage medium to at least solve the problem in related technologies where a kernel without configured storage media cannot access the storage media. The technical solution of this disclosure is as follows:
[0005] According to a first aspect of the present disclosure, a multi-core communication method is provided, applied to a master control core, comprising: receiving an operation request sent by a remote core through a communication layer; wherein the operation request is used to instruct the master control core to perform a target operation on a target storage medium, and the remote core and the master control core are connected through a communication layer of an open asymmetric multiprocessing framework; and performing the target operation on the target storage medium according to the operation request.
[0006] In some embodiments, the method further includes: obtaining an operation result and sending the operation result to the remote core through the communication layer.
[0007] In some embodiments, receiving an operation request sent by a remote core through a communication layer includes: detecting an interrupt and, in response to the interrupt, calling a first preset interface of the communication layer through a first set interface to obtain the operation request from a target buffer; wherein the operation request is sent to the target buffer by a second preset interface of the communication layer called by a second set interface of the remote core, and the main control core and the remote core share the target buffer.
[0008] In some embodiments, the method further includes: receiving an operation command sent by a client calling a standard interface, and establishing a communication connection with a remote core based on the communication layer; wherein the operation command is used to instruct the execution of a first operation on a first virtual file system of the remote core; calling a first preset interface of the communication layer through a first set interface to package and send the operation command to a target cache of the communication layer; wherein the main control core and the remote core share the target cache; notifying the remote core to read the operation command from the target cache via an interrupt, and the second set interface of the remote core calling a second preset interface of the communication layer to unpack and obtain the operation command from the target cache.
[0009] In some embodiments, the method further includes: receiving a first operation result sent by the second preset interface of the communication layer via the second preset interface of the remote core; wherein the first operation result is obtained by the remote core performing the first operation according to the operation command; and outputting the first operation result through the standard interface.
[0010] In some embodiments, establishing a communication connection with a remote core based on the communication layer includes: determining the target buffer; according to the operation command, calling a third preset interface of the communication layer through a first preset interface to generate a first preset interface for communication connection with the main control core, and the second preset interface of the remote core calling the third preset interface to generate a second preset interface for communication connection with the remote core; and establishing a communication connection with the remote core through the first preset interface, the first preset interface, the target buffer, the second preset interface, and the second preset interface.
[0011] In some embodiments, the target storage medium is the file system of the master control core, or a Flash storage medium connected to the master control core, or an EMMC storage medium connected to the master control core.
[0012] According to a second aspect of the present disclosure, a multi-core communication device is also provided, the device comprising: a first receiving unit, configured to receive an operation request sent by a remote core through a communication layer; wherein the operation request is configured to instruct the master core to perform a target operation on a target storage medium, and the remote core and the master core are communicatively connected through a communication layer of an open asymmetric multiprocessing framework; and a first processing unit, configured to perform the target operation on the target storage medium according to the operation request.
[0013] In some embodiments, the apparatus further includes: a first sending unit, configured to acquire an operation result and send the operation result to the remote core via the communication layer.
[0014] In some embodiments, the first receiving unit is specifically configured to detect an interrupt and, in response to the interrupt, call a first preset interface of the communication layer through a first set interface to obtain the operation request from the target buffer; wherein the operation request is sent to the target buffer by the second preset interface of the communication layer called by the second set interface of the remote core, and the main control core and the remote core share the target buffer.
[0015] In some embodiments, the apparatus further includes: a second processing unit, configured to receive an operation command sent by a client calling a standard interface, and establish a communication connection with a remote core based on the communication layer; wherein the operation command is used to instruct the remote core to perform a first operation on a first virtual file system; a second sending unit, configured to call a first preset interface of the communication layer through a first setting interface, and package and send the operation command to a target cache of the communication layer; wherein the main control core and the remote core share the target cache; and a third sending unit, configured to notify the remote core to read the operation command from the target cache via an interrupt, wherein the remote core's second setting interface calls a second preset interface of the communication layer to unpack and obtain the operation command from the target cache.
[0016] In some embodiments, the apparatus includes: a second receiving unit, configured to receive a first operation result sent by the second preset interface of the communication layer called by the second set interface of the remote core; wherein the first operation result is obtained by the remote core performing the first operation according to the operation command; and an output unit, configured to output the first operation result through the standard interface.
[0017] In some embodiments, the second processing unit includes: a determining module, configured to determine the target cache area;
[0018] An interface generation module is used to generate a first preset interface for communication connection with the main control core by calling the third preset interface of the communication layer through the first preset interface according to the operation command, and the second preset interface of the remote core calls the third preset interface to generate a second preset interface for communication connection with the remote core; a connection module is used to establish a communication connection with the remote core through the first preset interface, the first preset interface, the target buffer, the second preset interface and the second preset interface.
[0019] According to a third aspect of the present disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the multi-core communication method as described above.
[0020] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is also provided, which, when a calling instruction in the storage medium is executed by a processor of an electronic device, enables the electronic device to perform the multi-core communication method as described above.
[0021] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0022] In this embodiment of the present disclosure, the master control core receives an operation request sent by a remote core through a communication layer. The operation request instructs the master control core to perform a target operation on a target storage medium. The remote core and the master control core communicate through a communication layer of an open asymmetric multiprocessing framework. The target storage medium is a storage medium connected to the master control core. Based on the operation request, the target operation is performed on the target storage medium. Therefore, when the remote core cannot directly access the target storage medium, it can access the target storage medium through the master control core by establishing a communication connection with the master control core based on the OpenAMP communication layer.
[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0025] Figure 1 This is a flowchart of a multi-core communication method provided in an embodiment of this disclosure;
[0026] Figure 2 This is a flowchart illustrating the communication between the master core and the remote core in a multi-core communication method provided in this embodiment of the disclosure;
[0027] Figure 3 This is a flowchart of another multi-core communication method provided in this embodiment of the disclosure;
[0028] Figure 4 This is a flowchart of step S31 in a multi-core communication method provided in this embodiment of the present disclosure;
[0029] Figure 5 This is a flowchart of yet another multi-core communication method provided in this disclosure embodiment;
[0030] Figure 6 This is a flowchart of step S51 in a multi-core communication method provided in this embodiment of the present disclosure;
[0031] Figure 7 This is a structural diagram of a multi-core communication device provided in an embodiment of this disclosure;
[0032] Figure 8 This is a structural diagram of another multi-core communication device provided in an embodiment of this disclosure;
[0033] Figure 9 This is a structural diagram of another multi-core communication device provided in the embodiments of this disclosure;
[0034] Figure 10 This is a structural diagram of another multi-core communication device provided in the embodiments of this disclosure;
[0035] Figure 11 This is a structural diagram of the second processing unit in a multi-core communication device provided in this disclosure embodiment;
[0036] Figure 12 This is a structural diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation
[0037] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0038] Unless the context otherwise requires, throughout the specification and claims, the term "comprising" is interpreted as open-ended and encompassing, meaning "including, but not limited to." In the description of the specification, terms such as "some embodiments" are intended to indicate that a particular feature, structure, material, or characteristic associated with that embodiment or example is included in at least one embodiment or example of this disclosure. The illustrative representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics mentioned may be included in any suitable manner in any one or more embodiments or examples.
[0039] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0040] The multi-core communication method, apparatus, electronic device, and storage medium provided in the embodiments of this disclosure are described in detail below with reference to the accompanying drawings.
[0041] It should be noted that the multi-core communication method of this disclosure embodiment can be executed by the multi-core communication device of this disclosure embodiment. The multi-core communication device can be implemented by software and / or hardware, and can be configured in an electronic device. The electronic device can install and run a multi-core communication program. The electronic device can include, but is not limited to, hardware devices with various operating systems such as smartphones, tablets, and Internet of Things (IoT) devices.
[0042] Figure 1 This is a flowchart of a multi-core communication method provided in an embodiment of this disclosure.
[0043] like Figure 1 As shown, the multi-core communication method provided in this embodiment of the disclosure is applied to the main control core and includes, but is not limited to, the following steps:
[0044] S11: Receive an operation request sent by the remote core through the communication layer; wherein, the operation request is used to instruct the master core to perform target operations on the target storage medium, and the remote core and the master core communicate through the communication layer of the open asymmetric multiprocessing framework.
[0045] In an AMP architecture system, there are multiple CPUs (Central Processing Units). Different CPUs can have different system architectures, independent address spaces, and run their own operating systems (OS). In an AMP architecture system, multiple CPUs include multiple cores, including one main control core and at least one remote core.
[0046] The main control core has a complex structure and functions, and is responsible for the management and scheduling of global resources and tasks, as well as the boot loading of remote cores. The remote core is mainly managed by the main control core, and is responsible for running the tasks assigned by the main control core and performing local task scheduling and management functions.
[0047] In this embodiment of the disclosure, the target storage medium can be a storage medium connected to the main control core, such as a Flash storage medium, an EMMC storage medium, etc., connected to the main control core, or the target storage medium can also be a virtual file system (VFS) in the main control core, or a file system in the main control core connected to the virtual file system (VFS).
[0048] In some embodiments, the target storage medium is a file system of the main control core, or a Flash storage medium connected to the main control core, or an EMMC storage medium connected to the main control core.
[0049] For ease of understanding, this disclosure provides an exemplary embodiment, such as... Figure 2 As shown, the master core and the remote core establish a communication connection through the communication layer. Both the master core and the remote core include a virtual file system (VFS).
[0050] The master kernel includes file systems fatfs, littlefs, and Procfs, while the remote kernel also includes a Procfs file system. The fatfs, littlefs, and Procfs file systems in the master kernel, and the Procfs file system in the remote kernel, each provide unified file system services through the Virtual File System (VFS). Different types of file systems can be mounted in different locations and can be configured as needed.
[0051] In this embodiment of the disclosure, the target storage medium is a virtual file system (VFS), a file system (fatfs), a file system (littlefs), or a file system (Procfs) of the master control core.
[0052] In this embodiment, the main control core's file system fatfs and file system littlefs can access Flash storage media and / or eMMC storage media. The fatfs file system in the main control core is mainly used on storage media such as SD cards and eMMC, while the littlefs file system is a highly complete embedded file system with features such as small footprint, resistance to power loss, and wear leveling, which can well support Flash storage media scenarios. However, the virtual file system VFS and file system Procfs in the remote core cannot directly access Flash storage media and / or eMMC storage media.
[0053] It is understood that in this embodiment of the disclosure, the virtual file system (VFS) of the master core can directly access the flash storage medium and / or EMMC storage medium, while the remote core cannot access the flash storage medium and / or EMMC storage medium because it does not have a connected flash storage medium and / or EMMC storage medium.
[0054] Based on this, in this embodiment of the disclosure, by establishing a communication connection between the remote core and the main control core based on the communication layer, the remote core can access external storage media such as Flash storage media and EMMC storage media through the main control core to perform target operations, so as to avoid data loss or damage.
[0055] In an exemplary embodiment, when the target storage medium is a Flash storage medium connected to the main control core, the remote core needs to maintain a certain state and wants to retain that state after a power outage and restart. In this case, the remote core needs to write the state to the Flash storage medium. The remote core can send an operation request to the main control core through the OpenAMP-based communication layer, requesting the main control core to write the corresponding state of the remote core to the Flash storage medium connected to the main control core, so that the remote core can continue to maintain the state after a power outage and restart.
[0056] In this embodiment of the disclosure, after the main control core starts initialization, the remote core is started through the communication layer of the open asymmetric multiprocessing framework to complete the startup and operation preparation work. The communication layer of the open asymmetric multiprocessing framework includes starting the remote serial port remoteproc_init. The main control core calls start remoteproc_init to start the remote core.
[0057] In this embodiment, the master core and the remote core communicate through the communication layer of the OpenAMP framework. The OpenAMP communication layer includes a shared buffer for both the master and remote cores, and virtual serial ports connecting the master and remote cores respectively. The communication connection between the master and remote cores, established through the OpenAMP communication layer, can be a channel formed by the virtual serial port connecting the master core, the shared buffer, and the virtual serial port connecting the remote core.
[0058] Understandably, at any given time, the master core can only establish a communication connection with one remote core through the OpenAMP communication layer. Once a communication connection is established between the master core and the remote core, the master core can receive operation requests from the remote core through the communication layer. Therefore, when a remote core wants to send operation commands to the master core, it first needs to establish a communication connection with the master core, thus enabling it to send operation commands through the communication layer that establishes the connection.
[0059] S12: Perform the target operation on the target storage medium according to the operation request.
[0060] In this embodiment of the disclosure, the main control core receives an operation request sent by the remote core through the communication layer, determines the target operation based on the operation request, such as open, close, read, write, etc., and then performs the target operation on the target storage medium according to the operation request of the remote core.
[0061] For example, when the operation request is to perform a write operation on the Flash storage medium connected to the main control core, the main control core receives the operation request sent by the remote core through the communication layer of the OpenAMP open asymmetric multiprocessing framework, and performs the write operation on the Flash storage medium connected to the main control core.
[0062] This embodiment of the present disclosure receives an operation request sent by a remote core through a communication layer. The operation request instructs the main control core to perform a target operation on a target storage medium. The remote core and the main control core communicate through a communication layer of an open asymmetric multiprocessing framework. The target storage medium is a storage medium connected to the main control core. Based on the operation request, the target operation is performed on the target storage medium. Therefore, when the remote core cannot directly access the storage medium, it can access the storage medium connected to the main control core by establishing a communication connection based on the OpenAMP communication layer, enabling data storage and retrieval to avoid data loss and corruption.
[0063] Figure 3 This is a flowchart of another multi-core communication method provided in this embodiment.
[0064] like Figure 3 As shown, the multi-core communication method provided in this embodiment of the disclosure is applied to the main control core and includes, but is not limited to, the following steps:
[0065] S31: Receive an operation request sent by the remote core through the communication layer; wherein, the operation request is used to instruct the master core to perform a target operation on the target storage medium, and the remote core and the master core communicate through the communication layer of the open asymmetric multiprocessing framework; wherein, the target storage medium is the storage medium connected to the master core.
[0066] like Figure 4 As shown, in some embodiments, S31 includes, but is not limited to, the following steps:
[0067] S311: Detect an interrupt and respond to the interrupt by calling the first preset interface of the communication layer through the first set interface to obtain an operation request from the target buffer; wherein the operation request is sent to the target buffer by the second preset interface of the communication layer called by the second set interface of the remote core, and the main control core and the remote core share the target buffer.
[0068] In this embodiment of the disclosure, the first setting interface of the main control core can be the interface set by the factory in the main control core, or it can be the interface set by the client. The second setting interface of the remote core can be the interface set by the factory in the main control core, or it can be the interface set by the client. This embodiment of the disclosure does not impose any specific restrictions on this.
[0069] The first preset interface of the communication layer can be rpmsgfs-server, and the second preset interface can be rpmsgfs-client. The master core and the remote core share the target cache, and inter-core communication between them can be achieved through asynchronous communication via Rpmsg.
[0070] In this embodiment of the disclosure, the main control core includes a monitoring process rptun thread for detecting interrupts.
[0071] Understandably, the remote core calls the second preset interface rpmsgfs-client of the communication layer through the second set interface, packages the operation request and sends it to the target buffer of the communication layer, triggering an interrupt. As a result, the listening process rptun thread in the main control core detects the interrupt, and the main control core calls the first preset interface rpmsgfs-server of the communication layer through the first set interface to obtain the operation request sent by the remote core from the target buffer.
[0072] In this embodiment of the disclosure, the first setting interface of the main control core and the first preset interface rpmsgfs-server of the communication layer establish a virtual channel. The main control core calls the first preset interface rpmsgfs-server of the communication layer through the first setting interface to obtain the operation request sent by the remote core from the target buffer. The process is still implemented through the TX buffer (output buffer) and RX buffer (receive buffer) in the buffer entity.
[0073] The first preset interface rpmsgfs-server of the main control core communication connection has a first buffer entity, including a first TX buffer entity and a first RX buffer entity. The first TX buffer entity is used to output (send) data, and the first RX buffer entity is used to receive data. The target buffer includes a second TX buffer entity and a second RX buffer entity. The second TX buffer entity is used to output (send) data, and the second RX buffer entity is used to receive data.
[0074] Based on this, in this embodiment of the disclosure, the master control core calls the first preset interface rpmsgfs-server of the communication layer through the first set interface to obtain the operation request sent by the remote core from the target buffer. The process can be as follows: the master control core calls the first preset interface rpmsgfs-server of the communication layer through the first set interface, and the first RX buffer entity reads and unpacks the operation request from the second TX buffer entity of the target buffer.
[0075] In this embodiment of the disclosure, the second setting interface of the remote core and the second preset interface rpmsgfs-client of the communication layer establish a virtual channel. The remote core calls the second preset interface rpmsgfs-client of the communication layer through the second setting interface to package the operation request and send it to the target buffer of the communication layer. The process is still implemented through the TX buffer (output buffer) and RX buffer (receive buffer) in the buffer entity.
[0076] The second preset interface rpmsgfs-client of the remote nuclear communication connection has a third buffer entity, including a third TX buffer entity and a third RX buffer entity. The third TX buffer entity is used to output (send) data, and the third RX buffer entity is used to receive data.
[0077] Based on this, in this embodiment of the disclosure, the remote core calls the second preset interface rpmsgfs-client of the communication layer through the second set interface, and packages and sends the operation request to the target buffer of the communication layer. The process can be as follows: the remote core calls the second preset interface rpmsgfs-client of the communication layer through the second set interface, and the third TX buffer entity packages and sends the operation request to the second RX buffer entity of the target buffer.
[0078] It is understood that in the embodiments of this disclosure, the main control core and the remote cores share the target cache area. In the case of multiple remote cores, each remote core has a cache area with the main control core. However, the cache areas of different remote cores and the main control core do not overlap.
[0079] S32: Perform the target operation on the target storage medium according to the operation request.
[0080] It should be noted that the relevant descriptions of S21 and S22 in the embodiments of this disclosure can be found in the relevant descriptions of S11 and S12 in the above examples, and will not be repeated here.
[0081] S33: Obtain the operation result and send the operation result to the remote core through the communication layer.
[0082] It is understood that in this embodiment of the disclosure, the master control core receives the operation request sent by the remote core through the communication layer, determines the target operation to be performed on the target storage medium according to the operation request, obtains the operation result after performing the target operation on the target storage medium, and sends the operation result to the remote core through the communication layer.
[0083] For example, the remote core sends an operation request to the master core through the OpenAMP-based communication layer. When the operation request is "read" to read the specified content in the target storage medium, the master core reads the specified content in the target storage medium according to the received operation request and sends the read specified content to the remote core through the OpenAMP-based communication layer.
[0084] Figure 5 This is a flowchart of another multi-core communication method provided in the embodiments of this disclosure.
[0085] like Figure 5 As shown, the multi-core communication method provided in this embodiment of the disclosure is applied to the main control core and includes, but is not limited to, the following steps:
[0086] S51: Receive the operation command sent by the client calling the standard interface and establish a communication connection with the remote core based on the communication layer; wherein, the operation command is used to instruct the execution of a first operation on the first virtual file system of the remote core.
[0087] In this embodiment of the disclosure, the main control core receives operation commands sent by the client through a standard interface. The standard interface may be, for example, an open function, a close function, a read function, a write function, an input / output control function, a poll function, and a file offset function, lseek. The operation commands sent by the client are used to instruct the execution of a first operation on the first virtual file system of the remote core. The first operation may be, for example, a file operation or folder operation such as open, close, read, write, ioctl, opendir, closedir, or readdir.
[0088] In this embodiment of the disclosure, the operation commands can be user-defined or factory-set. The main control core receives the operation commands sent by the client and establishes a communication connection with the remote core based on the communication layer.
[0089] like Figure 6 As shown, in some embodiments, S51 includes, but is not limited to, the following steps:
[0090] S511: Determine the target cache area.
[0091] Understandably, in an asymmetric multi-core processing architecture, a shared cache can be specified for every two cores, and both cores can access the shared cache.
[0092] For example, in the case of 4 kernels, including kernel1, kernel2, kernel3 and kernel4, a shared cache is specified for every two kernels. A cache is specified for kernel1 and kernel2, which can be accessed by both kernel1 and kernel2. A cache is specified for kernel1 and kernel3, which can be accessed by both kernel1 and kernel3, and so on.
[0093] It should be noted that each cache is independent and there is no overlap between different caches, so each cache can only be accessed by the corresponding two kernels.
[0094] In this embodiment of the disclosure, when the master control core receives an operation command, it can determine the remote core based on the operation command, and then determine the target cache area shared with the remote core based on the remote core.
[0095] S512: According to the operation command, the third preset interface of the communication layer is called through the first setting interface to generate the first preset interface for communication connection with the main control core, and the second setting interface of the remote core calls the third preset interface to generate the second preset interface for communication connection with the remote core.
[0096] In this embodiment of the disclosure, after receiving the operation command, the master control core establishes a communication connection with the remote core through the communication layer. The communication layer includes a third preset interface with the prefix rpmsg. The third preset interface contains a function or instruction for "creating a virtual serial port". The first setting interface of the master control core calls the third preset interface of the communication layer to generate a first preset interface rpmsgfs-server that communicates with the master control core. The second setting interface of the remote core calls the third preset interface of the communication layer to generate a second preset interface rpmsgfs-client that communicates with the remote core.
[0097] S513: Establish a communication connection with the remote core through the first setting interface, the first preset interface, the target buffer, the second preset interface, and the second setting interface.
[0098] In this embodiment of the disclosure, after generating the first preset interface rpmsgfs-server and the second preset interface rpmsgfs-client, a communication channel between the cores is established through the first set interface, the first preset interface, the target cache, the second preset interface, and the second set interface to realize the communication connection between the main control core and the remote core.
[0099] S52: The operation command is packaged and sent to the target buffer of the communication layer by calling the first preset interface of the first setting interface; wherein, the main control core and the remote core share the target buffer.
[0100] It is understandable that the first setting interface of the main control core and the first preset interface of the communication layer, rpmsgfs-server, establish a virtual channel. The main control core calls the first preset interface of the communication layer, rpmsgfs-server, through the first setting interface to package the operation command and send it to the target buffer of the communication layer. This is still achieved through the TX buffer (output buffer) and RX buffer (receive buffer) in the buffer entity.
[0101] Based on this, in this embodiment of the disclosure, the main control core calls the first preset interface rpmsgfs-server of the communication layer through the first set interface to package and send the operation command to the target buffer of the communication layer. The process can be as follows: the first RXbuffer entity receives the operation command sent by the client through the standard interface, and the first TX buffer entity packages and sends the operation command to the second RX buffer entity, thereby sending it to the target buffer.
[0102] It should be noted that the main control core
[0103] S53: The remote core is notified via an interrupt to read the operation command from the target buffer. The second preset interface of the remote core calls the second preset interface of the communication layer to unpack and obtain the operation command from the target buffer.
[0104] In this embodiment of the disclosure, the remote kernel includes a listening process rptun thread for detecting interrupts.
[0105] Understandably, the main control core calls the first preset interface rpmsgfs-server of the communication layer through the first set interface, packages the operation command and sends it to the target buffer of the communication layer, triggering an interrupt. As a result, the listening process rptun thread in the remote core detects the interrupt, and the second set interface of the remote core calls the second preset interface rpmsgfs-client of the communication layer to unpack the operation command from the target buffer.
[0106] In this embodiment of the disclosure, the second setting interface of the remote core and the second preset interface rpmsgfs-client of the communication layer establish a virtual channel. The remote core calls the second preset interface rpmsgfs-client of the communication layer through the second setting interface to unpack and obtain operation commands from the target buffer. The process is still implemented through the TX buffer (output buffer) and RX buffer (receive buffer) in the buffer entity.
[0107] Based on this, in this embodiment of the disclosure, the remote core calls the second preset interface rpmsgfs-client of the communication layer through the second set interface to unpack and obtain the operation command from the target buffer. The process can be as follows: the first TXbuffer entity in the target buffer sends the packaged operation command to the third RX buffer entity of the remote core, and the remote core unpacks the packaged operation command in the third RXbuffer entity to obtain the operation command.
[0108] In this embodiment of the disclosure, the rptun thread, a listening process in the remote core, can identify the operation of the first TX buffer entity to package and send the main control core, so as to determine the second preset interface rpmsgfs-client. Based on this, when there are multiple interfaces in the remote core, the rptun thread can identify and distribute the interfaces to achieve multi-process communication.
[0109] In this embodiment of the disclosure, the main control core sends an operation command by calling the first preset interface rpmsgfs-server of the communication layer through an asynchronous communication method. The communication layer based on OpenAMP responds to this communication by calling the remote core's receive callback through an interrupt method, so as to inform the main control core that the operation command has been received.
[0110] Please continue reading Figure 5 Execute after S53:
[0111] S54: Receive the first operation result sent by the second preset interface of the communication layer called by the second setting interface of the remote core; wherein, the first operation result is obtained by the remote core executing the first operation according to the operation command.
[0112] In this embodiment of the disclosure, after receiving the operation command, the remote core determines the first operation according to the operation command and then executes the first operation. For example, the first operation may be to perform a write operation on the virtual file system (VFS) in the remote core. Thus, the remote core writes the corresponding content into the virtual file system (VFS) of the remote core, completes the first operation, and obtains the result of the first operation.
[0113] Furthermore, after obtaining the first operation result, the remote core can call the second preset interface of the communication layer through the second set interface to send it to the main control core. Then, the main control core receives the first operation result sent by the remote core.
[0114] It should be noted that the process of the remote core sending the first operation result is the same as the process of the remote core sending the operation request, and the process of the master core receiving the first operation result sent by the remote core is the same as the process of the master core receiving the operation request sent by the remote core. For details, please refer to the relevant descriptions in the above examples, which will not be repeated here.
[0115] S55: Output the result of the first operation through the standard interface.
[0116] In this embodiment of the disclosure, the master control core can output the first operation result sent by the remote core through a standard interface.
[0117] Figure 7 This is a structural diagram of a multi-core communication device provided in an embodiment of this disclosure.
[0118] like Figure 7 As shown, the multi-core communication device 1 includes a first receiving unit 11 and a first processing unit 12.
[0119] The first receiving unit 11 is used to receive an operation request sent by the remote core through the communication layer; wherein the operation request is used to instruct the main control core to perform a target operation on the target storage medium, and the remote core and the main control core communicate through the communication layer of the open asymmetric multiprocessing framework.
[0120] The first processing unit 12 is used to perform target operations on the target storage medium according to the operation request.
[0121] like Figure 8 As shown, in some embodiments, the multi-core processing device 1 further includes a second sending unit 13.
[0122] The first sending unit 13 is used to acquire the operation result and send the operation result to the remote core through the communication layer.
[0123] In some embodiments, the first receiving unit 11 is specifically used to detect an interrupt and, in response to the interrupt, to call the first preset interface of the communication layer through the first setting interface to obtain an operation request from the target buffer; wherein the operation request is sent to the target buffer by the second preset interface of the communication layer called by the second setting interface of the remote core, and the main control core and the remote core share the target buffer.
[0124] like Figure 9 As shown, in some embodiments, the multi-core communication device 1 further includes: a second processing unit 14, a second transmitting unit 15, and a third transmitting unit 16.
[0125] The second processing unit 14 is used to receive operation commands sent by the client calling the standard interface and establish a communication connection with the remote core based on the communication layer; wherein, the operation command is used to instruct the execution of a first operation on the first virtual file system of the remote core.
[0126] The second sending unit 15 is used to call the first preset interface of the communication layer through the first set interface to package and send the operation command to the target buffer of the communication layer; wherein the main control core and the remote core share the target buffer.
[0127] The third sending unit 16 is used to notify the remote core to read the operation command of the target buffer through an interrupt. The second setting interface of the remote core calls the second preset interface of the communication layer to unpack and obtain the operation command from the target buffer.
[0128] like Figure 10 As shown, in some embodiments, the multi-core communication device 1 further includes a second receiving unit 17 and an output unit 18.
[0129] The second receiving unit 17 is used to receive the first operation result sent by the second preset interface of the communication layer called by the second setting interface of the remote core; wherein the first operation result is obtained by the remote core executing the first operation according to the operation command.
[0130] Output unit 18 is used to output the result of the first operation through a standard interface.
[0131] like Figure 11 As shown, in some embodiments, the second processing unit 14 includes: a determination module 141, an interface generation module 142, and a connection module 143.
[0132] Module 141 is used to determine the target cache area;
[0133] The interface generation module 142 is used to generate a first preset interface for communication connection with the main control core by calling the third preset interface of the communication layer through the first preset interface according to the operation command, and to generate a second preset interface for communication connection with the remote core by calling the third preset interface through the second preset interface of the remote core.
[0134] The connection module 143 is used to establish a communication connection with the remote core through the first setting interface, the first preset interface, the target buffer, the second preset interface, and the second setting interface.
[0135] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0136] The multi-core communication device provided in this disclosure can execute the multi-core communication methods of some of the embodiments above, and its beneficial effects are the same as those of the multi-core communication methods described above, so they will not be repeated here.
[0137] Figure 12 This is a structural diagram of an electronic device 100 for a multi-core communication method according to an exemplary embodiment.
[0138] For example, electronic device 100 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0139] like Figure 12 As shown, the electronic device 100 may include one or more of the following components: a processing component 101, a memory 102, a power supply component 103, a multimedia component 104, an audio component 105, an input / output (I / O) interface 106, a sensor component 107, and a communication component 108.
[0140] Processing component 101 typically controls the overall operation of electronic device 100, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 101 may include one or more processors 1011 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 101 may include one or more modules to facilitate interaction between processing component 101 and other components. For example, processing component 101 may include a multimedia module to facilitate interaction between multimedia component 104 and processing component 101.
[0141] Memory 102 is configured to store various types of data to support the operation of electronic device 100. Examples of such data include instructions for any application or method operating on electronic device 100, contact data, phonebook data, messages, pictures, videos, etc. Memory 102 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as SRAM (Static Random-Access Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), PROM (Programmable Read-Only Memory), ROM (Read-Only Memory), magnetic storage, flash memory, magnetic disk, or optical disk.
[0142] Power supply component 103 provides power to various components of electronic device 100. Power supply component 103 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 100.
[0143] Multimedia component 104 includes a touch display screen that provides an output interface between the electronic device 100 and the user. In some embodiments, the touch display screen may include an LCD (Liquid Crystal Display) and a TP (Touch Panel). The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 104 includes a front-facing camera and / or a rear-facing camera. When the electronic device 100 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0144] Audio component 105 is configured to output and / or input audio signals. For example, audio component 105 includes a MIC (microphone) configured to receive external audio signals when electronic device 100 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 102 or transmitted via communication component 108. In some embodiments, audio component 105 also includes a speaker for outputting audio signals.
[0145] I / O interface 2112 provides an interface between processing component 101 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, start buttons, and lock buttons.
[0146] Sensor assembly 107 includes one or more sensors for providing state assessments of various aspects of electronic device 100. For example, sensor assembly 107 may detect the on / off state of electronic device 100, the relative positioning of components such as the display and keypad of electronic device 100, changes in position of electronic device 100 or a component of electronic device 100, the presence or absence of user contact with electronic device 100, orientation or acceleration / deceleration of electronic device 100, and temperature changes of electronic device 100. Sensor assembly 107 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 107 may also include an optical sensor, such as a CMOS (Complementary Metal Oxide Semiconductor) or CCD (Charge-coupled Device) image sensor, for use in imaging applications. In some embodiments, sensor assembly 107 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0147] Communication component 108 is configured to facilitate wired or wireless communication between electronic device 100 and other devices. Electronic device 100 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 108 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 108 also includes an NFC (Near Field Communication) module to facilitate short-range communication. For example, the NFC module may be implemented based on RFID (Radio Frequency Identification) technology, IrDA (Infrared Data Association) technology, UWB (Ultra Wide Band) technology, BT (Bluetooth) technology, and other technologies.
[0148] In an exemplary embodiment, the electronic device 100 may be implemented by one or more ASICs (Application Specific Integrated Circuits), DSPs (Digital Signal Processors), digital signal processing devices (DSPDs), PLDs (Programmable Logic Devices), FPGAs (Field Programmable Gate Arrays), controllers, microcontrollers, microprocessors, or other electronic components to perform the multi-core communication method described above.
[0149] It should be noted that the implementation process and technical principles of the electronic device in this embodiment are explained in the foregoing description of the multi-core communication method of the present disclosure embodiment, and will not be repeated here.
[0150] The electronic device 100 provided in this embodiment can execute the multi-core communication method as described in some of the above embodiments, and its beneficial effects are the same as those of the multi-core communication method described above, so they will not be repeated here.
[0151] To implement the above embodiments, this disclosure also proposes a storage medium.
[0152] When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the multi-core communication method described above. For example, the storage medium may be ROM (Read Only Memory Image), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage device, etc.
[0153] To implement the above embodiments, this disclosure also provides a computer program product that, when executed by the processor of an electronic device, enables the electronic device to perform the multi-core communication method as described above.
[0154] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0155] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A multi-core communication method, characterized in that, Applied to the main control core, including; The system receives an operation request sent by a remote core through a communication layer; wherein the operation request is used to instruct the master core to perform a target operation on a target storage medium, and the remote core and the master core communicate through the communication layer of the OpenAMP open asymmetric multiprocessing framework; the target storage medium is the file system of the master core, or a Flash storage medium connected to the master core, or an EMMC storage medium connected to the master core. According to the operation request, the target operation is performed on the target storage medium; The step of receiving the operation request sent by the remote core through the communication layer includes: An interrupt is detected, and in response to the interrupt, the first preset interface of the communication layer is called through the first set interface to obtain the operation request from the target buffer; wherein the operation request is sent to the target buffer by the second preset interface of the communication layer called by the second set interface of the remote core, and the main control core and the remote core share the target buffer.
2. The method according to claim 1, characterized in that, The method further includes: Obtain the operation result and send the operation result to the remote core through the communication layer.
3. The method according to any one of claims 1 to 2, characterized in that, The method further includes: The system receives operation commands sent by the client through a standard interface call and establishes a communication connection with the remote core based on the communication layer; wherein the operation commands are used to instruct the execution of a first operation on the first virtual file system of the remote core; The operation command is packaged and sent to the target buffer of the communication layer by calling the first preset interface of the first set interface; wherein the main control core and the remote core share the target buffer; The remote core is notified via an interrupt to read the operation command from the target cache. The second preset interface of the remote core calls the second preset interface of the communication layer to unpack and obtain the operation command from the target cache.
4. The method according to claim 3, characterized in that, The method further includes: The remote core receives a first operation result sent by a second preset interface of the communication layer via a second preset interface; wherein the first operation result is obtained by the remote core executing the first operation according to the operation command. The result of the first operation is output through the standard interface.
5. The method according to claim 3, characterized in that, The establishment of a communication connection with the remote core based on the communication layer includes: Determine the target cache area; According to the operation command, the third preset interface of the communication layer is called through the first preset interface to generate the first preset interface for communication connection with the main control core, and the second preset interface of the remote core calls the third preset interface to generate the second preset interface for communication connection with the remote core; A communication connection is established with the remote core through the first setting interface, the first preset interface, the target cache, the second preset interface, and the second setting interface.
6. A multi-core communication device, characterized in that, include; The first receiving unit is used to receive an operation request sent by the remote core through the communication layer; wherein the operation request is used to instruct the main control core to perform a target operation on the target storage medium, and the remote core and the main control core are connected through the communication layer of the open asymmetric multiprocessing framework; the target storage medium is the file system of the main control core, or a Flash storage medium connected to the main control core, or an EMMC storage medium connected to the main control core. The first processing unit is configured to perform the target operation on the target storage medium according to the operation request. Specifically, the first receiving unit is used to detect an interrupt and, in response to the interrupt, to call the first preset interface of the communication layer through the first set interface to obtain the operation request from the target buffer; wherein the operation request is sent to the target buffer by the second preset interface of the communication layer called by the second set interface of the remote core, and the main control core and the remote core share the target buffer.
7. The apparatus according to claim 6, characterized in that, The device further includes: The first sending unit is used to acquire the operation result and send the operation result to the remote core through the communication layer.
8. The apparatus according to any one of claims 6 to 7, characterized in that, The device further includes: The second processing unit is used to receive operation commands sent by the client calling the standard interface and establish a communication connection with the remote core based on the communication layer; wherein, the operation command is used to instruct the execution of a first operation on the first virtual file system of the remote core; The second sending unit is used to call the first preset interface of the communication layer through the first set interface to package and send the operation command to the target buffer of the communication layer; wherein the main control core and the remote core share the target buffer; The third sending unit is used to notify the remote core to read the operation command of the target buffer via an interrupt. The second setting interface of the remote core calls the second preset interface of the communication layer to unpack and obtain the operation command from the target buffer.
9. The apparatus according to claim 8, characterized in that, The device includes: The second receiving unit is configured to receive a first operation result sent by the second preset interface of the communication layer when the second set interface of the remote core calls the second preset interface of the communication layer; wherein, the first operation result is obtained by the remote core executing the first operation according to the operation command; An output unit is used to output the result of the first operation through the standard interface.
10. The apparatus according to claim 8, characterized in that, The second processing unit includes: The determination module is used to determine the target cache area; An interface generation module is used to generate a first preset interface for communication connection with the main control core by calling the third preset interface of the communication layer through the first preset interface according to the operation command, and the second preset interface of the remote core calls the third preset interface to generate a second preset interface for communication connection with the remote core. The connection module is used to establish a communication connection with the remote core through the first setting interface, the first preset interface, the target cache, the second preset interface, and the second setting interface.
11. An electronic device, characterized in that, include: 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 to enable the at least one processor to perform the method of any one of claims 1 to 5.
12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for designing SoC core system and realizing inter-core task communication
CN110545319A
Inter-core communication method based on AMP system, terminal and storage medium
CN111427814A
