System and method for implementing multiplexing protocols on an rtos platform
By introducing multiplexing and interface modules into the RTOS platform and encapsulating the application service programming interfaces of different RTOS platforms, a unified multiplexing protocol for RTOS platform devices is realized, which solves the problem of high difficulty in porting business layers of RTOS platform devices and improves the maintainability and stability of the devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SPREADTRUM COMM SHENZHEN CO LTD
- Filing Date
- 2023-04-04
- Publication Date
- 2026-04-21
AI Technical Summary
The existing RTOS platform devices have different connection methods due to the tight coupling of the application service layer, middleware layer and driver layer, which makes them difficult to maintain and not conducive to flexible portability.
By introducing multiplexing and interface modules into the RTOS platform, application service programming interfaces for different RTOS platforms are encapsulated, and a unified multiplexing protocol is achieved by communicating with the RTOS platform and driver module through the multiplexing module.
It reduces the difficulty of porting the service layer of RTOS platform devices, maintains the consistency of behavior of different RTOS platform devices, and improves the stability and portability of multiplexing modules.
Smart Images

Figure CN116527774B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a system and method for implementing multiplexing protocols on an RTOS platform. Background Technology
[0002] Existing RTOS (Real-Time Operating System) platform devices typically consist of an application service layer, a middleware layer, and a driver layer. These three layers are tightly coupled to enable multiplexing protocols on the RTOS platform. Different RTOS platform devices have different connection and driving methods for their application service layer, middleware layer, and driver layer, lacking a unified standard. This hinders the maintenance of RTOS platform devices and prevents flexible portability of service layers between different RTOS platform devices. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to overcome the high difficulty of porting the service layer of RTOS platform devices in the prior art, and to provide a system and method for implementing multiplexing protocols on RTOS platform.
[0004] The present invention solves the above-mentioned technical problems through the following technical solution:
[0005] This invention provides a system for implementing a multiplexing protocol on an RTOS platform, the system comprising a multiplexing module and an interface module;
[0006] The multiplexing module is communicatively connected to the interface module; the interface module encapsulates application service programming interfaces corresponding to different RTOS platforms.
[0007] The multiplexing module is used to implement the multiplexing protocol between the application service and the RTOS platform;
[0008] The multiplexing module is used to call the RTOS platform adapted to the multiplexing module through the interface module and send the running command to the RTOS platform to trigger the RTOS platform to send the functional module data to the multiplexing module.
[0009] The multiplexing module is used to send the data of the functional modules to the application service so that the application service can run.
[0010] Preferably, the system further includes a driver module;
[0011] The multiplexing module is communicatively connected to the driver module; the driver module encapsulates function pointers corresponding to different driver devices.
[0012] The multiplexing module is used to send a driving instruction to the driving module to trigger the driving module to determine the function pointer corresponding to the driving instruction;
[0013] The multiplexing module is used to call the driver device corresponding to the function pointer through the driver module, and to communicate with the RTOS platform through the driver device.
[0014] Preferably, the multiplexing module includes an encapsulation unit;
[0015] The encapsulation unit is used to receive and encapsulate the runtime data of the application service, and send the encapsulated runtime data to the RTOS platform through the interface module.
[0016] And / or,
[0017] The multiplexing module includes a parsing unit;
[0018] The parsing unit is used to receive and parse the functional module data of the RTOS platform, and send the parsed functional module data to the application service so that the application service can run.
[0019] And / or,
[0020] The RTOS platform includes at least one of rtthread, mocor, and threadx.
[0021] Preferably, the multiplexing module includes an enabling unit;
[0022] The activation unit is communicatively connected to the drive module;
[0023] The activation unit is used to receive the activation instruction of the application service and send the driver instruction representing activation to the driver module, so that the driver module determines the function pointer corresponding to the driver instruction representing activation and calls the driver device corresponding to the function pointer through the driver module;
[0024] And / or, the multiplexing module includes a disconnection unit;
[0025] The disconnection unit is communicatively connected to the drive module;
[0026] The disconnection unit is used to receive the disconnection command of the application service and send the driver command representing the disconnection to the driver module, so that the driver module determines the function pointer corresponding to the driver command representing the disconnection; and calls the driver device corresponding to the function pointer through the driver module.
[0027] And / or,
[0028] The multiplexing module includes a data receiving and processing unit;
[0029] The data receiving and processing unit is used to receive control commands from the driving device and execute the communication operation according to the control commands;
[0030] And / or,
[0031] The communication operations include at least one of the following: initialization operation, open operation, close operation, read operation, write operation, and control operation.
[0032] This invention also provides a method for implementing a multiplexing protocol on an RTOS platform, applicable to the system described above for implementing a multiplexing protocol on an RTOS platform, the method comprising:
[0033] Determine the compatible RTOS platform;
[0034] The interface module calls the RTOS platform and sends execution instructions to the RTOS platform.
[0035] Receive functional module data sent by the RTOS platform;
[0036] The data of the functional modules is sent to the application service so that the application service can run.
[0037] Preferably, when the system implementing the multiplexing protocol on the RTOS platform includes a driver module, the method further includes:
[0038] Send a driver instruction to the driver module to trigger the driver module to determine the function pointer corresponding to the driver instruction;
[0039] The driver module calls the driver device corresponding to the function pointer.
[0040] The driver device communicates with the RTOS platform.
[0041] Preferably, the method further includes:
[0042] Receive and encapsulate the runtime data of the application service;
[0043] The packaged runtime data is sent to the RTOS platform through the interface module.
[0044] And / or,
[0045] The method further includes:
[0046] The system receives and parses the functional module data of the RTOS platform, and sends the parsed functional module data to the application service to enable the application service to run.
[0047] Preferably, the step of sending a driver instruction to the driver module to trigger the driver module to determine the function pointer corresponding to the driver instruction includes:
[0048] Receive the command to start the application service;
[0049] The driver instruction indicating that the driver is enabled is sent to the driver module so that the driver module can determine the function pointer corresponding to the driver instruction indicating that the driver is enabled.
[0050] And / or,
[0051] The step of sending a driver instruction to the driver module to trigger the driver module to determine the function pointer corresponding to the driver instruction includes:
[0052] Receive the disconnect command for the application service;
[0053] The driver instruction indicating disconnection is sent to the driver module so that the driver module can determine the function pointer corresponding to the driver instruction indicating disconnection.
[0054] And / or,
[0055] The step of communicating with the RTOS platform through the driver device includes:
[0056] Receive control commands from the drive device;
[0057] The communication operation is performed according to the control command.
[0058] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and for running on the processor, wherein the processor executes the computer program to implement the method described above for implementing a multiplexing protocol on an RTOS platform.
[0059] The present invention also provides a chip for use in an electronic device, the chip being used to execute the method described above for implementing a multiplexing protocol on an RTOS platform.
[0060] The present invention also provides a chip module for use in electronic devices, including transceiver components and a chip, wherein the chip is used to execute the method described above for implementing a multiplexing protocol on an RTOS platform.
[0061] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described above for implementing a multiplexing protocol on an RTOS platform.
[0062] Based on common knowledge in the field, the above-mentioned preferred conditions can be combined arbitrarily to obtain various preferred embodiments of the present invention.
[0063] The positive and progressive effects of this invention are as follows:
[0064] This invention encapsulates the application service programming interfaces corresponding to different RTOS platforms into an interface module. Through the communication connection between the interface module and the multiplexing module, a multiplexing protocol is implemented between the application service and the RTOS platform. This reduces the difficulty of porting the service layer of the RTOS platform device while implementing the multiplexing protocol, facilitating the maintenance of the RTOS platform device. Furthermore, the multiplexing protocol interacts with different RTOS platforms through a unified interface, maintaining behavioral consistency and avoiding differences caused by inconsistencies in the RTOS platform interfaces when the multiplexing module is ported to different RTOS platform devices. This contributes to the stability of the multiplexing module's functionality after porting. Attached Figure Description
[0065] Figure 1 This is a schematic diagram of the system structure for implementing a multiplexing protocol on an RTOS platform according to Embodiment 1 of the present invention;
[0066] Figure 2 This is a schematic diagram of the service layer structure of the system implementing the multiplexing protocol on the RTOS platform according to Embodiment 1 of the present invention after being ported to the RTOS device platform;
[0067] Figure 3 This is a schematic diagram of the service layer decoupling structure of a system implementing a multiplexing protocol on an RTOS platform according to Embodiment 1 of the present invention;
[0068] Figure 4 This is a schematic diagram of the sub-module structure inside the multiplexing module, which is a specific example of a system implementing a multiplexing protocol on an RTOS platform according to Embodiment 1 of the present invention.
[0069] Figure 5 This is a flowchart of a method for implementing a multiplexing protocol on an RTOS platform according to Embodiment 2 of the present invention;
[0070] Figure 6 This is a schematic diagram of the electronic device structure according to Embodiment 3 of the present invention. Detailed Implementation
[0071] The present invention will be further illustrated by way of embodiments below, but the present invention is not limited to the scope of the embodiments described herein.
[0072] Example 1
[0073] This embodiment provides a system for implementing a multiplexing protocol on an RTOS (Real-Time Operating System) platform. See [link to documentation]. Figure 1The system includes a multiplexing module 1 and an interface module 2.
[0074] Multiplexing module 1 communicates with interface module 2. Interface module 2 encapsulates application programming interfaces (APIs) corresponding to different RTOS platforms. These APIs adopt POSIX-like standards to maintain behavioral consistency, allowing the multiplexing protocol to interact with different RTOS platforms through a unified interface. This avoids differences when multiplexing module 1 is ported to devices on different RTOS platforms due to inconsistencies in RTOS platform interfaces.
[0075] The RTOS platform can be any RTOS platform, such as rtthread (a real-time operating system), mocor (a real-time operating system), and threadx (a real-time operating system).
[0076] Multiplexing module 1 is used to implement the multiplexing protocol between application services and the RTOS platform.
[0077] Multiplexing module 1 is used to call an RTOS platform adapted to multiplexing module 1 through interface module 2 and send run commands to the RTOS platform to trigger the RTOS platform to send functional module data to multiplexing module 1. The functional module data consists of data from auxiliary application services called by the RTOS platform based on the run data.
[0078] Multiplexing module 1 is used to send data from functional modules to the application service so that the application service can run.
[0079] In this embodiment, the application service programming interfaces corresponding to different RTOS platforms are encapsulated in interface module 2. Through the communication connection between interface module 2 and multiplexing module 1, a multiplexing protocol between the application service and the RTOS platform is implemented. This reduces the difficulty of porting the service layer of the RTOS platform device while implementing the multiplexing protocol, facilitating the maintenance of the RTOS platform device. Furthermore, the multiplexing protocol interacts with different RTOS platforms through a unified interface, maintaining behavioral consistency and avoiding differences caused by inconsistencies in the interfaces of different RTOS platforms when the multiplexing module is ported to different RTOS platform devices. This contributes to the stability of the multiplexing module's functionality after porting.
[0080] In an optional implementation, see Figure 1 The system also includes driver module 3.
[0081] Multiplexing module 1 is communicatively connected to driver module 3. Driver module 3 encapsulates function pointers corresponding to different driver devices.
[0082] The driving devices include UART (Uaortic Serial Communication Port), USB COM (Universal Serial Bus Port), etc.
[0083] Function pointers include open, close, read, write, and control function pointers.
[0084] Multiplexing module 1 is used to send drive instructions to drive module 3 to trigger drive module 3 to determine the function pointer corresponding to the drive instruction.
[0085] Multiplexing module 1 is used to call the driver device corresponding to the function pointer through driver module 3, and to communicate with the RTOS platform through the driver device.
[0086] The communication operations include at least one of the following: initialization operation, open operation, close operation, read operation, write operation, and control operation.
[0087] The type of driver instruction for multiplexing module 1 is determined based on the instructions of the application service. The following are examples of driver instructions that represent enabling and driver instructions that represent disabling:
[0088] In an optional implementation, see Figure 1 The multiplexing module 1 includes an enabling unit 13.
[0089] The unit 13 is connected to the driver module 3.
[0090] The startup unit 13 is used to receive the startup instruction of the application service and send the driver instruction representing startup to the driver module 3, so that the driver module 3 determines the function pointer corresponding to the driver instruction representing startup and calls the driver device corresponding to the function pointer through the driver module 3.
[0091] In this embodiment, the driver instruction representing the start is determined according to the application service start instruction, and then the function pointer encapsulated by the driver module 3 and the driver device corresponding to the function pointer are determined.
[0092] In an optional implementation, see Figure 1 The multiplexing module 1 includes a disconnection unit 14.
[0093] Disconnect the communication connection between unit 14 and drive module 3.
[0094] The disconnection unit 14 is used to receive the disconnection command of the application service and send the driver command representing the disconnection to the driver module 3, so that the driver module 3 determines the function pointer corresponding to the driver command representing the disconnection and calls the driver device corresponding to the function pointer through the driver module 3.
[0095] In this embodiment, the driver instruction representing the disconnection is determined based on the disconnection instruction of the application service, and then the function pointer encapsulated by the driver module 3 and the driver device corresponding to the function pointer are determined.
[0096] In this embodiment, function pointers corresponding to different driver devices are encapsulated in driver module 3. Through the communication connection between driver module 3 and multiplexing module 1, the driver device corresponding to the function pointer is called, and communication operation is performed with the RTOS platform through the driver device. This decouples the driver layer from the RTOS platform device, further improving the portability of the RTOS platform device's service layer.
[0097] In an optional implementation, see Figure 1 The multiplexing module 1 includes an encapsulation unit 11.
[0098] The encapsulation unit 11 is used to receive and encapsulate the runtime data of the application service, and send the encapsulated runtime data to the RTOS platform through the interface module 2.
[0099] In this embodiment, the application service's runtime data is sent to the RTOS platform through the encapsulation unit 11, which helps to simplify the data flow structure.
[0100] In an optional implementation, see Figure 1 The multiplexing module 1 includes a parsing unit 12.
[0101] The parsing unit 12 is used to receive and parse the functional module data of the RTOS platform, and send the parsed functional module data to the application service so that the application service can run.
[0102] In this embodiment, the parsing unit 12 sends the functional module data of the RTOS platform to the application service, which helps to improve the operating efficiency of the application service.
[0103] In an optional implementation, the multiplexing module 1 includes both an encapsulation unit 11 and a parsing unit 12, which helps to simplify the data flow structure and improve the operating efficiency of application services.
[0104] In an optional implementation, see Figure 1 The multiplexing module 1 includes a data receiving and processing unit 15.
[0105] The data receiving and processing unit 15 is used to receive control commands from the driving device and perform communication operations according to the control commands.
[0106] In this embodiment, the data receiving and processing unit 15 receives control commands from the driving device and performs communication operations such as initialization, opening, closing, reading, writing, and control operations according to the control commands. This decouples the middleware layer and the driver layer of the RTOS platform device and improves the portability of the service layer of the RTOS platform device.
[0107] The following is a specific example of a system that implements a multiplexing protocol on an RTOS platform. Figure 2 The service layers of the RTOS device platform to be ported are: application service layer, middleware layer (MUX layer, multiplexing module layer), and driver layer. The application service layer includes ATC (Modem Command Language) services, PPP internet access services (dial-up internet access) services, and LOG (log) services. The PORT module is used to send and receive runtime data from the application service layer. For example, the AT command service (Modem Command Language) interacts with the middleware layer through the ATC PORT, the PPP internet access service (Dial-up internet access) interacts with the middleware layer through the PPP PORT, and the LOG service (Log) interacts with the middleware layer through the LOG PORT. The driver layer includes hardware drivers such as USB COM DRV (Universal Serial Bus Driver) and UART DRV (Asynchronous Serial Communication Driver).
[0108] See Figure 3 The middleware layer is abstracted into a multiplexing module, the application service layer into application services, and the driver layer into driver modules. To enable communication between the multiplexing module and at least one RTOS platform, the interfaces of at least one RTOS platform are encapsulated into an OSA (RTOS platform adaptation layer, the same as the interface module mentioned above). To enable communication between the multiplexing module and at least one driver device, the function pointers (open, close, read, write, control, etc.) of at least one driver device are encapsulated in driver modules (DRV, DEV, etc.). When the business layer of the RTOS platform is ported, the RTOS platform only needs to implement the OSA code and the specific driver code to implement the multiplexing protocol and run application services.
[0109] In this example, the sub-module structure within the multiplexing module and the data interaction flow between the multiplexing module and the application service and driver module are as follows: Figure 4 As shown.
[0110] To implement a multiplexing protocol, the multiplexing module must first be started. This example establishes the multiplexing module through the serial channel service module, specifically relying on the multiplexing module, the driver module, and the serial device operation unit within the multiplexing module. The serial device operation unit operates primarily through driver instructions corresponding to function pointers such as open, close, read, write, and control. The serial device operation unit is called by the device management unit within the multiplexing module, which in turn calls the driver module to invoke specific driver devices (such as...). Figure 4 (UART module and USB COM module in the system). Before the application service is running, the data receiving and processing unit is triggered to receive and process data from the driver module and other data.
[0111] After the multiplexing module establishes a communication connection with the RTOS platform, it uses the MUX (Multiplexing Protocol) channel service module, sub-channel creation unit, sub-channel disconnection unit, parsing unit, and encapsulation unit.
[0112] When an application service starts running, it triggers the sub-channel creation and discontinuation units through the MUX channel service module to create or disconnect virtual channels in the multiplexing module. Virtual channels are used to access specific application services (AT command services, PPP internet access services, and LOG services, etc.). For example, if the application service is an AT command service, when the AT command "AT+CMUX=..." is received, the sub-channel creation unit is triggered, creating a virtual channel for the AT command service and simultaneously initiating the communication connection between the virtual channel and the multiplexing module to transmit the application service's runtime data to the multiplexing module. When the application service stops running, the sub-channel discontinuation unit is triggered, disconnecting the data transmission channel in the multiplexing module and stopping the transmission of the application service's runtime data to the multiplexing module.
[0113] When the application service starts running, if the RTOS platform needs to transmit module data to assist the application service's operation, the parsing unit and encapsulation unit are triggered. The parsing unit processes the various types of frames (SABM, UIH, UI, DISC) parsed from the RTOS platform respectively, and the encapsulation unit encapsulates the module data and sends the module data to the multiplexing module.
[0114] Below is a code excerpt example of an interface module:
[0115] int umux_pthread_create(umux_pthread_t*tidp,const umux_pthread_attr_t*attr,void(*start_rtn)(void*),void*arg);
[0116] int umux_pthread_destory(umux_pthread_t tid);
[0117] int umux_pthread_resume(umux_pthread_t tid);
[0118] int umux_pthread_suspend(umux_pthread_t tid);
[0119] int umux_pthread_mutex_init(umux_pthread_mutex_t*mutex,const umux_pthread_mutexattr_t*attr);
[0120] int umux_pthread_mutex_lock(umux_pthread_mutex_t*mutex);
[0121] int umux_pthread_mutex_unlock(umux_pthread_mutex_t*mutex);
[0122] int umux_pthread_mutex_destroy(umux_pthread_mutex_t*mutex);
[0123] ………
[0124] void*umux_malloc(unsigned int size);
[0125] void*umux_calloc(unsigned int num,unsigned int size);
[0126] void umux_free(void*ptr);
[0127] The following is an example excerpt of the code for a driver module:
[0128]
[0129] Taking the serial port COM0 of the driver device as an example:
[0130] const struct umux_device_ops com_0_device_ops=
[0131] {
[0132] NULL,
[0133] com_0_open,
[0134] com_0_close,
[0135] com_0_read,
[0136] com_0_write,
[0137] com_0_control,
[0138] };
[0139] The following describes the specific functions of serial port COM0, which need to be implemented by the ported RTOS platform device:
[0140] int com_0_open(int dev,uint16_t oflag);
[0141] int com_0_close(int dev);
[0142] int com_0_read(int dev,off_t pos,void*buffer,size_t size);
[0143] int com_0_write(int dev,off_t pos,const void*buffer,size_t size);
[0144] int com_0_control(int dev,int cmd,void*args);
[0145] The system for implementing multiplexing protocols on an RTOS platform provided in this embodiment can be a separate chip, chip module, or electronic device, or it can be a chip or chip module integrated into an electronic device.
[0146] Example 2
[0147] This embodiment provides a method for implementing a multiplexing protocol on an RTOS platform. (See also...) Figure 5 The method, applied to a system implementing a multiplexing protocol on an RTOS platform as in Example 1, includes:
[0148] S1. Determine the compatible RTOS platform.
[0149] S2. Call the RTOS platform through the interface module, send the running instructions to the RTOS platform, and receive the functional module data sent by the RTOS platform.
[0150] S3. Send the functional module data to the application service so that the application service can run.
[0151] In an optional implementation, when the system implementing the multiplexing protocol on the RTOS platform includes a driver module, the method further includes:
[0152] S4. Send the driver instruction to the driver module to trigger the driver module to determine the function pointer corresponding to the driver instruction.
[0153] S5. Call the driver device corresponding to the function pointer through the driver module.
[0154] S6. Communicate with the RTOS platform via the driver device.
[0155] In an optional implementation, the method further includes:
[0156] S7. Receive and encapsulate the runtime data of the application service.
[0157] S8. The packaged runtime data is sent to the RTOS platform through the interface module.
[0158] In an optional implementation, the method further includes:
[0159] S9. Receive and parse the functional module data of the RTOS platform, and send the parsed functional module data to the application service so that the application service can run.
[0160] It should be noted that the order of S1~S3, S4~S6, S7~S8 and S9 is not limited in this embodiment. The order of the above steps can be freely combined according to actual needs to form different solutions.
[0161] In an optional implementation, step S4 includes:
[0162] S41, Receive the command to start the application service.
[0163] S42. Send the driving instruction that indicates the character is enabled to the driving module so that the driving module can determine the function pointer corresponding to the driving instruction that indicates the character is disabled.
[0164] In an optional implementation, step S4 includes:
[0165] S43, Receive the disconnect command for the application service.
[0166] S44. Send the drive instruction indicating disconnection to the drive module so that the drive module can determine the function pointer corresponding to the drive instruction indicating disconnection.
[0167] In an optional implementation, step S6 includes:
[0168] S61, Receive control commands from the drive device.
[0169] S62. Perform communication operations according to control instructions.
[0170] It should be noted that the implementation principle and technical effects of this embodiment can be referred to the corresponding part of Embodiment 1, and will not be repeated here.
[0171] Example 3
[0172] This embodiment provides an electronic device. Figure 6 This is a schematic diagram of the electronic device. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the method for implementing a multiplexing protocol on an RTOS platform as described in Embodiment 2. Figure 6 The electronic device 30 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0173] like Figure 6 As shown, the electronic device 30 can be manifested as a general-purpose computing device, such as a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including memory 32 and processor 31).
[0174] Bus 33 includes a data bus, an address bus, and a control bus.
[0175] The memory 32 may include volatile memory, such as random access memory (RAM) 321 and / or cache memory 322, and may further include read-only memory (ROM) 323.
[0176] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0177] The processor 31 executes various functional applications and data processing by running computer programs stored in the memory 32, such as the method for implementing a multiplexing protocol on an RTOS platform according to Embodiment 2 of the present invention.
[0178] Electronic device 30 can also communicate with one or more external devices 34 (e.g., keyboard, pointing device, etc.). This communication can be performed via input / output (I / O) interface 35. Furthermore, the model-generating device 30 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 36. Figure 6 As shown, network adapter 36 communicates with other modules of the model-generated device 30 via bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
[0179] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0180] Example 4
[0181] This embodiment provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method of implementing a multiplexing protocol on an RTOS platform as described in Embodiment 2.
[0182] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.
[0183] In a possible implementation, the present invention can also be implemented as a program product comprising program code that, when the program product is run on an electronic device, causes the electronic device to execute the method for implementing the multiplexing protocol on an RTOS platform as described in Embodiment 2.
[0184] The program code for executing the present invention can be written in any combination of one or more programming languages. The program code can be executed entirely on an electronic device, partially on an electronic device, as a standalone software package, partially on an electronic device and partially on a remote device, or entirely on a remote device.
[0185] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but all such changes and modifications fall within the scope of protection of the present invention.
Claims
1. A system for implementing a multiplexing protocol on an RTOS platform, characterized in that, The system includes a multiplexing module and an interface module; The multiplexing module is communicatively connected to the interface module; the interface module encapsulates application service programming interfaces corresponding to different RTOS platforms. The multiplexing module is used to implement the multiplexing protocol between the application service and the RTOS platform; The multiplexing module is used to call the RTOS platform adapted to the multiplexing module through the interface module and send the running command to the RTOS platform to trigger the RTOS platform to send the functional module data to the multiplexing module. The multiplexing module is used to send the data of the functional modules to the application service so that the application service can run; The RTOS platform includes at least one of rtthread, mocor, and threadx.
2. The system for implementing a multiplexing protocol on an RTOS platform as described in claim 1, characterized in that, The system also includes a driver module; The multiplexing module is communicatively connected to the driver module; the driver module encapsulates function pointers corresponding to different driver devices. The multiplexing module is used to send a driving instruction to the driving module to trigger the driving module to determine the function pointer corresponding to the driving instruction; The multiplexing module is used to call the driver device corresponding to the function pointer through the driver module, and to communicate with the RTOS platform through the driver device.
3. The system for implementing a multiplexing protocol on an RTOS platform as described in claim 1, characterized in that, The multiplexing module includes an encapsulation unit; The encapsulation unit is used to receive and encapsulate the runtime data of the application service, and send the encapsulated runtime data to the RTOS platform through the interface module. And / or, The multiplexing module includes a parsing unit; The parsing unit is used to receive and parse the functional module data of the RTOS platform, and send the parsed functional module data to the application service so that the application service can run.
4. The system for implementing a multiplexing protocol on an RTOS platform as described in claim 2, characterized in that, The multiplexing module includes an enabling unit; The activation unit is communicatively connected to the drive module; The activation unit is used to receive the activation instruction of the application service and send the driver instruction representing activation to the driver module, so that the driver module determines the function pointer corresponding to the driver instruction representing activation and calls the driver device corresponding to the function pointer through the driver module. And / or, the multiplexing module includes a disconnection unit; The disconnection unit is communicatively connected to the drive module; The disconnection unit is used to receive the disconnection command of the application service and send the driver command representing the disconnection to the driver module, so that the driver module determines the function pointer corresponding to the driver command representing the disconnection; and calls the driver device corresponding to the function pointer through the driver module. And / or, The multiplexing module includes a data receiving and processing unit; The data receiving and processing unit is used to receive control commands from the driving device and execute the communication operation according to the control commands; And / or, The communication operations include at least one of the following: initialization operation, open operation, close operation, read operation, write operation, and control operation.
5. A method for implementing a multiplexing protocol on an RTOS platform, characterized in that, The method, applied to a system implementing a multiplexing protocol on an RTOS platform as described in any one of claims 1-4, comprises: Determine the compatible RTOS platform; The interface module calls the RTOS platform and sends execution instructions to the RTOS platform. Receive functional module data sent by the RTOS platform; The data of the functional modules is sent to the application service so that the application service can run.
6. The method for implementing a multiplexing protocol on an RTOS platform as described in claim 5, characterized in that, When the system implementing the multiplexing protocol on the RTOS platform includes a driver module, the method further includes: Send a driver instruction to the driver module to trigger the driver module to determine the function pointer corresponding to the driver instruction; The driver module calls the driver device corresponding to the function pointer. The driver device communicates with the RTOS platform.
7. The method for implementing a multiplexing protocol on an RTOS platform as described in claim 5, characterized in that, The method further includes: Receive and encapsulate the runtime data of the application service; The packaged runtime data is sent to the RTOS platform through the interface module. And / or, The method further includes: The system receives and parses the functional module data of the RTOS platform, and sends the parsed functional module data to the application service to enable the application service to run.
8. The method for implementing a multiplexing protocol on an RTOS platform as described in claim 6, characterized in that, The step of sending a driver instruction to the driver module to trigger the driver module to determine the function pointer corresponding to the driver instruction includes: Receive the command to start the application service; The driver instruction indicating that the driver is enabled is sent to the driver module so that the driver module can determine the function pointer corresponding to the driver instruction indicating that the driver is enabled. And / or, The step of sending a driver instruction to the driver module to trigger the driver module to determine the function pointer corresponding to the driver instruction includes: Receive the disconnect command for the application service; The driver instruction indicating disconnection is sent to the driver module so that the driver module can determine the function pointer corresponding to the driver instruction indicating disconnection. And / or, The step of communicating with the RTOS platform through the driver device includes: Receive control commands from the drive device; The communication operation is performed according to the control command.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and for running on the processor, characterized in that, When the processor executes the computer program, it implements the method for implementing a multiplexing protocol on an RTOS platform as described in any one of claims 5-8.
10. A chip used in an electronic device, characterized in that, The chip is used to execute the method for implementing a multiplexing protocol on an RTOS platform as described in any one of claims 5-8.
11. A chip module, used in electronic devices, characterized in that, It includes transceiver components and a chip, said chip being used to perform the method for implementing a multiplexing protocol on an RTOS platform as described in any one of claims 5-8.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for implementing a multiplexing protocol on an RTOS platform as described in any one of claims 5-8.
Citation Information
Patent Citations
Embedded system software and hardware decoupling architecture based on model and middleware
CN114398306A