Data packet transmission method and apparatus, terminal device

By introducing a hardware accelerator in the smartphone to parse and encapsulate the network data packets of the USB controller, the performance degradation and increased power consumption caused by USB interruptions are solved, and the communication efficiency and user experience are improved.

CN118574109BActive Publication Date: 2025-10-17XIAMEN UNISOC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410740899.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2025-10-17
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

In the prior art, when a smartphone communicates with a PC via a USB line, frequent USB interruptions cause the main controller's performance to degrade and power consumption to increase, affecting the communication rate and user experience.

Method used

A hardware accelerator is used to parse and encapsulate network data packets received by the USB controller and transmit them through the wireless communication module, reducing or eliminating USB receive interrupts and avoiding context switching of the main controller.

Benefits of technology

By reducing USB receive interrupts, the host controller performance is improved and power consumption is reduced, improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118574109B_ABST
    Figure CN118574109B_ABST
Patent Text Reader

Abstract

The application discloses a data packet transmission method and device and a terminal device. The terminal device comprises a main controller, a hardware accelerator, a USB controller and a wireless communication module. The data packet transmission method applied to the main controller in the terminal device comprises the following steps: in response to the connection with an external device through a USB interface, a first starting instruction is sent to the hardware accelerator; the first starting instruction is used for instructing the hardware accelerator to analyze and package the network data packet received by the USB controller and to transmit the packaged network data packet through the wireless communication module. The network data packet sent by the external device is received through the USB controller, and the network data packet is processed by the hardware accelerator. The communication link will no longer trigger the USB receiving interrupt, the influence of a large number of USB receiving interrupts on the performance and power consumption of the main controller can be eliminated, and the experience of the user using the terminal device is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, in particular to a data packet transmission method and device and a terminal device. BACKGROUND

[0002] Currently, a smart phone has the function of providing a PC (Personal Computer) with access to the Internet through a USB line, and the connection and communication mode between devices is as shown in the figure. The smart phone connects with the operator base station through wireless communication technology (such as 5G, 4G, etc.) to access the Internet, and at the same time the smart phone can share the access to the Internet capability with the PC and other devices that do not have the access to the Internet capability through the USB line, so that the PC and other devices have the access to the Internet capability. Among them, the smart phone acts as a bridge to build the interaction between the PC and the operator base station, and the smart phone obtains network data packets from the operator base station through wireless communication technology, and then transmits them to the PC through the USB line; similarly, the smart phone obtains network data packets from the PC through the USB line, and then transmits them to the operator base station through wireless communication technology. In the process of network data packet uplink and downlink, data format conversion and physical communication mode change are involved. Figure 1 As shown in the figure, the network data packet communication link is usually composed of a wireless communication module, a main controller (such as a CPU) and a USB controller inside the chip 10. Among them, the main controller acts as an intermediate bridge between the wireless communication module and the USB controller, and is responsible for the analysis, re-encapsulation and flow of network data packets. When the smart phone enables the USB function, it will register the USB receive interrupt in the kernel (kernel) and wait for the USB receive interrupt to be triggered, and register the USB send interrupt and wait for data sending (send idle). In the interaction process with the PC, the smart phone will generate USB receive interrupt and USB send interrupt, specifically, USB receive interrupt is generated when the PC sends data to the Internet, and USB send interrupt is generated when the PC receives Internet data, each interrupt will cause the kernel to trigger context switching, stop the task being executed and switch to USB receive interrupt or USB send interrupt to execute the task, forming CPU resource consumption. In the process of network communication with small bandwidth, the frequency of interrupt triggering is not high, the number of interrupts is small, and its impact on CPU performance is small. But with the rapid growth of communication bandwidth, large bandwidth network communication leads to frequent USB interrupts, and a large number of USB interrupts will seriously affect the CPU performance, thereby affecting the communication performance, making the communication rate much lower than the peak value, and at the same time it will cause the CPU power consumption to rise, leading to serious heating of the smart phone and decrease of the endurance time, affecting the user experience.

[0003] Figure 2 As shown in the figure, the network data packet communication link is usually composed of a wireless communication module, a main controller (such as a CPU) and a USB controller inside the chip 10. Among them, the main controller acts as an intermediate bridge between the wireless communication module and the USB controller, and is responsible for the analysis, re-encapsulation and flow of network data packets. When the smart phone enables the USB function, it will register the USB receive interrupt in the kernel (kernel) and wait for the USB receive interrupt to be triggered, and register the USB send interrupt and wait for data sending (send idle). In the interaction process with the PC, the smart phone will generate USB receive interrupt and USB send interrupt, specifically, USB receive interrupt is generated when the PC sends data to the Internet, and USB send interrupt is generated when the PC receives Internet data, each interrupt will cause the kernel to trigger context switching, stop the task being executed and switch to USB receive interrupt or USB send interrupt to execute the task, forming CPU resource consumption. In the process of network communication with small bandwidth, the frequency of interrupt triggering is not high, the number of interrupts is small, and its impact on CPU performance is small. But with the rapid growth of communication bandwidth, large bandwidth network communication leads to frequent USB interrupts, and a large number of USB interrupts will seriously affect the CPU performance, thereby affecting the communication performance, making the communication rate much lower than the peak value, and at the same time it will cause the CPU power consumption to rise, leading to serious heating of the smart phone and decrease of the endurance time, affecting the user experience. SUMMARY

[0004] ​The technical problem solved by the present application is to overcome the defects in the prior art that a large number of USB interrupts affect the performance and power consumption of the host controller, and to provide a data packet transmission method and device and a terminal device.

[0005] The present application solves the above technical problems by the following technical solutions:

[0006] The first aspect of the present application provides a data packet transmission method applied to a host controller in a terminal device, wherein the terminal device further comprises a hardware accelerator, a USB controller and a wireless communication module, and the data packet transmission method comprises the following steps:

[0007] In response to connecting with an external device through a USB interface, a first start instruction is sent to the hardware accelerator; wherein the first start instruction is used to instruct the hardware accelerator to parse and package network data packets received by the USB controller, and to transmit the packaged network data packets through the wireless communication module.

[0008] Optionally, the hardware accelerator comprises a register module, a storage module and a state machine, and before the first start instruction is sent to the hardware accelerator, the following steps are further included:

[0009] The register module is configured according to the USB controller;

[0010] An instruction set set according to the USB controller is loaded into the storage module; wherein the state machine is used to execute instructions in the instruction set.

[0011] Optionally, the data packet transmission method comprises the following steps: in response to connecting with an external device through a USB interface, a second start instruction is sent to the USB controller; wherein the second start instruction is used to instruct the USB controller to allow being identified by the external device.

[0012] Optionally, before the second start instruction is sent by the USB controller, the following steps are further included:

[0013] The USB controller is initialized;

[0014] A port in the USB controller used for communication with the hardware accelerator is configured.

