A communication method, apparatus, device, and storage medium
By setting up a multi-path system in the RTOS platform, multi-path communication under different communication scenarios is realized, solving the problem that the RTOS platform can only communicate in a single path, and improving communication flexibility and portability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SPREADTRUM COMMUNICATION (SHANGHAI) CO LTD
- Filing Date
- 2023-03-30
- Publication Date
- 2026-04-28
AI Technical Summary
Existing RTOS platforms can only perform single-channel communication and support only one communication scenario, which cannot meet the multi-channel communication needs of IoT modules. The existing multi-channel communication solutions require a large amount of work to reconstruct and are not portable.
A multi-path system is set up in the RTOS platform, including the driver layer, SIO layer and application layer. Multi-path communication is realized through at least two transmission paths, and physical ports are bound to SIO physical ports and logical ports respectively. PPP dial-up Internet access and AT command control scenarios are supported in different working modes.
It enables multi-channel communication on the RTOS platform under different communication scenarios, simplifies the refactoring process, improves communication flexibility and portability, and reduces debugging and testing difficulty.
Smart Images

Figure CN116340026B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and more particularly to a communication method, apparatus, device, and storage medium. Background Technology
[0002] The MOCOR platform, which is based on a Real-Time Operating System (RTOS), can be simply referred to as an RTOS platform. This platform is centered on a multi-mode single chip and provides a complete solution including communication software, application software, reference designs, development boards, development tools, and technical support to help various customers meet their differentiated needs.
[0003] Current IoT modules need to support both Point-to-Point Protocol (PPP) dial-up internet access scenarios and Attention (AT) command control scenarios. However, existing RTOS platforms can only perform single-channel communication and support only one communication scenario, which does not meet the usage requirements of IoT modules.
[0004] Therefore, there is an urgent need for a multi-communication method suitable for RTOS platforms. Summary of the Invention
[0005] This application provides a communication method, apparatus, device, and storage medium.
[0006] In a first aspect, embodiments of this application provide a communication method applied in an electronic device. The electronic device is equipped with a multi-path system, which includes a driver layer, a serial input / output (SIO) layer, and an application layer. At least two transmission paths are provided between the driver layer and the SIO layer. The method includes:
[0007] First data is received through a first physical port on the driver layer, and the driver layer is provided with at least two physical ports, including the first physical port;
[0008] Determine the first transmission path corresponding to the first physical port among the at least two transmission paths;
[0009] The first data is transmitted to the application layer through the first transmission path, and feedback data corresponding to the first data is received from the application layer through the first transmission path.
[0010] In one possible implementation, the SIO layer is provided with at least two SIO logical ports; transmitting first data to the application layer through the first transmission path includes:
[0011] Determine the first SIO logic port corresponding to the first transmission path from the at least two SIO logic ports;
[0012] The first data is transmitted to the application layer through the first SIO logical port.
[0013] In one possible implementation, the SIO layer is provided with at least two SIO physical ports; transmitting the first data to the application layer through the first SIO logical port includes:
[0014] Determine the first SIO physical port corresponding to the first transmission path from the at least two SIO physical ports;
[0015] The system receives the first data transmitted from the first physical port through the first SIO physical port, stores it in the first buffer corresponding to the first SIO logical port, and sends a first message to the application layer. The first message includes a target link identifier, which is the link identifier corresponding to the first transmission path.
[0016] The application layer determines the first SIO logical port based on the target link identifier and reads the first data from the first cache corresponding to the first SIO logical port.
[0017] In one possible implementation, receiving feedback data corresponding to the first data from the application layer via the first transmission path includes:
[0018] The first SIO logical port is determined based on the target link identifier corresponding to the first transmission path;
[0019] The feedback data is received from the application layer through the first SIO logical port, stored in the second buffer corresponding to the first SIO logical port, and then sent through the first SIO logical port.
[0020] In one possible implementation, sending the feedback data via the first SIO logic port includes:
[0021] A second message is sent to the driver layer through the first SIO logical port. The second message is used to indicate that the first physical port enters the interrupt enable state.
[0022] The driver layer determines the first SIO physical port and the first SIO logical port based on the first physical port;
[0023] The feedback data stored in the second buffer corresponding to the first SIO logical port is read into the driver layer through the first SIO physical port;
[0024] The feedback data is sent through the driver layer.
[0025] In one possible implementation, before receiving the first data through the first physical port on the driver layer, the method further includes:
[0026] The third message is received through the driver layer;
[0027] According to the third message, the first physical port is determined among the at least two physical ports, and the first transmission path corresponding to the first physical port includes two working modes.
[0028] Based on the third message, the target operating mode is determined from the two operating modes of the first transmission path;
[0029] Set the operating mode of the first transmission path to the target operating mode.
[0030] In one possible implementation, the method further includes:
[0031] The at least two physical ports are respectively bound to at least two SIO physical ports in the SIO layer, the at least two SIO physical ports are mapped to at least two SIO logical ports in the SIO layer, and the at least two SIO logical ports are bound to at least two link identifiers to obtain the at least two transmission paths.
[0032] Secondly, embodiments of this application provide a communication device applied in an electronic device. The electronic device is provided with a multi-path system, the multi-path system including a driver layer, a serial input / output (SIO) layer, and an application layer. At least two transmission paths are provided between the driver layer and the SIO layer. The device includes:
[0033] A communication module is used to receive first data through a first physical port on the driver layer, wherein the driver layer is provided with at least two physical ports, and the at least two physical ports include the first physical port.
[0034] The processing module is configured to determine, among the at least two transmission paths, a first transmission path corresponding to the first physical port; transmit the first data to the application layer through the first transmission path; and receive feedback data corresponding to the first data from the application layer through the first transmission path.
[0035] In one possible implementation, the SIO layer is provided with at least two SIO logical ports; the processing module is specifically used for:
[0036] Determine the first SIO logic port corresponding to the first transmission path from the at least two SIO logic ports;
[0037] The first data is transmitted to the application layer through the first SIO logical port.
[0038] In one possible implementation, the SIO layer is provided with at least two SIO physical ports; the processing module is specifically used for:
[0039] Determine the first SIO physical port corresponding to the first transmission path from the at least two SIO physical ports;
[0040] The system receives the first data transmitted from the first physical port through the first SIO physical port, stores it in the first buffer corresponding to the first SIO logical port, and sends a first message to the application layer. The first message includes a target link identifier, which is the link identifier corresponding to the first transmission path.
[0041] The application layer determines the first SIO logical port based on the target link identifier and reads the first data from the first cache corresponding to the first SIO logical port.
[0042] In one possible implementation, the processing module is specifically used for:
[0043] The first SIO logical port is determined based on the target link identifier corresponding to the first transmission path;
[0044] The feedback data is received from the application layer through the first SIO logical port, stored in the second buffer corresponding to the first SIO logical port, and then sent through the first SIO logical port.
[0045] In one possible implementation, the processing module is specifically used for:
[0046] A second message is sent to the driver layer through the first SIO logical port. The second message is used to indicate that the first physical port enters the interrupt enable state.
[0047] The driver layer determines the first SIO physical port and the first SIO logical port based on the first physical port;
[0048] The feedback data stored in the second buffer corresponding to the first SIO logical port is read into the driver layer through the first SIO physical port;
[0049] The feedback data is sent through the driver layer.
[0050] In one possible implementation, the processing module is further configured to:
[0051] The third message is received through the driver layer;
[0052] According to the third message, the first physical port is determined among the at least two physical ports, and the first transmission path corresponding to the first physical port includes two working modes.
[0053] Based on the third message, the target operating mode is determined from the two operating modes of the first transmission path;
[0054] Set the operating mode of the first transmission path to the target operating mode.
[0055] In one possible implementation, the processing module is further configured to:
[0056] The at least two physical ports are respectively bound to at least two SIO physical ports in the SIO layer, the at least two SIO physical ports are mapped to at least two SIO logical ports in the SIO layer, and the at least two SIO logical ports are bound to at least two link identifiers to obtain the at least two transmission paths.
[0057] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor;
[0058] Memory is used to store instructions that the computer executes;
[0059] The processor executes computer execution instructions stored in memory, causing the processor to perform the communication method as described in the first aspect.
[0060] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the communication method of any of the first aspects.
[0061] Fifthly, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, can implement the communication method of any of the first aspects.
[0062] This application provides a communication method, apparatus, device, and storage medium. The method is applied to an electronic device with a multi-path system. The multi-path system includes a driver layer, a serial input / output (SIO) layer, and an application layer. At least two transmission paths are provided between the driver layer and the SIO layer. The method includes: receiving first data through a first physical port on the driver layer, wherein the driver layer has at least two physical ports, including the first physical port; determining a first transmission path corresponding to the first physical port among the at least two transmission paths; transmitting the first data to the application layer through the first transmission path; and receiving feedback data corresponding to the first data from the application layer through the first transmission path. By providing at least two transmission paths in the multi-path system, the electronic device with the multi-path system can communicate with other devices through at least two transmission paths. Attached Figure Description
[0063] Figure 1 A schematic diagram of the architecture of a multipath system for the SIO module of an RTOS platform provided in an embodiment of this application;
[0064] Figure 2 A schematic diagram illustrating the mapping relationship between ports in multiple transmission paths provided in the embodiments of this application;
[0065] Figure 3 A schematic diagram illustrating the mapping relationship between each port and link identifier in multiple transmission paths provided in this application embodiment;
[0066] Figure 4 A flowchart illustrating a communication method provided in an embodiment of this application;
[0067] Figure 5 A flowchart illustrating another communication method provided in an embodiment of this application;
[0068] Figure 6 A schematic diagram illustrating the data reception process in ATC working mode, provided as an embodiment of this application;
[0069] Figure 7 A schematic diagram illustrating a data reception process in DATE working mode, provided as an embodiment of this application;
[0070] Figure 8 A flowchart illustrating another communication method provided in an embodiment of this application;
[0071] Figure 9 A schematic diagram illustrating a data transmission process in ATC working mode, provided for an embodiment of this application;
[0072] Figure 10 A schematic diagram illustrating a data transmission process in DATE working mode, provided as an embodiment of this application;
[0073] Figure 11 This is a schematic diagram of the structure of a communication device provided in an embodiment of this application;
[0074] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0075] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the embodiments of this application. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0076] In the embodiments of this application, "at least two" means two or more.
[0077] The terms "first," "second," etc., appearing in the embodiments of this application are for illustrative purposes and to distinguish the objects being described. They do not indicate any order and do not imply a specific limitation on the number of devices in the embodiments of this application, nor do they constitute any limitation on the embodiments of this application. For example, "first data" and "second data" are only used to distinguish different data, and do not indicate any difference in the size, priority, or importance of these two data.
[0078] In this application, terms such as "exemplary," "in some embodiments," and "in other embodiments" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Rather, the term "exemplary" is used to present the concept in a specific manner.
[0079] The electronic device in this application embodiment may refer to a chip module using an RTOS platform or a terminal device using an RTOS platform.
[0080] The application scenarios of this application embodiment can refer to multi-channel communication scenarios between various electronic devices, or multi-channel communication scenarios between electronic devices and a host computer. For example, a multi-channel communication scenario can refer to simultaneously serving a PPP dial-up Internet access scenario and an AT command control scenario.
[0081] Existing RTOS platforms only support single-channel communication and a single communication scenario, lacking path multiplexing capabilities and failing to meet the requirements of IoT modules. Current multi-channel communication solutions involve reconstructing the entire Serial Input / Output (SIO) module of the RTOS platform, abstracting all underlying serial physical ports, and providing a unified virtual port to the application. The virtual port abstracted by SIO is fixed to the application, while internally, it automatically matches various physical ports based on configuration and completes data transfer between virtual and physical ports. This reconstruction process involves not only communication paths but also calibration and log channels, resulting in a massive workload for implementation. Furthermore, due to the involvement of multiple modules, debugging and testing this solution is difficult, and it lacks portability across different RTOS platforms.
[0082] To address the aforementioned technical problems, this application provides a multi-channel communication method suitable for RTOS platforms. By setting at least two transmission paths in a multi-channel system, an electronic device equipped with the multi-channel system can communicate with other devices through at least two transmission paths.
[0083] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0084] Figure 1 This is a schematic diagram of the architecture of a multi-path system for the SIO module of an RTOS platform provided in this embodiment of the application. Please refer to [link / reference]. Figure 1 The system includes a driver layer, an SIO layer, and an application layer.
[0085] The application layer includes an Attention Command (ATC) module and a PPP module. It should be noted that other application modules can also be included in the application layer; this embodiment does not limit the number of application modules in the application layer.
[0086] The SIO layer is configured with at least two SIO logical ports and at least two SIO physical ports. For example, the SIO layer can be configured with four SIO logical ports and four SIO physical ports.
[0087] The driver layer has at least two physical ports. For example, the driver layer can have four physical ports.
[0088] The SIO layer acts as an intermediate layer, encapsulating the underlying physical ports and mapping them to SIO physical ports. These SIO physical ports are then mapped to SIO logical ports, forming a transmission path between the driver layer and the SIO layer. At least two transmission paths are established between the driver layer and the SIO layer.
[0089] In one possible implementation, the transmission path in a multipath system can be established in the following way:
[0090] Bind at least two physical ports to at least two SIO physical ports in the SIO layer, map at least two SIO physical ports to at least two SIO logical ports in the SIO layer, and bind at least two SIO logical ports to at least two link identifiers to obtain at least two transmission paths.
[0091] For example, if the SIO logical ports are COM_DATA, COM_DATA2, COM_AT1, and COM_AT2, the SIO physical ports are VIR_COM0, VIR_COM7, VIR_COM8, and COM0, and the physical ports are USB_COM0, USB_COM4, USB_COM5, and UART_COM0, then the port mapping relationship in the transmission path is as follows: Figure 2 As shown.
[0092] Transmission path 1, transmission path 3 and transmission path 4 are used as Universal Communication (UCOM) AT, and transmission path 2 is used as Universal Asynchronous Receiver / Transmitter (UART) AT.
[0093] After the SIO logical port is bound to the physical port of the driver layer, it is also necessary to establish an association between the SIO logical port and the Link Identity Document (LinkID). The upper-layer application can access the SIO logical port through the Link Identity Document (LinkID) associated with the SIO logical port, and then translate the access to the SIO logical port into access to the bound physical port.
[0094] For example, the link identifiers corresponding to the four transmission paths are: LinkID1 (or ATC_DEBUG_LINK), LinkID2 (or ATC_DEBUG2_LINK), LinkID3 (or ATC_DEBUG3_LINK), and LinkID4 (or ATC_DEBUG4_LINK). The association between the four transmission paths and the link identifiers is as follows: Figure 3 As shown.
[0095] Each port in the transmission path can establish a mapping and binding relationship through the port creation function SIO_Create. At the same time as establishing the mapping and binding relationship, the working mode, terminator, echo, receive buffer and send buffer of the path will be set.
[0096] In order for the AT port to be reused as a modem port for PPP dial-up Internet access, the AT channel needs to support both the DATE and ATC working modes. That is, in the ATC working mode, the ATC module receives and sends data, while in the DATE working mode, the data packet is transmitted for PPP dial-up Internet access.
[0097] At least two transmission paths can operate simultaneously in different working modes to serve different communication scenarios.
[0098] Compared with the architecture of SIO modules in related technologies, the architecture of the multi-path system of SIO modules provided in this application embodiment only adds corresponding SIO logical ports and SIO physical ports to the ATC module in the application layer in the SIO layer, and adds corresponding physical ports in the driver layer. That is, only the AT port is modified, without affecting other ports.
[0099] In this embodiment, at least two transmission paths in the multi-path system of the SIO module are applicable not only to the ATC module but also to the PPP module.
[0100] Based on the multi-path system architecture described above, the following details how each transmission path communicates.
[0101] Figure 4 This is a flowchart illustrating a communication method provided in an embodiment of this application. Please refer to [link / reference]. Figure 4 The method includes:
[0102] S401, Receive first data through the first physical port on the driver layer.
[0103] The driver layer has at least two physical ports, including the first physical port.
[0104] The first data may include the identifier of the first physical port.
[0105] The first data can be a data packet.
[0106] Multiple caches can be configured on the driver layer.
[0107] In one possible implementation, two buffers can be set up for each physical port at the driver layer: a receive buffer and a send buffer. The receive buffer is used to store data received from other devices (such as a host computer), and the send buffer is used to store data received from the application layer.
[0108] After receiving the first data, the first physical port on the driver layer can place the first data in the receive buffer corresponding to the first physical port.
[0109] Before using the first physical port to receive the first data, it is necessary to determine the first physical port among at least two physical ports, and to determine the working mode of the first transmission path corresponding to the first physical port.
[0110] In one possible implementation, the first physical port and the operating mode of the first transmission path corresponding to the first physical port can be determined by the following method:
[0111] The driver layer receives a third message; based on the third message, a first physical port is determined from at least two physical ports, and the first transmission path corresponding to the first physical port includes two working modes; based on the third message, a target working mode is determined from the two working modes of the first transmission path; and the working mode of the first transmission path is set to the target working mode.
[0112] For example, the third message can be an AT command, which may carry the identifier of the first physical port.
[0113] In one possible implementation, the third message can indicate the operating mode of the transmission path corresponding to the first physical port.
[0114] The two working modes can refer to ATC working mode and DATE working mode.
[0115] The method in this application embodiment can first determine the operating modes of the physical port and the first transmission path. After determining the operating modes of the first physical port and the first transmission path, data can be transmitted through the first physical port and the target operating mode. When all data transmission is completed, the target operating mode can be exited and the first physical port can be released. When it is only necessary to change the operating mode of the first transmission path, the current operating mode can be exited first, and then another operating mode can be switched.
[0116] S402. Determine the first transmission path corresponding to the first physical port among at least two transmission paths.
[0117] The transmission path whose physical port identifier is the same as that of the first physical port in at least two transmission paths is identified as the first transmission path.
[0118] S403. Transmit first data to the application layer through the first transmission path, and receive feedback data corresponding to the first data from the application layer through the first transmission path.
[0119] exist Figure 4 In the illustrated embodiment, first data is received through a first physical port on the driver layer. The driver layer has at least two physical ports, including the first physical port. A first transmission path corresponding to the first physical port is determined among at least two transmission paths. The first data is transmitted to the application layer through the first transmission path, and feedback data corresponding to the first data is received from the application layer through the first transmission path. By setting at least two transmission paths in the multi-path system, the electronic device equipped with the multi-path system can communicate with other devices through at least two transmission paths.
[0120] exist Figure 4 Based on the illustrated embodiment, the following details how to receive data through the first transmission path.
[0121] Figure 5 This is a flowchart illustrating another communication method provided in an embodiment of this application. Please refer to... Figure 5 The method includes:
[0122] S501, Receive first data through the first physical port on the driver layer.
[0123] It should be noted that the execution process of S501 can be found in the execution process of S401, and will not be repeated here.
[0124] S502. Determine the first transmission path corresponding to the first physical port among at least two transmission paths.
[0125] It should be noted that the execution process of S502 can be found in the execution process of S402, and will not be repeated here.
[0126] S503. Determine the first SIO logic port corresponding to the first transmission path among at least two SIO logic ports.
[0127] The driver layer can call back the SIO_DataPortHdl interrupt function in the SIO layer, pass in the parameters of the first transmission path, and determine the first SIO logical port corresponding to the first transmission path from at least two SIO logical ports based on the parameters of the first transmission path.
[0128] S504. Transmit the first data to the application layer through the first SIO logical port.
[0129] In one possible implementation, the first data can be transmitted to the application layer in the following way:
[0130] Determine the first SIO physical port corresponding to the first transmission path among at least two SIO physical ports; receive the first data transmitted from the first physical port through the first SIO physical port, store it in the first buffer corresponding to the first SIO logical port, and send a first message to the application layer. The first message includes a target link identifier, which is the link identifier corresponding to the first transmission path; determine the first SIO logical port according to the target link identifier through the application layer, and read the first data from the first buffer corresponding to the first SIO logical port.
[0131] The driver layer can call back the data port interrupt handling function (SIO_DataPortHdl) in the SIO layer, pass in the parameters of the first transmission path, and determine the first SIO physical port corresponding to the first transmission path from at least two SIO physical ports based on the parameters of the first transmission path.
[0132] In one possible implementation, two buffers can be set up for each SIO logical port on the SIO layer: a receive buffer and a send buffer. The receive buffer is used to store data received from the driver layer, and the send buffer is used to store data received from the application layer.
[0133] The first buffer can be the receive buffer, which can also be called the receive buffer.
[0134] In one possible implementation, when the upper-layer application receives data through the SIO layer, the driver layer sends the data to the first buffer of the SIO layer and returns without waiting for the application layer to read the data from the first buffer. Each time the driver layer fills the first buffer of the SIO layer with data, it sends a data reception event, marking the completion of receiving one frame of data. When the application layer reads data, it waits for the data reception event; when the application layer detects the data reception event, it directly reads the data from the first buffer of the SIO layer.
[0135] To facilitate understanding, the data reception process under the two working modes will be illustrated with two specific examples below.
[0136] Example 1: Data reception in ATC working mode
[0137] like Figure 6As shown, after the driver layer receives data from the host computer through the first physical port, it stores it in the receive buffer (RX FIFO) corresponding to the first physical port and calls back the data port interrupt handling function (SIO_DataPortHdl) in the SIO layer, passing in the parameters of the first transmission path (i.e., the identifier of the first physical port, etc.). Based on the parameters of the first transmission path, the driver layer determines the first SIO physical port and the first SIO logical port. Then, based on the read event, the driver layer calls the receive function (SIO_RxForUserPort) in the SIO layer to store the data in the first buffer of the first SIO logical port and calls back the ATC callback function (DO_ATC_CALLBACK) in the SIO layer, passing in the target link identifier corresponding to the first physical port. Based on the target link identifier, the driver layer determines the first SIO logical port and notifies the ATC module in the application layer to read the data through the ATC read command (SIO_ATC_ReadCmdLine) interface provided by the SIO layer.
[0138] Example 2: Data reception in DATE working mode
[0139] like Figure 7 As shown, after the driver layer receives data from the host computer through the first physical port, it stores it in the receive buffer (RX FIFO) corresponding to the first physical port and calls back the data port interrupt handling function (SIO_DataPortHdl) in the SIO layer, passing in the parameters of the first transmission path (i.e., the identifier of the first physical port, etc.). Based on the parameters of the first transmission path, the driver layer determines the first SIO physical port and the first SIO logical port. Then, based on the read event, the driver layer calls the receive function (SIO_RxForUserPort) in the SIO layer to store the data in the first buffer of the first SIO logical port and sends a signal to notify the PPP read (ppp_read) thread in the SIO layer. The ppp_read thread reads the data by calling the PPP get character (SIO_PPP_GetChar) interface in the application layer.
[0140] After receiving the first data, the application layer needs to process it and then send the corresponding feedback data outward. The first data and the feedback data may or may not be related.
[0141] Below, in conjunction with Figure 8 The process of sending data through the first transmission path is described in detail.
[0142] Figure 8 This is a flowchart illustrating another communication method provided in an embodiment of this application. Please refer to... Figure 8 The method includes:
[0143] S801, determine the feedback data through the application layer.
[0144] Feedback data can be the data corresponding to the first data, or it can be some status information generated by the application layer. This status information can be information that the application layer needs to actively report.
[0145] S802. Determine the first SIO logical port based on the target link identifier corresponding to the first transmission path.
[0146] The first transmission path can refer to the transmission path for receiving the first data, or it can be the default transmission path used for active reporting.
[0147] In one possible implementation, the ATC module in the application layer sends the feedback data to be sent through the ATC write command (SIO_ATC_WriteCmdRes) interface. When calling the SIO_ATC_WriteCmdRes interface, the target link identifier is passed in to determine the first SIO logical port.
[0148] S803: Receive feedback data from the application layer through the first SIO logical port, store it in the second buffer corresponding to the first SIO logical port, and send the feedback data through the first SIO logical port.
[0149] In one possible implementation, feedback data can be sent via the first SIO logical port in the following way:
[0150] The driver layer sends a second message to the driver layer through the first SIO logical port. The second message is used to indicate that the first physical port enters the interrupt enabled state. The driver layer determines the first SIO physical port and the first SIO logical port based on the first physical port. The driver layer reads the feedback data stored in the second buffer corresponding to the first SIO logical port through the first SIO physical port and sends the feedback data through the driver layer.
[0151] The second buffer can be a send buffer, also known as a send buffer.
[0152] In one possible implementation, when the upper-layer application sends data through the SIO layer, the application layer uses the interface provided by SIO to transmit the data to the second buffer of the SIO layer and then returns. After the SIO layer sends the data into the second transmission buffer, it enables the interrupt of the corresponding port. Then, the SIO layer fills the transmission buffer (TX FIFO) of the driver layer with data. The process of the SIO layer filling the transmission buffer with data can be automatically loaded in a loop by the interrupt callback function.
[0153] To facilitate understanding, the data transmission process under the two working modes will be illustrated with two specific examples below.
[0154] Example 3: Data transmission in ATC working mode
[0155] like Figure 9 As shown, the ATC module sends the data to be sent through the ATC write command (SIO_ATC_WriteCmdRes) interface. When the SIO_ATC_WriteCmdRes interface is called, the link identifier corresponding to the first physical port is passed in, which is internally converted into the corresponding first SIO logical port. The storage function (uart_ppp_putc) in the SIO layer stores the data into the second buffer of the first SIO logical port. The end-point setting function (uart_mix_set_end_point) puts the end-point symbol into the second buffer of the first SIO logical port. After the transmit interrupt enable function (SIO_Tx_Int_Enable) in the SIO layer enables the port interrupt, the driver layer will call back the data port interrupt handling function (SIO_DataPortHdl), passing in the parameters of the first physical port. Internally, it is converted into the first SIO physical port and the first SIO logical port, and then the transmit function (SIO_TxForUserPort) is called according to the write event to store the data into the transmit buffer of the driver layer. Finally, the driver layer sends the data to the host computer.
[0156] Example 4: Data transmission in DATE working mode
[0157] like Figure 10 As shown, the PPP module sends the data to be sent through the PPP output string (SIO_PPP_PutString) interface. When the SIO_PPP_PutString interface is called, the link identifier corresponding to the first physical port is passed in, which is internally converted into the corresponding first SIO logical port. The storage function (uart_ppp_putc) in the SIO layer stores the data into the second buffer of the first SIO logical port. The end-point setting function (uart_mix_set_end_point) puts the end-point symbol into the second buffer of the first SIO logical port. After the transmit interrupt enable function (SIO_Tx_Int_Enable) in the SIO layer enables the port interrupt, the driver layer will call back the data port interrupt handling function (SIO_DataPortHdl), passing in the parameters of the first physical port. Internally, it is converted into the first SIO physical port and the first SIO logical port, and then the transmit function (SIO_TxForUserPort) is called according to the write event to store the data into the transmit buffer of the driver layer. Finally, the driver layer sends the data to the host computer.
[0158] Figure 11This is a schematic diagram of a communication device provided in an embodiment of this application. The communication device is applied in an electronic device, which has a multi-path system. The multi-path system includes a driver layer, a SIO layer, and an application layer. At least two transmission paths are provided between the driver layer and the SIO layer. Please refer to... Figure 11 The communication device 10 includes a communication module 11 and a processing module 12, wherein,
[0159] Communication module 11 is used to receive first data through a first physical port on the driver layer. The driver layer is provided with at least two physical ports, including the first physical port.
[0160] The processing module 12 is used to determine the first transmission path corresponding to the first physical port among at least two transmission paths; transmit first data to the application layer through the first transmission path; and receive feedback data corresponding to the first data from the application layer through the first transmission path.
[0161] In one possible implementation, at least two SIO logical ports are provided on the SIO layer; the processing module 12 is specifically used for:
[0162] Determine the first SIO logic port corresponding to the first transmission path from at least two SIO logic ports;
[0163] The first data is transmitted to the application layer through the first SIO logical port.
[0164] In one possible implementation, at least two SIO physical ports are provided on the SIO layer; the processing module 12 is specifically used for:
[0165] Determine the first SIO physical port corresponding to the first transmission path from at least two SIO physical ports;
[0166] The system receives first data transmitted from the first physical port through the first SIO physical port, stores it in the first buffer corresponding to the first SIO logical port, and sends a first message to the application layer. The first message includes a target link identifier, which is the link identifier corresponding to the first transmission path.
[0167] The application layer determines the first SIO logical port based on the target link identifier and reads the first data from the first cache corresponding to the first SIO logical port.
[0168] In one possible implementation, the processing module 12 is specifically used for:
[0169] The first SIO logical port is determined based on the target link identifier corresponding to the first transmission path;
[0170] Feedback data is received from the application layer through the first SIO logical port, stored in the second buffer corresponding to the first SIO logical port, and then sent through the first SIO logical port.
[0171] In one possible implementation, the processing module 12 is specifically used for:
[0172] The second message is sent to the driver layer through the first SIO logic port. The second message is used to indicate that the first physical port enters the interrupt enable state.
[0173] The driver layer determines the first SIO physical port and the first SIO logical port based on the first physical port;
[0174] The feedback data stored in the second buffer corresponding to the first SIO logical port is read to the driver layer through the first SIO physical port;
[0175] Feedback data is sent through the driver layer.
[0176] In one possible implementation, the processing module 12 is further configured to:
[0177] Receive third messages through the driver layer;
[0178] According to the third message, the first physical port is determined among at least two physical ports, and the first transmission path corresponding to the first physical port includes two working modes;
[0179] Based on the third message, the target operating mode is determined from the two operating modes of the first transmission path;
[0180] Set the operating mode of the first transmission path to the target operating mode.
[0181] In one possible implementation, the processing module 12 is further configured to:
[0182] Bind at least two physical ports to at least two SIO physical ports in the SIO layer, map at least two SIO physical ports to at least two SIO logical ports in the SIO layer, and bind at least two SIO logical ports to at least two link identifiers to obtain at least two transmission paths.
[0183] The communication device 10 provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0184] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Please refer to... Figure 12The electronic device 20 may include a transceiver 21, a memory 22, and a processor 23. The transceiver 21 may include a transmitter and / or a receiver. The transmitter may also be referred to as a transmitter, transmitter port, or transmitter interface, etc., and the receiver may also be referred to as a receiver, receiver port, or receiver interface, etc. Exemplarily, the transceiver 21, memory 22, and processor 23 are interconnected via a bus 24.
[0185] Memory 22 is used to store program instructions;
[0186] The processor 23 is used to execute the program instructions stored in the memory so that the electronic device 20 performs any of the communication methods shown above.
[0187] The transceiver 21 is used to perform the transmission and reception functions of the electronic device 20.
[0188] Figure 12 The electronic device shown in the embodiments can execute the technical solutions shown in the above method embodiments. Its implementation principle and beneficial effects are similar, and will not be repeated here.
[0189] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement any of the above-mentioned communication methods.
[0190] This application provides a computer program product, including a computer program that, when executed by a processor, can implement any of the above-described communication methods.
[0191] Other embodiments of this application 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 application that follow the general principles of this application 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 application are indicated by the following claims.
[0192] It should be understood that this application is not limited to the precise structure 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 application is limited only by the appended claims.
Claims
1. A communication method, characterized in that, The method is applied in an electronic device, wherein the electronic device is provided with a multi-path system, the multi-path system including a driver layer, a serial input / output (SIO) layer, and an application layer, and at least two transmission paths are provided between the driver layer and the SIO layer, the method comprising: The driver layer is provided with at least two physical ports, which are respectively bound to at least two SIO physical ports in the SIO layer, mapped to at least two SIO logical ports in the SIO layer, and bound to at least two link identifiers to obtain the at least two transmission paths. The at least two physical ports include a first physical port, through which first data is received; Determine the first transmission path corresponding to the first physical port among the at least two transmission paths; The first data is transmitted to the application layer through the first transmission path, and feedback data corresponding to the first data is received from the application layer through the first transmission path.
2. The method according to claim 1, characterized in that, Transmitting first data to the application layer through the first transmission path includes: Determine the first SIO logic port corresponding to the first transmission path from the at least two SIO logic ports; The first data is transmitted to the application layer through the first SIO logical port.
3. The method according to claim 2, characterized in that, Transmitting the first data to the application layer through the first SIO logical port includes: Determine the first SIO physical port corresponding to the first transmission path from the at least two SIO physical ports; The system receives the first data transmitted from the first physical port through the first SIO physical port, stores it in the first buffer corresponding to the first SIO logical port, and sends a first message to the application layer. The first message includes a target link identifier, which is the link identifier corresponding to the first transmission path. The application layer determines the first SIO logical port based on the target link identifier and reads the first data from the first cache corresponding to the first SIO logical port.
4. The method according to claim 1, characterized in that, Receiving feedback data corresponding to the first data from the application layer through the first transmission path includes: The first SIO logical port is determined based on the target link identifier corresponding to the first transmission path; The feedback data is received from the application layer through the first SIO logical port, stored in the second buffer corresponding to the first SIO logical port, and then sent through the first SIO logical port.
5. The method according to claim 4, characterized in that, Sending the feedback data through the first SIO logic port includes: A second message is sent to the driver layer through the first SIO logical port. The second message is used to indicate that the first physical port enters the interrupt enable state. The driver layer determines the first SIO physical port and the first SIO logical port based on the first physical port; The feedback data stored in the second buffer corresponding to the first SIO logical port is read into the driver layer through the first SIO physical port; The feedback data is sent through the driver layer.
6. The method according to any one of claims 1-5, characterized in that, Before receiving the first data through the first physical port on the driver layer, the method further includes: The third message is received through the driver layer; According to the third message, the first physical port is determined among the at least two physical ports, and the first transmission path corresponding to the first physical port includes two working modes. Based on the third message, the target operating mode is determined from the two operating modes of the first transmission path; Set the operating mode of the first transmission path to the target operating mode.
7. A communication device, characterized in that, The device is applied in an electronic device, which has a multi-path system. The multi-path system includes a driver layer, a serial input / output (SIO) layer, and an application layer. At least two transmission paths are provided between the driver layer and the SIO layer. The driver layer has at least two physical ports, including a first physical port. The device includes: The processing module is used to bind the at least two physical ports to at least two SIO physical ports in the SIO layer, map the at least two SIO physical ports to at least two SIO logical ports in the SIO layer, and bind the at least two SIO logical ports to at least two link identifiers to obtain the at least two transmission paths. The communication module is used to receive first data through the first physical port; The processing module is further configured to determine, among the at least two transmission paths, the first transmission path corresponding to the first physical port; transmit the first data to the application layer through the first transmission path; and receive feedback data corresponding to the first data from the application layer through the first transmission path.
8. An electronic device, characterized in that, include: Memory, processor; The memory is used to store computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the communication method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the communication method according to any one of claims 1-6.
Citation Information
Patent Citations
Network transmission method and device, storage medium and electronic equipment
CN112383472A
Ink-jet printer data processing method, device thereof, equipment , and storage medium
CN113176866A