Universal remote communication calling system and method
By designing a general remote communication calling system, using the RPC kernel, IPC interface mapping module and operating system packaging module, the dependence problem of remote calling code on physical communication links and RTOS is solved, and the universality and reliability of the code is improved. Simplified product transplantation process.
Patent Information
- Application Number
- CN202111155629.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2041-09-29
Smart Images

Figure CN113867988B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a universal remote communication calling system and method. Background Art
[0002] In the existing remote call implementation scheme, the inter-core communication remote call code has a strong dependence on the underlying physical communication link and the diversity of RTOS (Real Time Operation System). For example, if the underlying communication is CMUX (Connection Multiplexing), the CMUX API (Application Programming Interface) function will be called; if the underlying communication is UART (Universal Asynchronous Receiver Transmitter), the UART API function will be called; for example, when the RTOS is rthread, the RTOS API function will be called, etc. Due to the differences in these interfaces, when writing the inter-core communication process, it is necessary to write software code that is adapted to the application environment. This dependency relationship not only makes the code in different application environments not universal and has poor maintainability, but also has an impact on the portability and reliability of the code. Summary of the invention
[0003] The embodiment of the present invention provides a universal remote communication calling system and method to reduce the dependence of the communication process code of the remote call on the physical communication link and RTOS, so that it can quickly adapt to various different product forms.
[0004] To this end, the embodiment of the present invention provides the following technical solutions:
[0005] The embodiment of the present invention provides a universal remote communication calling system, the system comprising: an RPC (Remote Procedure Call, remote procedure call) kernel, an IPC interface mapping module, and an operating system encapsulation module, the RPC kernel refers to a method of remote procedure calling;
[0006] The operating system encapsulation module is used to encapsulate different types of operating system interfaces into a unified interface to provide an RTOS standard interface to the RPC kernel;
[0007] The IPC interface mapping module is used to encapsulate the IPC object into a modular structure and establish a corresponding relationship between the RPC kernel and the IPC (Interprocess communication) object; the IPC object refers to a programming interface;
[0008] The RPC kernel is used to realize communication between different operating systems according to the correspondence between the RPC kernel and the IPC object established by the IPC interface mapping module and the RTOS standard interface provided by the operating system encapsulation module.
[0009] Optionally, the IPC interface mapping module establishes a corresponding relationship between the RPC kernel and the IPC object through a pointer.
[0010] Optionally, the IPC object includes any one of the following: CMUX, SOCKET, SIPC, UART, USB, SPI.
[0011] Optionally, the operating system includes any one of the following: MOCOR, RT-Thread, WIN32.
[0012] Optionally, the RPC kernel includes any one or more of the following methods: opening a window, reading, writing, input / output control, and releasing.
[0013] The embodiment of the present invention also provides a universal remote communication calling method, the method comprising:
[0014] Encapsulating different types of operating system interfaces into a unified interface to provide an RTOS standard interface to an RPC kernel; the RPC kernel refers to a remote procedure call method;
[0015] Encapsulate the IPC object into a modular structure, and establish a corresponding relationship between the RPC kernel and the IPC object; the IPC object refers to a programming interface;
[0016] The communication between different operating systems is realized according to the corresponding relationship between the RPC kernel and the IPC object and the RTOS standard interface.
[0017] Optionally, establishing the correspondence between the RPC kernel and the IPC object includes: establishing the correspondence between the RPC kernel and the IPC object through a pointer.
[0018] Optionally, the IPC object includes any one of the following: CMUX, SOCKET, SIPC, UART, USB, SPI.
[0019] Optionally, the operating system includes any one of the following: MOCOR, RT-Thread, WIN32.
[0020] Optionally, the RPC kernel includes any one or more of the following methods: opening a window, reading, writing, input / output control, and releasing.
[0021] An embodiment of the present invention further provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are executed.
[0022] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor executes the steps of the above method when running the computer program.
[0023] The universal remote communication calling system and method provided by the embodiment of the present invention encapsulates different types of operating system interfaces into a unified interface through an operating system encapsulation module to provide an RTOS standard interface to the RPC kernel, encapsulates the IPC object into a modular structure through an IPC interface mapping module, and establishes a corresponding relationship between the RPC kernel and the IPC object. The RPC kernel uses the corresponding relationship between the RPC kernel and the IPC object and the RTOS standard interface to achieve communication between different operating systems, so that the core code of the RPC kernel can be suitable for any combination of various chips, various IPCs, and various RTOSs, and quickly adapt to product forms that require various IPC communications. Even if the IPC object and / or the underlying operating system changes, there is no need to modify the RPC kernel code. Only the corresponding components and modules need to be changed and replaced to complete the product transplantation work well. It greatly facilitates the transplantation of products between different hardware environments, and can be quickly transplanted to systems with different chip modules and different RTOS. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a schematic diagram of the structure of a universal remote communication calling system according to an embodiment of the present invention;
[0025] Figure 2 Schematic diagram of the software directory structure of the RPC kernel in an embodiment of the present invention;
[0026] Figure 3 It is a flow chart of a universal remote communication calling method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the above-mentioned objects, features and beneficial effects of the present invention more obvious and easy to understand, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0028] RPC is a communication technology used by programs and processes running between networked computers. The entire RPC process involves four types of objects: client, client proxy, server, and server proxy. RPC requires that the client and server agree on the calling interface and transmission format (such as JSON, Xml, etc.). When the client calls the interface, the client's proxy object is responsible for format conversion of the calling parameters (including the called function name and parameters, etc.) to conform to the agreed transmission format and transmit it to the server through the network. After the data is transmitted to the server, it is handed over to the server proxy object for format decoding, obtaining the calling interface and parameters, and finally calling the corresponding method of the server object to obtain the result and return it to the client.
[0029] In the prior art, the communication process code of RPC usually depends on the specific RTOS and physical communication link, that is, the RPC core code based on different RTOS and communication interface will be different, which makes it not universal in different hardware environments. Once the hardware environment is adjusted, the code needs to be re-modified. To this end, the embodiment of the present invention provides a universal remote communication call system and method. When using remote calls, the communication process code is not affected by changes in the physical communication link and RTOS. Regardless of the physical communication link and RTOS, the consistency of the communication process code can be maintained.
[0030] like Figure 1 , which is a schematic diagram of the structure of a universal remote communication calling system according to an embodiment of the present invention.
[0031] The universal remote communication calling system includes: an RPC kernel, an IPC interface mapping module, and an operating system encapsulation module, wherein the RPC kernel refers to a remote procedure call method.
[0032] The operating system encapsulation module is used to encapsulate different types of operating system interfaces into a unified interface to provide the RPC kernel with an RTOS standard interface, that is, to use the encapsulated unified interface as the RTOS standard interface;
[0033] The IPC interface mapping module is used to encapsulate the IPC object into a modular structure and establish a corresponding relationship between the RPC kernel and the IPC object; the IPC object refers to a programming interface;
[0034] The RPC kernel is used to realize communication between different operating systems based on the correspondence between the RPC kernel and the IPC object established by the IPC interface mapping module and the RTOS standard interface provided by the operating system encapsulation module.
[0035] The universal remote communication calling system provided by the embodiment of the present invention adopts modular design, and performs standardized modular design on the API (Application Program Interface) of IPC and RTOS, and the core system code remains unchanged. The entire universal remote communication calling system is divided into several modules that can be combined. It is suitable for any combination of various chips, various IPCs, and various RTOSs, and can quickly adapt to product forms that require various IPC communications.
[0036] The above operating system encapsulation module provides the RPC kernel with an RTOS standard interface. For different operating systems, such as MOCOR, RT-Thread, WIN32, etc., the operating interface of each operating system is encapsulated into a unified interface, so that the RPC kernel can use the same code to implement different operating systems.
[0037] For example, to create a thread-general interface, the implementation methods are different in different RTOS, but the functions are the same. The operating system encapsulation module can provide the following RTOS standard interface:
[0038] int rpc_pthread_create(rpc_pthread_t*tidp,const rpc_pthread_pthread_attr_t*attr,(void*)(*start_rtn)(void*),void*arg)
[0039] The above code abstracts RPC into a unified thread creation function, which is used to create a thread, that is, to determine the entry point for calling the thread function. After the thread is created, the related thread function can be started.
[0040] Accordingly, the implementation in the RT-Thread system is as follows:
[0041]
[0042] Accordingly, the implementation in WIN32 system is as follows:
[0043]
[0044]
[0045] Accordingly, the implementation in other RTOS systems is as follows:
[0046]
[0047]
[0048] The bold part is the specific code for creating threads in various RTOS. Since they are different operating systems, the codes will be different. After using the solution of the embodiment of the present invention, it is encapsulated into a unified interface, so that the RPC kernel does not need to care about which specific operating system the RTOS is, thereby improving the versatility of the RPC kernel.
[0049] In the embodiment of the present invention, the IPC object may be, for example, but not limited to, the following: CMUX, SOCKET (socket), SIPC (Share Inter Processor Comm), UART (Universal Asynchronous Receiver / Transmitter), USB (Universal Serial Bus), SPI (Serial Peripheral Interface). Among them, CMUX is a serial port multiplexing protocol that enables a serial interface to transmit data to four different client applications; SOCKET is an abstraction of an endpoint for two-way communication between application processes on different hosts in a network. A socket is one end of process communication on the network, providing a mechanism for application layer processes to exchange data using network protocols; SIPC is an inter-process communication mechanism based on the Spreadtrum multi-processor system; CMUX converts the data to be transmitted between serial communication and parallel communication, and transmits each character of the transmitted data one bit by one; USB is a serial bus standard and a technical specification for input and output interfaces, which is widely used in information communication products such as personal computers and mobile devices; SPI is a high-speed, full-duplex, synchronous communication bus.
[0050] For these different IPC objects, the IPC interface mapping module encapsulates the IPC objects into a modular structure and establishes a correspondence between the RPC kernel and the IPC objects. For example, a pointer can be used to establish a correspondence between the RPC kernel and the IPC objects, so that the RPC kernel can use the corresponding IPC interface according to the correspondence.
[0051] The correspondence between the RPC kernel and the IPC object is established using pointers as follows:
[0052]
[0053] In an embodiment of the present invention, the RPC kernel can implement various existing RPC methods, such as including but not limited to any one or more of the following methods: open (opening a window), read (reading), write (writing), ioctl (input and output control), release (release), etc.
[0054] Take write as an example, it needs to send the specified content and length to the other end, and the other end can achieve the purpose when it receives it. If the underlying drivers are inconsistent, such as UART, USB, SPI, socket, etc., the called interfaces and internal implementation methods are different, but they all have similar functions. The solution of the present invention targets these different interfaces and unifies them into the same input and output form. For example, for the write device function, it is necessary to specify the specific device, the data buffer to be written, the length of the write, and the return status of the write, etc.
[0055] The following takes writing UART / socket devices as examples. They have the same interface but different implementation methods. The details are as follows:
[0056] / / Write the implementation method of UART device
[0057] int write(int ipc,char*buf,int len)
[0058] {
[0059] / / Call the UART related write API to implement it. If the write is successful, the length of the content written successfully will be returned. If the write fails, -1 will be returned.
[0060] }
[0061] / / How to implement writing socket device
[0062] int write(int ipc,char*buf,int len)
[0063] {
[0064] / / Call the socket's write API to implement this. If the write is successful, the length of the content will be returned. If the write fails, -1 will be returned.
[0065] }
[0066] Based on the universal remote communication calling system provided by the embodiment of the present invention, the software directory structure of the RPC kernel is as follows: Figure 2 As shown, it includes an RPC kernel, an RTOS adaptation layer, and an IPC adaptation layer. Through this layered structure, the RPC kernel can remain unchanged regardless of how the IPC object changes and what operating system it is based on.
[0067] The solution of the present invention provides a registration mechanism to unify the interface standards of different IPC components for scanning and registration processing when the system is started.
[0068] The registration mechanism means that when an AP (Application Processor) needs to use RPC to connect to a CP (Content Processor), the connection information related to the CP must be organized into an object and placed in the RPC management list. If multiple APs are connected to CPs, multiple IPC objects need to be registered. These specific connection information are pre-placed in the structure (ipc_operations). After registration is completed, the RPC kernel calls the open pointer, indicating that the connection with the peer CP has been established. After that, the pointer can be used for read / write operations to execute the sending and receiving processing between the AP and the CP.
[0069] Accordingly, the embodiment of the present invention also provides a universal remote communication calling method, such as Figure 3 As shown, it is a flow chart of the method, comprising the following steps:
[0070] Step 301, encapsulating different types of operating system interfaces into a unified interface to provide an RTOS standard interface to the RPC kernel;
[0071] Step 302, encapsulate the IPC object into a modular structure, and establish a corresponding relationship between the RPC kernel and the IPC object;
[0072] Step 303: Implement communication between different operating systems based on the correspondence between the RPC kernel and the IPC object and the RTOS standard interface.
[0073] It should be noted that the serial numbers of the steps in this embodiment do not limit the execution order of the steps.
[0074] The universal remote communication calling method provided by the embodiment of the present invention encapsulates different types of operating system interfaces into a unified interface to provide the RPC kernel with an RTOS standard interface, encapsulates the IPC object into a modular structure, and establishes a corresponding relationship between the RPC kernel and the IPC object. The RPC kernel uses the corresponding relationship between the RPC kernel and the IPC object and the RTOS standard interface to achieve communication between different operating systems, so that the core code of the RPC kernel can be suitable for any combination of various chips, various IPCs, and various RTOSs, and quickly adapt to product forms that require various IPC communications. Even if the IPC object and / or the underlying operating system changes, there is no need to modify the RPC kernel code. Only the corresponding components and modules need to be changed and replaced to complete the product transplantation work well. It greatly facilitates the transplantation of products between different hardware environments, and can be quickly transplanted to systems with different chip modules and different RTOS.
[0075] In a specific implementation, the above-mentioned universal remote communication calling system can be applied to chips in network equipment, such as SoC (System-On-a-Chip), baseband chips, chip modules, etc.
[0076] In a specific implementation, each module / unit included in each device or product described in the above embodiments may be a software module / unit or a hardware module / unit, or may be partly a software module / unit and partly a hardware module / unit.
[0077] For example, for each device or product applied to or integrated in a chip, each module / unit contained therein may be implemented in the form of hardware such as circuits, or at least some of the modules / units may be implemented in the form of software programs, which run on a processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for each device or product applied to or integrated in a chip module, each module / unit contained therein may be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as a chip, circuit module, etc.) or different components of the chip module, or at least some of the modules / units may be implemented in the form of software programs. The element can be implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated in the terminal, the various modules / units contained therein can be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits.
[0078] The embodiment of the present invention further provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored, and the computer program is executed by a processor when it is executed. Figure 3 The steps of the method provided in the corresponding embodiment.
[0079] The embodiment of the present invention also provides another universal remote communication calling system, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the above-mentioned Figure 3 The steps of the method provided in the corresponding embodiment.
[0080] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the above-mentioned Figure 3 The steps of the method provided in the corresponding embodiment.
[0081] In the several embodiments provided by the present invention, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are only schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0082] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0083] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0084] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A universal remote communication calling system, characterized in that: The system includes: an RPC kernel, an IPC interface mapping module, and an operating system encapsulation module; the RPC kernel includes any one or more of the following methods: opening a window, reading, writing, input and output control, and releasing; The operating system encapsulation module is used to encapsulate different types of operating system interfaces into a unified interface to provide an RTOS standard interface to the RPC kernel; The IPC interface mapping module is used to encapsulate the IPC object into a modular structure and establish a corresponding relationship between the RPC kernel and the IPC object; the IPC object includes any one of the following: CMUX, SOCKET, SIPC, UART, USB, SPI; The RPC kernel is used to realize communication between different operating systems according to the correspondence between the RPC kernel and the IPC object established by the IPC interface mapping module and the RTOS standard interface provided by the operating system encapsulation module.
2. The universal remote communication calling system according to claim 1, characterized in that: The IPC interface mapping module establishes a corresponding relationship between the RPC kernel and the IPC object through a pointer.
3. The universal remote communication calling system according to claim 1, characterized in that: The operating system includes any one of the following: MOCOR, RT-Thread, WIN32.
4. A universal remote communication calling method, characterized in that: The method comprises: Encapsulate different types of operating system interfaces into a unified interface to provide an RTOS standard interface to the RPC kernel; the RPC kernel includes any one or more of the following methods: open window, read, write, input and output control, release; Encapsulate the IPC object into a modular structure, and establish a corresponding relationship between the RPC kernel and the IPC object; the IPC object includes any one of the following: CMUX, SOCKET, SIPC, UART, USB, SPI; The communication between different operating systems is realized according to the corresponding relationship between the RPC kernel and the IPC object and the RTOS standard interface.
5. The universal remote communication calling method according to claim 4, characterized in that: The establishment of the corresponding relationship between the RPC kernel and the IPC object includes: The correspondence between the RPC kernel and the IPC object is established through pointers.
6. The universal remote communication calling method according to claim 4, characterized in that: The operating system includes any one of the following: MOCOR, RT-Thread, WIN32.
7. A computer-readable storage medium, wherein the computer-readable storage medium is a non-volatile storage medium or a non-transient storage medium, and a computer program is stored thereon, wherein: When the computer program is executed by a processor, the steps of the method according to any one of claims 4 to 6 are performed.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the method according to any one of claims 4 to 6 are performed.
Citation Information
Patent Citations
Communication scheduling system and method among cores of isomerization multi-core processor
CN101354693A
Cross-environment communication framework
CN103262057A
Realization method of real-time operating system of component-based hardware
CN103440171A
SDK and method for remote control of different protocol types of wireless communication modules
CN106657101A
Multi-operation system operating method and device based on industrial internet operating system
CN107479943A