[0015] Optionally, the data packet transmission method further comprises the following steps: in response to disconnection between the terminal device and the external device, a first stop instruction is sent to the hardware accelerator; wherein the first stop instruction is used to instruct the hardware accelerator to stop running.

[0016] Optionally, the data packet transmission method further comprises the following steps: in response to disconnection with the external device, sending a first cleaning instruction to the hardware accelerator; wherein the first cleaning instruction is used to instruct cleaning of the register module and data in the memory.

[0017] Optionally, the data packet transmission method further comprises the following steps: in response to disconnection with the external device, sending a second stop instruction to the USB controller; wherein the second stop instruction is used to instruct the USB controller to stop running.

[0018] Optionally, the data packet transmission method further comprises the following steps: in response to disconnection with the external device, sending a second cleaning instruction to the USB controller; wherein the second cleaning instruction is used to instruct cleaning of resources in the USB controller.

[0019] The second aspect of the present application provides a data packet transmission method applied to a hardware accelerator in a terminal device, wherein the terminal device further comprises a main controller, a USB controller and a wireless communication module, and the data packet transmission method comprises the following steps:

[0020] In response to a first start instruction sent by the main controller, detecting whether the USB controller receives a network data packet;

[0021] In response to detecting that the USB controller receives a network data packet, reading the network data packet from the USB controller;

[0022] Analyzing and packaging the network data packet;

[0023] Transmitting the packaged network data packet through the wireless communication module.

[0024] Optionally, the detection of whether the USB controller receives a network data packet specifically comprises:

[0025] If the data read from the target register of the USB controller is consistent with the locally pre-stored data, it is detected that the USB controller receives a network data packet, otherwise, it is detected that the USB controller does not receive a network data packet.

[0026] The third aspect of the present application provides a data packet transmission method applied to a terminal device, wherein the terminal device comprises a hardware accelerator, a main controller, a USB controller and a wireless communication module; the data packet transmission method comprises the following steps:

[0027] The main controller sends a first start instruction to the hardware accelerator in response to connection with an external device through a USB interface;

[0028] The hardware accelerator detects whether the USB controller receives a network data packet in response to the first start instruction, reads the network data packet from the USB controller in the case that the USB controller receives a network data packet, and parses and encapsulates the network data packet, and transmits the encapsulated network data packet through the wireless communication module.

[0029] The fourth aspect of the present application provides a data packet transmission device applied to a main controller in a terminal device, wherein the terminal device further comprises a hardware accelerator, a USB controller and a wireless communication module, and the data packet transmission device comprises:

[0030] A first start module is configured to send a first start instruction to the hardware accelerator in response to connecting with an external device through a USB interface, wherein the first start instruction is used to instruct the hardware accelerator to parse and encapsulate a network data packet received by the USB controller, and transmit the encapsulated network data packet through the wireless communication module.

[0031] Optionally, the hardware accelerator comprises a register module, a storage module and a state machine, and the data packet transmission device further comprises a first configuration module configured to configure the register module according to the USB controller before sending the first start instruction to the hardware accelerator, and load an instruction set set according to the USB controller into the storage module, wherein the state machine is used to execute instructions in the instruction set.

[0032] Optionally, the data packet transmission device further comprises a second start module configured to send a second start instruction to the USB controller in response to connecting with an external device through a USB interface, wherein the second start instruction is used to instruct the USB controller to be identified by the external device.

[0033] Optionally, the data packet transmission device further comprises a second configuration module configured to initialize the USB controller and configure a port in the USB controller used for communication with the hardware accelerator before the USB controller sends the second start instruction.

[0034] Optionally, the data packet transmission device further comprises a first stop module configured to send a first stop instruction to the hardware accelerator in response to disconnection between the terminal device and the external device, wherein the first stop instruction is used to instruct the hardware accelerator to stop running.

[0035] Optionally, the data packet transmission apparatus further comprises a first cleaning module configured to send a first cleaning instruction to the hardware accelerator in response to disconnection with the external device; wherein the first cleaning instruction is configured to instruct cleaning of the register module and data in the memory.

[0036] Optionally, the data packet transmission apparatus further comprises a second stopping module configured to send a second stopping instruction to the USB controller in response to disconnection with the external device; wherein the second stopping instruction is configured to instruct the USB controller to stop running.

[0037] Optionally, the data packet transmission apparatus further comprises a second cleaning module configured to send a second cleaning instruction to the USB controller in response to disconnection with the external device; wherein the second cleaning instruction is configured to instruct cleaning of resources in the USB controller.

[0038] A fifth aspect of the present application provides a data packet transmission apparatus applied to a hardware accelerator in a terminal device, wherein the terminal device further comprises a main controller, a USB controller and a wireless communication module, and the data packet transmission apparatus comprises:

[0039] a detection module configured to detect whether the USB controller receives a network data packet in response to a first starting instruction sent by the main controller;

[0040] a reading module configured to read the network data packet from the USB controller in response to detection that the USB controller receives the network data packet;

[0041] a processing module configured to parse and encapsulate the network data packet;

[0042] a transmission module configured to transmit the encapsulated network data packet through the wireless communication module.

[0043] Optionally, the detection module is specifically configured to detect that the USB controller receives the network data packet in a case where data read from a target register of the USB controller is consistent with locally pre-stored data, and otherwise, detect that the USB controller does not receive the network data packet.

[0044] A sixth aspect of the present application provides a data packet transmission apparatus comprising a hardware accelerator, a main controller, a USB controller and a wireless communication module:

[0045] the main controller is configured to send a first starting instruction to the hardware accelerator in response to connection with an external device through a USB interface;

[0046] The hardware accelerator is configured to detect whether the USB controller receives a network data packet in response to the first start instruction, read the network data packet from the USB controller if the USB controller receives the network data packet, and parse and package the network data packet, and transmit the packaged network data packet through the wireless communication module.

[0047] Optionally, the hardware accelerator comprises a register module, a storage module and a state machine, and the main controller is further configured to configure the register module according to the USB controller before sending the first start instruction to the hardware accelerator, and load an instruction set set according to the USB controller into the storage module; wherein the state machine is configured to execute instructions in the instruction set.

[0048] Optionally, the main controller is further configured to send a second start instruction to the USB controller in response to connecting with an external device through a USB interface; wherein the second start instruction is configured to instruct the USB controller to be recognized by the external device.

[0049] Optionally, the main controller is further configured to initialize the USB controller and configure a port in the USB controller for communication with the hardware accelerator before sending the second start instruction to the USB controller.

[0050] Optionally, the main controller is further configured to send a first stop instruction to the hardware accelerator in response to disconnection with the external device; wherein the first stop instruction is configured to instruct the hardware accelerator to stop running.

[0051] Optionally, the main controller is further configured to send a first cleaning instruction to the hardware accelerator in response to disconnection with the external device; wherein the first cleaning instruction is configured to instruct to clean data in the register module and the storage.

[0052] Optionally, the main controller is further configured to send a second stop instruction to the USB controller in response to disconnection with the external device; wherein the second stop instruction is configured to instruct the USB controller to stop running.

[0053] Optionally, the main controller is further configured to send a second cleaning instruction to the USB controller in response to disconnection with the external device; wherein the second cleaning instruction is configured to instruct to clean resources in the USB controller.

[0054] Optionally, the hardware accelerator is specifically configured to detect that the USB controller receives a network packet when data read from a target register of the USB controller is consistent with locally pre-stored data, and otherwise, detect that the USB controller does not receive a network packet.

[0055] A seventh aspect of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data packet transmission method according to the first aspect or the second aspect when executing the computer program.

[0056] An eighth aspect of the present application provides a chip applied to a terminal device, wherein the chip is configured to implement the data packet transmission method according to the first aspect or the second aspect.

[0057] A ninth aspect of the present application provides a chip module applied to a terminal device, comprising a chip, wherein the chip is configured to implement the data packet transmission method according to the first aspect or the second aspect.

[0058] A tenth aspect of the present application provides a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program is configured to implement the steps of the data packet transmission method according to the first aspect or the second aspect when executed by a processor.

[0059] An eleventh aspect of the present application provides a computer program product, comprising a computer program, wherein the computer program is configured to implement the steps of the data packet transmission method according to the first aspect or the second aspect when executed by a processor.

[0060] On the basis of common knowledge in the art, the optional conditions described above can be combined in any manner, thereby obtaining preferred embodiments of the present application.

[0061] The positive progress effect of the present application is that: the USB controller receives a network packet sent by an external device, and a hardware accelerator processes the network packet, so that the communication link no longer triggers a USB reception interrupt, and thus the host controller does not perform context switching, thereby eliminating the impact of a large number of USB reception interrupts on the performance and power consumption of the host controller, and improving the user experience of using the terminal device. BRIEF DESCRIPTION OF DRAWINGS

[0062] Figure 1 A schematic diagram of the connection and communication between a smart phone and a PC in the prior art.

[0063] Figure 2 A schematic diagram of the connection between a chip and an external device in the prior art.

[0064] Figure 3A connection diagram between a terminal device and an external device provided for an embodiment of the present application.

[0065] Figure 4 A structure diagram of a hardware accelerator provided for embodiment 1 of the present application.

[0066] Figure 5 A method flow chart after the terminal device is connected with the external device provided for embodiment 1 of the present application.

[0067] Figure 6 A method flow chart after the terminal device is disconnected with the external device provided for embodiment 1 of the present application.

[0068] Figure 7 A flow chart of a data packet transmission method provided for embodiment 2 of the present application.

[0069] Figure 8 A flow chart of a data packet transmission method provided for embodiment 3 of the present application.

[0070] Figure 9 A structure diagram of a terminal device provided for embodiment 4 of the present application. DETAILED DESCRIPTION

[0071] The present application will be further described by way of examples without limiting the present application to the examples described.

[0072] The terminal device in the embodiments of the present application can refer to various forms of user equipment (User Equipment, UE for short), access terminal, user unit, user station, mobile station (Mobile Station, MS for short), mobile terminal (Mobile Terminal, MT for short), remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent or user device. The terminal device can also be a cellular phone, a cordless phone, a Session Initiation Protocol (SIP for short) phone, a Wireless Local Loop (WLL for short) station, a Personal Digital Assistant (PDA for short), a handheld device with wireless communication function, a computer with wireless transceiver function, a Virtual Reality (VR for short) terminal device, an Augmented Reality (AR for short) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote surgery, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a computing device or other processing device connected to a wireless modem, a vehicle-mounted device, a wearable device, a terminal device in a 5G network, or a terminal device in a future evolved Public Land Mobile Network (PLMN for short) and the like. The embodiments of the present application do not limit this.

[0073] The data packet transmission method provided by the embodiments of the present application can realize USB function, also known as USB shared connection, allowing users to share the network of the terminal device to external devices through USB data line. The external device can be a PC, a notebook computer and the like. It should be noted that when the data packet transmission method provided by the embodiments of the present application realizes USB function, it is not necessary to register USB receiving interrupt and USB sending interrupt in the kernel.

[0074] The data packet transmission method provided by the embodiments of the present application can be executed by a data packet transmission device, which can be realized by software and / or hardware. The data packet transmission device can include part or all of the terminal device, and specifically can be a separate chip, a chip module or a terminal device, or a chip or a chip module integrated in the terminal device.

[0075] Regarding the various modules / units included in the data packet transmission device described in the embodiments of the present invention, they can be software modules / units, hardware modules / units, or partly software modules / units and partly hardware modules / units. For example, for various devices and products applied to or integrated into a chip, the various modules / units included therein can all be implemented in the form of hardware such as circuits, or at least some of the modules / units can be implemented in the form of software programs, which run on a processor integrated inside the chip, and the remaining modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated into a chip module, the various modules / units included therein can all be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component of the chip module (such as a chip, circuit module, etc.) or in different components, or at least some of the modules / units can be implemented in the form of hardware such as circuits. It can be implemented in the form of a software program, which runs on the processor integrated inside the chip module, and the remaining modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated in terminal equipment, the various modules / units contained therein can be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or different components in the terminal equipment, or, at least some modules / units can be implemented in the form of a software program, which runs on the processor integrated inside the terminal equipment, and the remaining modules / units can be implemented in the form of hardware such as circuits.

[0076] Example 1

[0077] The data packet transmission method provided in this embodiment can be executed by a data packet transmission device, which can be implemented in software and / or hardware, and can include part or all of the main controller in the terminal device. Figure 3 As shown, the terminal device 20 includes a main controller, a hardware accelerator, a USB controller and a wireless communication module, wherein the main controller is respectively connected to the hardware accelerator, the USB controller and the wireless communication module for communication, and the hardware accelerator is respectively connected to the USB controller and the wireless communication module for communication.

[0078] The following describes the data packet transmission method provided by this embodiment, taking the main controller in the terminal device as the execution body. The data packet transmission method provided by this embodiment may include the following steps S11:

[0079] Step S11: In response to connecting to an external device through a USB interface, sending a first startup instruction to the hardware accelerator; wherein the first startup instruction is used to instruct the hardware accelerator to parse and encapsulate the network data packets received by the USB controller, and transmit the encapsulated network data packets through the wireless communication module.

[0080] Specifically, the USB controller in the terminal device can establish a connection with the external device through the USB interface. In a specific implementation, the hardware accelerator can transmit the encapsulated network packet to the base station through the wireless communication module. The above-mentioned parsing operation can be a RNDIS (Remote Network Driver Interface Specification) protocol parsing, and the part about the RNDIS protocol in the network packet is removed. The above-mentioned encapsulation operation can be encapsulating the parsed network packet according to the wireless communication protocol (i.e., the protocol corresponding to the wireless communication module).

[0081] In this embodiment, the network packet sent by the external device is received through the USB controller, and the hardware accelerator processes the uplink network packet. The communication link no longer triggers the USB reception interrupt, so the host controller does not perform context switching, and the impact of a large number of USB reception interrupts on the performance and power consumption of the host controller can be eliminated, thereby improving the user experience of using the terminal device.

[0082] In an optional implementation, the first start instruction is further used to instruct the hardware accelerator to parse and encapsulate the network packet received by the wireless communication module, and to transmit the encapsulated network packet through the USB controller.

[0083] In a specific implementation, the hardware accelerator can transmit the encapsulated network packet to the external device through the USB controller. The above-mentioned parsing operation can be a wireless communication protocol (i.e., the protocol corresponding to the wireless communication module) parsing, and the part about the wireless communication protocol in the network packet is removed. The above-mentioned encapsulation operation can be encapsulating the parsed network packet according to the RNDIS protocol.

[0084] In this embodiment, the network packet sent by the base station is received through the wireless communication module, and the hardware accelerator processes the downlink network packet. The communication link no longer triggers the USB transmission interrupt, so the host controller does not perform context switching, and the impact of a large number of USB transmission interrupts on the performance and power consumption of the host controller can be eliminated, thereby improving the user experience of using the terminal device.

[0085] In an optional implementation, as shown in Figure 4 The hardware accelerator includes a register module, a storage module, and a state machine. In this embodiment, before the first start instruction is sent to the hardware accelerator in step S11, the following steps S101-S102 are further included:

[0086] In step S101, the USB controller is configured according to the register module.

[0087] In the implementation of step S101, the address of the register in the USB controller requiring hardware accelerator operation can be written into the register module, and the data address requiring hardware accelerator operation can also be written into the register module.

[0088] Step S102, loading the instruction set set according to the USB controller into the storage module; wherein the state machine is used to execute the instructions in the instruction set.

[0089] The register module includes a plurality of registers, each of which is used to store data information, which can specifically include the initialization configuration data information such as the address of the register in the USB controller, and can also include the temporary data information such as the return value of the register in the USB controller obtained by the state machine according to the instructions.

[0090] The storage module is a readable and writable memory area, which can specifically be a RAM (Random Access Memory), a Cache (Cache Memory), a Flash memory, etc.

[0091] In the implementation, different instruction sets are set according to different USB controllers, wherein the number of instructions in the instruction set, the execution order of the instructions, the execution content of the instructions, the length of the instructions, etc. can be flexibly set. The execution content of the instructions usually includes reading, writing, data saving, data comparison, etc. In one specific example, the length of each register is 64 bits, and the length of each instruction is fixed to 8 bytes.

[0092] Taking the USB controller as a DWC3 controller (a USB 3.x controller) as an example, an instruction set including the following instructions is set:

[0093] Write the value of Reg1 into DEPCMDPAR0 (1);

[0094] Write the value of Reg2 into DEPCMDPAR1 (1);

[0095] Write Reg3 into DEPCMDPAR2 (1);

[0096] Write the value of Reg4 into DEPCMD (1);

[0097] Read the value of DEPCMD (1) and write it into Reg0;

[0098] Determine whether the data in Reg0 is equal to the pre-stored data in Reg5, if not, continue to read the value of DEPCMD (1); if yes, read the value of GEVNTCOUNT (1) and put it into Reg0.

[0099] wherein Reg0, Reg1, Reg2, Reg3, Reg4, Reg5 are registers in register modules of the hardware accelerator, DEPCMDPAR0, DEPCMDPAR1, DEPCMDPAR2, DEPCMD, GEVNTCOUNT are registers in the DWC3 controller. In this example, the state machine executes corresponding tasks by reading instructions in the instruction set in sequence. After reading the last instruction, if the returned result is yes, it indicates that the DWC3 controller receives a network data packet, and the subsequent state machine can parse, encapsulate and transmit the network data packet according to the value of GEVNTCOUNT(1).

[0100] In an optional embodiment, the data packet transmission method further comprises a step S12 of sending a second start instruction to the USB controller in response to connecting with the external device through the USB interface; wherein the second start instruction is used to instruct the USB controller to be recognized by the external device. In this embodiment, the USB controller being recognized by the external device means that the external device is allowed to enumerate the terminal device where the USB controller is located, that is, to start the USB controller. At this time, the external device can send a network data packet to the USB controller, and the external device is equivalent to a USB host, and the terminal device where the USB controller is located is equivalent to a USB slave.

[0101] It should be noted that the execution order of the above steps S12 and S11 is not limited, and the above steps S12 and S11 can be executed simultaneously, or the above step S11 can be executed first and then the above step S12, or the above step S12 can be executed first and then the above step S11.

[0102] In an optional embodiment, before the USB controller sends the second start instruction in the above step S12, the following steps S201-S202 are further included:

[0103] Step S201, initializing the USB controller. Specifically, the data in the global register, port and event of the USB controller which requires memory resources can be initialized.

[0104] Step S202, configuring the port in the USB controller for communication with the hardware accelerator. After configuring the port, the hardware accelerator communicates data with the USB controller through the port.

[0105] In an optional embodiment, in order to reduce the power consumption of the hardware accelerator, the data packet transmission method further comprises the step S13 of sending a first stop instruction to the hardware accelerator in response to the disconnection between the terminal device and the external device; wherein the first stop instruction is used to instruct the hardware accelerator to stop running. In this embodiment, the running of the hardware accelerator is stopped after the disconnection between the terminal device and the external device, specifically, the running of the state machine is stopped, and the state machine is restored to the initial state.

[0106] In an optional embodiment, the data packet transmission method further comprises the step S14 of sending a first cleaning instruction to the hardware accelerator in response to the disconnection between the terminal device and the external device; wherein the first cleaning instruction is used to instruct to clean the data in the register module and the memory. In this embodiment, the data in the hardware accelerator is cleaned after the disconnection between the terminal device and the external device, including the data stored in the register module and the memory.

[0107] In an optional embodiment, in order to reduce the power consumption of the USB controller, the data packet transmission method further comprises the step S15 of sending a second stop instruction to the USB controller in response to the disconnection between the terminal device and the external device; wherein the second stop instruction is used to instruct the USB controller to stop running. In a specific implementation, the resources affecting the stop of the USB controller also need to be cleaned in advance, for example, the value of GEVNTCOUNT(1) is set to 0, and all ports are prohibited from data transmission. In this embodiment, the running of the USB controller is stopped after the disconnection between the terminal device and the external device.

[0108] In an optional embodiment, the data packet transmission method further comprises the step S16 of sending a second cleaning instruction to the USB controller in response to the disconnection between the terminal device and the external device; wherein the second cleaning instruction is used to instruct to clean the resources in the USB controller. In this embodiment, the resources in the USB controller are cleaned after the disconnection between the terminal device and the external device, which can specifically include releasing the resources occupying the memory such as events, cleaning the data in the register, etc.

[0109] It should be noted that after the disconnection between the terminal device and the external device, if the data in the hardware accelerator is not cleaned, the steps S101 and S102 are executed once and do not need to be repeatedly executed. After the disconnection between the terminal device and the external device, if the resources in the USB controller are not cleaned, the steps S201 and S202 are executed once and do not need to be repeatedly executed.

[0110] Figure 5 A method flow chart for showing a connection between a terminal device and an external device. As shown, in response to the terminal device being connected with the external device through a USB interface, a register module in a hardware accelerator is configured and a set of instructions is loaded into a storage module in the hardware accelerator, and the hardware accelerator is started by sending a first start instruction. In response to the terminal device being connected with the external device through the USB interface, a USB controller is initialized and port configured, and the USB controller is started by sending a second start instruction. Figure 5

[0111] A method flow chart for showing a disconnection between a terminal device and an external device. As shown, in response to the terminal device being disconnected with the external device, a first stop instruction and a first clean-up instruction are sent to a hardware accelerator to stop the operation of the hardware accelerator and clean up data in the hardware accelerator. In response to the terminal device being disconnected with the external device, a second stop instruction and a second clean-up instruction are sent to a USB controller to stop the operation of the USB controller and clean up resources in the USB controller. Figure 6 Figure 6 The embodiment also provides a data packet transmission apparatus applied to a main controller in a terminal device, the terminal device further comprising a hardware accelerator, a USB controller and a wireless communication module, the data packet transmission apparatus comprising a first start module configured to send a first start instruction to the hardware accelerator in response to being connected with an external device through a USB interface; wherein the first start instruction is configured to instruct the hardware accelerator to analyze and package network data packets received by the USB controller, and to transmit the packaged network data packets through the wireless communication module.

[0112] In an optional implementation, the hardware accelerator comprises a register module, a storage module and a state machine, and the data packet transmission apparatus further comprises a first configuration module configured to configure the register module according to the USB controller and to load a set of instructions set according to the USB controller into the storage module before sending the first start instruction to the hardware accelerator; wherein the state machine is configured to execute instructions in the set of instructions.

[0113] In an optional implementation, the data packet transmission apparatus further comprises a second start module configured to send a second start instruction to the USB controller in response to being connected with an external device through a USB interface; wherein the second start instruction is configured to instruct the USB controller to be recognized by the external device.

[0114]

[0115] ​​In an optional implementation, the data packet transmission apparatus further comprises a second configuration module, configured to initialize the USB controller and configure a port in the USB controller for communication with the hardware accelerator before the USB controller sends the second start instruction.

[0116] In an optional implementation, the data packet transmission apparatus further comprises a first stop module, configured to send a first stop instruction to the hardware accelerator in response to disconnection with the external device; wherein the first stop instruction is configured to instruct the hardware accelerator to stop running.

[0117] In an optional implementation, the data packet transmission apparatus further comprises a first clean-up module, configured to send a first clean-up instruction to the hardware accelerator in response to disconnection with the external device; wherein the first clean-up instruction is configured to instruct clean-up of data in the register module and the memory.

[0118] In an optional implementation, the data packet transmission apparatus further comprises a second stop module, configured to send a second stop instruction to the USB controller in response to disconnection with the external device; wherein the second stop instruction is configured to instruct the USB controller to stop running.

[0119] In an optional implementation, the data packet transmission apparatus further comprises a second clean-up module, configured to send a second clean-up instruction to the USB controller in response to disconnection with the external device; wherein the second clean-up instruction is configured to instruct clean-up of resources in the USB controller.

[0120] Embodiment 2

[0121] Figure 7 A flowchart of the data packet transmission method provided in this embodiment is shown. The data packet transmission method provided in this embodiment can be executed by a data packet transmission apparatus, which can be implemented in software and / or hardware, and can include part or all of a hardware accelerator in a terminal device. As shown in Figure 3 The terminal device 20 comprises a main controller, a hardware accelerator, a USB controller and a wireless communication module, wherein the main controller is in communication connection with the hardware accelerator, the USB controller and the wireless communication module respectively, and the hardware accelerator is in communication connection with the USB controller and the wireless communication module respectively. It should be noted that the main controller is configured to execute the data packet transmission method in Embodiment 1.

[0122] The data packet transmission method provided in this embodiment will be described below with the hardware accelerator in a terminal device as the execution subject. As shown in Figure 7As shown, the data packet transmission method provided by the embodiment can include the following steps S21-S24:

[0123] In step S21, in response to a first start instruction sent by the host controller, it is detected whether the USB controller receives a network data packet. The host controller sends the first start instruction to the hardware accelerator in response to connecting with an external device through a USB interface.

[0124] In step S22, in response to detecting that the USB controller receives the network data packet, the network data packet is read from the USB controller.

[0125] In step S23, the network data packet is parsed and encapsulated. The parsing operation can be RNDIS protocol parsing, which removes the part about the RNDIS protocol in the network data packet. The encapsulation operation can be encapsulating the parsed network data packet according to a wireless communication protocol (i.e., the protocol corresponding to the wireless communication module).

[0126] In step S24, the encapsulated network data packet is transmitted through the wireless communication module. In a specific implementation, the hardware accelerator can transmit the encapsulated network data packet to a base station through the wireless communication module.

[0127] In the embodiment, the USB controller receives the network data packet sent by the external device, and the host controller starts the hardware accelerator. After that, the hardware accelerator processes the network data packet. The communication link will no longer trigger the USB receive interrupt, so the host controller will not perform context switching. The influence of a large number of USB receive interrupts on the performance and power consumption of the host controller can be eliminated, thereby improving the user experience of using the terminal device.

[0128] In an optional implementation, in response to the first start instruction sent by the host controller, the hardware accelerator parses and encapsulates the network data packet received by the wireless communication module, and transmits the encapsulated network data packet through the USB controller. In a specific implementation, the hardware accelerator can transmit the encapsulated network data packet to the external device through the USB controller. The parsing operation can be wireless communication protocol (i.e., the protocol corresponding to the wireless communication module) parsing, which removes the part about the wireless communication protocol in the network data packet. The encapsulation operation can be encapsulating the parsed network data packet according to the RNDIS protocol.

[0129] In the embodiment, the network data packet transmitted by the base station is received by the wireless communication module, and the main controller starts the hardware accelerator, and the hardware accelerator processes the downlink network data packet. The communication link will no longer trigger the USB sending interrupt, so the main controller will not perform context switching, the influence of a large number of USB sending interrupts on the performance and power consumption of the main controller can be eliminated, and the user experience of using the terminal device can be improved.

[0130] In an optional embodiment, the step S21 specifically includes: if the data read from the target register of the USB controller is consistent with the locally pre-stored data, it is detected that the USB controller receives the network data packet, otherwise, it is detected that the USB controller does not receive the network data packet.

[0131] In a specific implementation, the hardware accelerator can include a register module, a storage module and a state machine. Before the main controller sends the first start instruction to the hardware accelerator, the register module can be configured according to the USB controller, and the instruction set set according to the USB controller can be loaded into the storage module; wherein the state machine is used to execute the instructions in the instruction set.

[0132] The main controller can write the address of the USB controller register that needs to be operated by the hardware accelerator into the register module, and can also write the data address that needs to be operated by the hardware accelerator into the register module. The register module includes a plurality of registers, each register is used to store data information, and can store initialization configuration data information such as the address of the USB controller register, and can also store temporary data information such as the return value of the USB controller register obtained by the state machine according to the instructions. The storage module is a readable and writable memory area, which can be RAM (Random Access Memory), Cache (Cache), Flash memory, etc.

[0133] In a specific implementation, different instruction sets can be set according to different USB controllers, and the number of instructions in the instruction set, the execution order of the instructions, the execution content of the instructions, the length of the instructions, etc. can be flexibly set. The execution content of the instructions usually includes reading, writing, data saving, data comparison, etc. In a specific example, the length of each register is 64 bits, and the length of each instruction is fixed to 8 bytes.

[0134] Taking the USB controller as a DWC3 controller (a USB 3.x controller) as an example, an instruction set including the following instructions is set:

[0135] Write the value of Reg1 into DEPCMDPAR0 (1);

[0136] write the value of Reg2 into DEPCMDPAR1(1);

[0137] write Reg3 into DEPCMDPAR2(1);

[0138] write the value of Reg4 into DEPCMD(1);

[0139] read the value of DEPCMD(1) and write it into Reg0;

[0140] determine whether the data in Reg0 is equal to the pre-stored data in Reg5, if not, continue to read the value of DEPCMD(1); if yes, read the value of GEVNTCOUNT(1) and put it into Reg0.

[0141] wherein Reg0, Reg1, Reg2, Reg3, Reg4, Reg5 are registers in a register module of a hardware accelerator, and DEPCMDPAR0, DEPCMDPAR1, DEPCMDPAR2, DEPCMD, GEVNTCOUNT are registers in a DWC3 controller. In this example, the state machine executes corresponding tasks by sequentially reading instructions in the instruction set, and after reading the last instruction, if the returned result is yes, it means that the DWC3 controller receives a network data packet, and the subsequent state machine can parse, encapsulate and transmit the network data packet.

[0142] The embodiment also provides a data packet transmission device applied to a hardware accelerator in a terminal device, which comprises a detection module, a reading module, a processing module and a transmission module. The detection module is configured to detect whether the USB controller receives a network data packet in response to a first start instruction sent by the host controller. The reading module is configured to read the network data packet from the USB controller in response to detection that the USB controller receives the network data packet. The processing module is configured to parse and encapsulate the network data packet. The transmission module is configured to transmit the encapsulated network data packet through the wireless communication module.

[0143] In an optional implementation, the detection module is specifically configured to detect that the USB controller receives a network data packet in a case where data read from a target register of the USB controller is consistent with locally pre-stored data, and otherwise, detect that the USB controller does not receive a network data packet.

[0144] Embodiment 3

[0145] The data packet transmission method provided by the embodiment is applied to a terminal device, for example, Figure 3As shown, the terminal device 20 includes a main controller, a hardware accelerator, a USB controller and a wireless communication module, wherein the main controller is respectively connected to the hardware accelerator, the USB controller and the wireless communication module for communication, and the hardware accelerator is respectively connected to the USB controller and the wireless communication module for communication.

[0146] like Figure 8 As shown, the data packet transmission method provided in this embodiment may include the following steps S31-S32:

[0147] Step S31: In response to being connected to an external device via a USB interface, the main controller sends a first startup instruction to the hardware accelerator. Specifically, the USB controller in the terminal device can establish a connection with the external device via the USB interface.

[0148] Step S32: The hardware accelerator detects whether the USB controller receives a network data packet in response to the first startup instruction. When detecting that the USB controller receives a network data packet, the hardware accelerator reads the network data packet from the USB controller, parses and encapsulates the network data packet, and transmits the encapsulated network data packet through the wireless communication module.

[0149] In a specific implementation, the hardware accelerator can transmit the encapsulated network data packet to the base station via the wireless communication module. The above-mentioned parsing operation can specifically be RNDIS protocol parsing, removing the RNDIS protocol portion of the network data packet, and the above-mentioned encapsulation operation can specifically be encapsulating the parsed network data packet according to the wireless communication protocol (i.e., the protocol corresponding to the wireless communication module).

[0150] In this embodiment, the USB controller receives network data packets sent by the external device. After the main controller starts the hardware accelerator, the hardware accelerator processes the uplink network data packets. The communication link will no longer trigger the USB receive interrupt, and therefore will not cause the main controller to perform context switching. The impact of a large number of USB receive interrupts on the performance and power consumption of the main controller can be eliminated, thereby improving the user experience of using the terminal device.

[0151] In an optional implementation, the hardware accelerator is configured to parse and encapsulate the network data packet received by the wireless communication module and transmit the encapsulated network data packet through the USB controller in response to the first start instruction sent by the host controller. In a specific implementation, the hardware accelerator can transmit the encapsulated network data packet to the external device through the USB controller. The parsing operation can be a wireless communication protocol (i.e., a protocol corresponding to the wireless communication module) parsing operation, and the encapsulation operation can be an encapsulation operation of the parsed network data packet according to the RNDIS protocol.

[0152] In the embodiment, the host controller starts the hardware accelerator to process the downlink network data packet received by the wireless communication module, and the communication link no longer triggers the USB transmission interrupt, so that the host controller does not perform context switching, and the impact of a large number of USB transmission interrupts on the performance and power consumption of the host controller can be eliminated, thereby improving the user experience of using the terminal device.

[0153] It should be noted that the steps performed by the host controller and the hardware accelerator in the embodiment and the corresponding effects can refer to the above-described embodiments 1 and 2.

[0154] The embodiment also provides a data packet transmission device, which includes a hardware accelerator, a host controller, a USB controller, and a wireless communication module. The host controller is configured to send a first start instruction to the hardware accelerator in response to being connected to an external device through a USB interface. The hardware accelerator is configured to detect whether the USB controller receives a network data packet in response to the first start instruction, read the network data packet from the USB controller when it is detected that the USB controller receives the network data packet, parse and encapsulate the network data packet, and transmit the encapsulated network data packet through the wireless communication module.

[0155] In an optional implementation, the hardware accelerator includes a register module, a storage module, and a state machine. The host controller is further configured to configure the register module according to the USB controller before sending the first start instruction to the hardware accelerator, and load an instruction set set according to the USB controller into the storage module. The state machine is configured to execute instructions in the instruction set.

[0156] In an optional implementation, the main controller is further configured to send a second start instruction to the USB controller in response to the connection with the external device via the USB interface; wherein the second start instruction is used to instruct the USB controller to be recognized by the external device.

[0157] In an optional implementation, the main controller is further configured to initialize the USB controller and configure a port in the USB controller for communication with the hardware accelerator before the USB controller sends the second start instruction.

[0158] In an optional implementation, the main controller is further configured to send a first stop instruction to the hardware accelerator in response to the disconnection with the external device; wherein the first stop instruction is used to instruct the hardware accelerator to stop running.

[0159] In an optional implementation, the main controller is further configured to send a first clean-up instruction to the hardware accelerator in response to the disconnection with the external device; wherein the first clean-up instruction is used to instruct to clean up data in the register module and the memory.

[0160] In an optional implementation, the main controller is further configured to send a second stop instruction to the USB controller in response to the disconnection with the external device; wherein the second stop instruction is used to instruct the USB controller to stop running.

[0161] In an optional implementation, the main controller is further configured to send a second clean-up instruction to the USB controller in response to the disconnection with the external device; wherein the second clean-up instruction is used to instruct to clean up resources in the USB controller.

[0162] In an optional implementation, the hardware accelerator is specifically configured to detect that the USB controller receives a network data packet when data read from the target register of the USB controller is consistent with locally pre-stored data, and otherwise, detect that the USB controller does not receive a network data packet.

[0163] Embodiment 4

[0164] Figure 9A structural schematic diagram of a terminal device is provided in this embodiment. The terminal device comprises at least one processor and a memory connected with the at least one processor in communication. The memory stores a computer program which can be run by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the data packet transmission method in Embodiment 1 or 2. In one example, the processor is the above-mentioned main controller, which can perform the data packet transmission method in Embodiment 1. In another example, the processor is the above-mentioned hardware accelerator, which can perform the data packet transmission method in Embodiment 2. Figure 9 The terminal device 3 shown is merely an example and should not impose any limitation on the functions and use range of the embodiments of the present disclosure.

[0165] The components of the terminal device 3 can include, but are not limited to, the above-mentioned at least one processor 4, the above-mentioned at least one memory 5, and a bus 6 connecting different system components including the memory 5 and the processor 4.

[0166] The bus 6 includes a data bus, an address bus, and a control bus.

[0167] The memory 5 can include a volatile memory, such as a random access memory (RAM) 51 and / or a cache memory 52, and can further include a non-volatile memory, such as a read-only memory (ROM) 53.

[0168] The memory 5 can further include a program / utility 55 having a set (at least one) of program modules 54, including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or a combination can include implementation of a network environment.

[0169] The processor 4 performs various function applications and data processing, such as the above-mentioned data packet transmission method, by running the computer program stored in the memory 5.

[0170] The terminal device 3 can also communicate with one or more external devices 7, such as a keyboard, a pointing device, etc. Such communication can be carried out through an input / output (I / O) interface 8. Furthermore, the terminal device 3 can also communicate with one or more networks, such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet, through a network adapter 9. As shown, the network adapter 9 communicates with other modules of the terminal device 3 through the bus 6. It should be understood that although Figure 9 the network adapter 9 is shown as a separate component, the network adapter 9 can be an internal component of the terminal device 3, and therefore can not be considered as an external component in some embodiments. Figure 9Other hardware and / or software modules not shown in FIG. 3 can be used in conjunction with the terminal device 3, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (redundant array of independent disks) systems, tape drives, and data archival storage systems, etc.

[0171] It should be noted that although several units / modules or sub-units / modules of the terminal device are mentioned in the above detailed description, such division is merely exemplary and not mandatory. Indeed, according to embodiments of the present disclosure, features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, features and functions of one unit / module described above can be further divided into several units / modules.

[0172] Embodiment 5

[0173] The embodiment provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps of the data packet transmission method in the embodiment 1 or 2.

[0174] More specifically, the computer readable storage medium can include, but is not limited to: a portable disc, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0175] In possible embodiments, the present application can also be implemented in the form of a computer program product, which includes a computer program. The computer program is executed by a processor to implement the steps of the data packet transmission method in the embodiment 1 or 2.

[0176] The computer program for implementing the present disclosure can be written in any combination of one or more programming languages, and can be executed entirely on the terminal device, partially on the terminal device, as a standalone software package, partially on the terminal device and partially on a remote device, or entirely on a remote device.

[0177] Although the specific embodiments of the present application are described above, those skilled in the art should understand that this is only an illustration, and the protection scope of the present application 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 application, and such changes and modifications all fall within the protection scope of the present application.

Claims

1. A data packet transmission method, characterized in that: A main controller is applied to a terminal device, the terminal device further comprising a hardware accelerator, a USB controller and a wireless communication module, the hardware accelerator being connected to the USB controller and the wireless communication module respectively, and the data packet transmission method comprising the following steps: In response to connecting to an external device via a USB interface, a first startup instruction is sent to the hardware accelerator; wherein the first startup instruction is used to instruct the hardware accelerator to parse and encapsulate the network data packet received by the USB controller, and transmit the encapsulated network data packet through the wireless communication module; the parsing operation is to parse the remote network driver interface specification RNDIS protocol and remove the RNDIS protocol portion in the network data packet; the encapsulation operation is to encapsulate the parsed network data packet according to the wireless communication protocol corresponding to the wireless communication module; The hardware accelerator includes a register module, a storage module, and a state machine. Before sending a first startup instruction to the hardware accelerator, the method further includes the following steps: Configuring the register module according to the USB controller; Loading an instruction set set according to the USB controller into the storage module; wherein the state machine is used to execute instructions in the instruction set; When implementing USB sharing connection through the above steps, there is no need to trigger USB receive interrupt and USB send interrupt.

2. The data packet transmission method according to claim 1, wherein: The data packet transmission method comprises the following steps: In response to connecting with an external device through a USB interface, a second startup instruction is sent to the USB controller; wherein the second startup instruction is used to instruct the USB controller to allow being recognized by the external device.

3. The data packet transmission method according to claim 2, wherein: Before the USB controller sends the second startup instruction, the method further includes the following steps: Initializing the USB controller; A port in the USB controller for communicating with the hardware accelerator is configured.

4. The data packet transmission method according to claim 1, wherein: The data packet transmission method further comprises the following steps: In response to the disconnection between the external device and the hardware accelerator, a first stop instruction is sent to the hardware accelerator; wherein the first stop instruction is used to instruct the hardware accelerator to stop running.

5. The data packet transmission method according to claim 1, wherein: The data packet transmission method further comprises the following steps: In response to the disconnection between the external device and the hardware accelerator, a first cleanup instruction is sent to the hardware accelerator; wherein the first cleanup instruction is used to instruct to clean up the data in the register module and the storage module.

6. The data packet transmission method according to claim 2, wherein: The data packet transmission method further comprises the following steps: In response to the disconnection between the external device and the USB controller, a second stop instruction is sent to the USB controller; wherein the second stop instruction is used to instruct the USB controller to stop running.

7. The data packet transmission method according to claim 3, wherein: The data packet transmission method further comprises the following steps: In response to the disconnection between the external device and the USB controller, a second cleanup instruction is sent to the USB controller; wherein the second cleanup instruction is used to instruct to clean up the resources in the USB controller.

8. A data packet transmission method, characterized in that: A hardware accelerator applied to a terminal device, the terminal device further comprising a main controller, a USB controller, and a wireless communication module, the hardware accelerator being connected to the USB controller and the wireless communication module respectively, the hardware accelerator comprising a register module, a storage module, and a state machine, the storage module being used to store an instruction set set according to the USB controller, the state machine being used to execute instructions in the instruction set, and the data packet transmission method comprising the following steps: In response to a first startup instruction sent by the main controller, detecting whether the USB controller receives a network data packet; In response to detecting that the USB controller receives a network data packet, reading the network data packet from the USB controller; Parsing and encapsulating the network data packet; the parsing operation is RNDIS protocol parsing, removing the RNDIS protocol portion of the network data packet; the encapsulation operation is encapsulating the parsed network data packet according to the wireless communication protocol corresponding to the wireless communication module; Transmitting the encapsulated network data packets through the wireless communication module; When implementing USB sharing connection through the above steps, there is no need to trigger USB receive interrupt and USB send interrupt.

9. The data packet transmission method according to claim 8, wherein: The detecting whether the USB controller receives the network data packet specifically includes: If the data read from the target register of the USB controller is consistent with the locally pre-stored data, it is detected that the USB controller has received the network data packet; otherwise, it is detected that the USB controller has not received the network data packet.

10. A data packet transmission method, characterized in that: The invention is applied to a terminal device, the terminal device including a hardware accelerator, a main controller, a USB controller and a wireless communication module, the hardware accelerator being connected to the USB controller and the wireless communication module respectively, the hardware accelerator including a register module, a storage module and a state machine; the data packet transmission method includes the following steps: The main controller configures the register module according to the USB controller and loads the instruction set set according to the USB controller into the storage module; wherein the state machine is used to execute instructions in the instruction set; The main controller sends a first startup instruction to the hardware accelerator in response to being connected to the external device through the USB interface; The hardware accelerator detects, in response to the first startup instruction, whether the USB controller receives a network data packet. If the USB controller receives the network data packet, the hardware accelerator reads the network data packet from the USB controller, parses and encapsulates the network data packet, and transmits the encapsulated network data packet through the wireless communication module, so as to achieve a USB shared connection without triggering a USB receive interrupt and a USB send interrupt. The parsing operation is RNDIS protocol parsing, removing the RNDIS protocol portion in the network data packet; the encapsulation operation is encapsulating the parsed network data packet according to the wireless communication protocol corresponding to the wireless communication module.

11. A data packet transmission device, characterized in that: A main controller applied to a terminal device, the terminal device further comprising a hardware accelerator, a USB controller and a wireless communication module, the hardware accelerator being connected to the USB controller and the wireless communication module respectively, and the data packet transmission device comprising: a first startup module, configured to send a first startup instruction to the hardware accelerator in response to connection with an external device via a USB interface; wherein the first startup instruction is configured to instruct the hardware accelerator to parse and encapsulate network data packets received by the USB controller, and to transmit the encapsulated network data packets through the wireless communication module; the parsing operation is RNDIS protocol parsing, removing the RNDIS protocol portion of the network data packets; and the encapsulation operation is encapsulating the parsed network data packets according to the wireless communication protocol corresponding to the wireless communication module; The hardware accelerator includes a register module, a storage module, and a state machine. The data packet transmission device further includes: a first configuration module, configured to configure the register module according to the USB controller and load an instruction set set according to the USB controller into the storage module before sending a first startup instruction to the hardware accelerator; wherein the state machine is configured to execute instructions in the instruction set; When the USB sharing connection is realized through the above module, there is no need to trigger the USB receive interrupt and USB send interrupt.

12. A data packet transmission device, characterized in that: A hardware accelerator applied to a terminal device, the terminal device further comprising a main controller, a USB controller, and a wireless communication module, the hardware accelerator being connected to the USB controller and the wireless communication module respectively, the hardware accelerator comprising a register module, a storage module, and a state machine, the storage module being used to store an instruction set set according to the USB controller, the state machine being used to execute instructions in the instruction set, and the data packet transmission device comprising: a detection module, configured to detect whether the USB controller receives a network data packet in response to a first startup instruction sent by the main controller; a reading module, configured to read the network data packet from the USB controller in response to detecting that the USB controller receives the network data packet; A processing module, configured to parse and encapsulate the network data packet; the parsing operation is RNDIS protocol parsing, removing the RNDIS protocol portion of the network data packet; and the encapsulation operation is encapsulating the parsed network data packet according to the wireless communication protocol corresponding to the wireless communication module; A transmission module, configured to transmit the encapsulated network data packets via the wireless communication module; When the USB sharing connection is realized through the above module, there is no need to trigger the USB receive interrupt and USB send interrupt.

13. A data packet transmission device, characterized in that: The system comprises a hardware accelerator, a main controller, a USB controller and a wireless communication module, wherein the hardware accelerator is connected to the USB controller and the wireless communication module respectively, and the hardware accelerator comprises a register module, a storage module and a state machine; the main controller is used to configure the register module according to the USB controller and load an instruction set set according to the USB controller into the storage module; wherein the state machine is used to execute instructions in the instruction set; The main controller is further configured to send a first startup instruction to the hardware accelerator in response to being connected to an external device via a USB interface; The hardware accelerator is configured to detect, in response to the first startup instruction, whether the USB controller has received a network data packet, and, if detecting that the USB controller has received the network data packet, read the network data packet from the USB controller, parse and encapsulate the network data packet, and transmit the encapsulated network data packet through the wireless communication module, so as to achieve a USB shared connection without triggering a USB receive interrupt and a USB send interrupt; The parsing operation is RNDIS protocol parsing, removing the RNDIS protocol portion in the network data packet; the encapsulation operation is encapsulating the parsed network data packet according to the wireless communication protocol corresponding to the wireless communication module.

14. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the data packet transmission method according to any one of claims 1 to 9 is implemented.

15. A chip, applied to a terminal device, characterized in that: The chip is used to execute the data packet transmission method according to any one of claims 1 to 9.

16. A chip module, applied to a terminal device, characterized in that: The method comprises a chip, wherein the chip is used to execute the data packet transmission method according to any one of claims 1 to 9.

17. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data packet transmission method according to any one of claims 1 to 9 are implemented.

18. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the data packet transmission method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • A data transmission method and system

    CN101170382A

  • Method for controlling USB device through coprocessor for mobile phone

    CN101645002A