A data transmission method and device, electronic equipment and medium
By instructing terminal devices in the host system to use either bulk or distributed transfer methods to download firmware, the compatibility issues of PCIe devices when downloading firmware are resolved, resulting in higher download success rates and lower hardware costs. This method is applicable to devices with and without DMA controllers.
Patent Information
- Application Number
- CN202511234518.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-08-29
AI Technical Summary
In existing technologies, PCIe devices are incompatible with devices that have and do not have DMA controllers when downloading firmware, resulting in a high risk of download failure and failing to effectively reduce hardware costs and improve update efficiency.
By instructing terminal devices in the host system to download firmware using either batch or distributed transmission methods, and combining DMA and non-DMA controllers, the data transmission method is dynamically adjusted to improve the success rate and ensure compatibility with terminal devices that have and do not have DMA controllers.
It improved the success rate of firmware downloads, reduced the potential risk of chip failure, expanded the application scope of data transmission methods, reduced hardware costs, and improved update efficiency.
Smart Images

Figure CN120743828B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the chip technical field, and particularly relates to a data transmission method and device, electronic equipment and medium. BACKGROUND
[0002] With the improvement of communication data bandwidth, PCIe (peripheral component interconnect express, high-speed serial computer expansion bus standard) becomes a communication interface between devices, and the operation of the PCIe device must rely on specific firmware (firmware). In order to reduce the hardware cost of the PCIe device, the firmware can be stored in the host system, which can not only save cost but also facilitate updating. SUMMARY
[0003] The present disclosure provides a data transmission method and device, electronic equipment and medium, and provides a scheme for a terminal device to download firmware in a manner of issuing a command by a host system.
[0004] The first aspect embodiment of the present disclosure provides a data transmission method, comprising: receiving first information, the first information being used to indicate a data transmission manner of a terminal device, the first information comprising a first identifier and parameter information corresponding to the first identifier, and the data transmission manner comprising a batch transmission manner and a distributed transmission manner; and obtaining target data from a host system based on the first information.
[0005] In some embodiments of the present disclosure, receiving the first information comprises: determining a mapping relationship between a device exchange memory of the terminal device and a host processing unit of the host system according to a data transmission connection between the terminal device and the host system; detecting the device exchange memory according to a preset period based on the mapping relationship, to determine a first storage position of the first identifier and a second storage position of the parameter information corresponding to the first identifier in the device exchange memory; reading the first identifier from the first storage position, and reading the parameter information corresponding to the first identifier from the second storage position.
[0006] In some embodiments of the present disclosure, obtaining the target data from the host system based on the first information comprises: determining a target data transmission manner corresponding to the first identifier based on a preset association relationship, the target data transmission manner being the batch transmission manner or the distributed transmission manner; determining parameter information corresponding to the target data transmission manner stored in the device exchange memory of the terminal device, the parameter information comprising at least one of a start address, a destination address, a data size, and check information; and obtaining the target data from the host system through the target data transmission manner based on the parameter information.
[0007] In some embodiments of the present disclosure, the target data transmission mode is a batch transmission mode, and the target data is obtained from the host system based on the parameter information through the target data transmission mode, including: initializing a batch transmission channel, and writing a start address and a destination address into a source address register in a direct memory access (DMA); and obtaining the target data from a corresponding storage location in a host memory of the host system at the start address through the DMA, and writing the target data into a corresponding storage location in a device memory of the terminal device at the destination address.
[0008] In some embodiments of the present disclosure, the target data transmission mode is a distributed transmission mode, and the target data is obtained from the host system based on the parameter information through the target data transmission mode, including: establishing an address mapping relationship between a device local address region and a PCI bus address space; and in response to completion of the address mapping relationship, obtaining a target data packet from the host system, the target data packet including a PCI bus address and target data.
[0009] In some embodiments of the present disclosure, the method further includes: determining a device local address corresponding to the PCI bus address based on the address mapping relationship; and writing the target data into a storage space corresponding to the device local address.
[0010] In some embodiments of the present disclosure, the method further includes: receiving second information, the second information being used to indicate a transmission result of the target data; detecting a device exchange memory according to a preset period, and in response to detecting that the second information indicates that the target data transmission is completed, performing integrity verification on the target data based on the verification information; and in response to successful integrity verification of the target data, writing the target data into a persistent storage medium, and switching a state of the terminal device to a state of running the target data.
[0011] In some embodiments of the present disclosure, the method further includes: sending third information, the third information being used to indicate a result of the integrity verification; and in response to failed integrity verification of the target data, receiving fourth information, the fourth information being used to update the data transmission mode, the fourth information including a second identifier and parameter information corresponding to the second identifier.
[0012] In the above embodiments, the terminal device can obtain the target data from the host system according to the data transmission mode indicated by the host system, and the host system can dynamically update the indicated data transmission mode, thereby improving the success rate of the terminal device obtaining the target data, avoiding potential flow risk, expanding the application range of the data transmission mode, and applying to both terminal devices with a DMA controller and terminal devices without a DMA controller.
[0013] A second aspect of the present disclosure provides a data transmission method, comprising: sending first information, the first information being used to indicate a data transmission mode of a terminal device, the first information comprising a first identifier and parameter information corresponding to the first identifier, the data transmission mode comprising a batch transmission mode and a distributed transmission mode, and the first information being used for the terminal device to obtain target data from a host system.
[0014] In some embodiments of the present disclosure, the method further comprises: determining a mapping relationship between a host processing unit of the host system and a device exchange memory of the terminal device according to a data transmission connection between the host system and the terminal device.
[0015] In some embodiments of the present disclosure, the sending of the first information comprises: migrating the target data from a file system to the host processing unit; determining the first identifier corresponding to the target data transmission mode based on a preset association relationship, the target data transmission mode being the batch transmission mode or the distributed transmission mode; and in response to completion of the migration of the target data, sending the first information to the device exchange memory of the terminal device based on the mapping relationship.
[0016] In some embodiments of the present disclosure, the target data transmission mode is the distributed transmission mode, and the method further comprises: in response to completion of establishment of an address mapping relationship by the terminal device, sending the target data to the terminal device, the address mapping relationship representing a relationship between a device local address region of the terminal device and a PCI bus address space.
[0017] In some embodiments of the present disclosure, the sending of the target data to the terminal device comprises: sending a target data packet to the terminal device, the target data packet comprising a PCI bus address and the target data, and the target data packet being used for the terminal device to write the target data into a storage space of a device local address corresponding to the PCI bus address based on the address mapping relationship.
[0018] In some embodiments of the present disclosure, the method further comprises: in response to completion of the transmission of the target data, sending second information, the second information being used to indicate a transmission result of the target data.
[0019] In some embodiments of the present disclosure, the method further comprises: receiving third information, the third information being used to indicate a result of integrity verification of the terminal device; and in response to failure of the integrity verification of the target data, sending fourth information, the fourth information being used to update the data transmission mode of the terminal device, the fourth information comprising a second identifier and parameter information corresponding to the second identifier.
[0020] In the above embodiments, the host system can indicate the data transmission mode of the terminal device for obtaining the target data by sending indication information to the terminal device, and update the indicated data transmission mode in the case of failure of the terminal device to obtain the target data, thereby improving the success rate of the terminal device to obtain the target data and avoiding potential tape-out risks.
[0021] A third aspect of the present disclosure provides a data transmission apparatus, comprising a transceiver module and a processing module, the transceiver module is configured to receive first information, the first information is used to indicate a data transmission mode of a terminal device, the first information comprises a first identifier and parameter information corresponding to the first identifier, and the data transmission mode comprises a batch transmission mode and a distributed transmission mode; the processing module is configured to obtain target data from a host system based on the first information.
[0022] In some embodiments of the present disclosure, the transceiver module is configured to determine a mapping relationship between a device exchange memory of the terminal device and a host processing unit of the host system according to a data transmission connection between the terminal device and the host system; detect the device exchange memory according to a preset period based on the mapping relationship, determine a first storage location of the first identifier and a second storage location of the parameter information corresponding to the first identifier in the device exchange memory; read the first identifier from the first storage location and read the parameter information corresponding to the first identifier from the second storage location.
[0023] In some embodiments of the present disclosure, the processing module is configured to determine a target data transmission mode corresponding to the first identifier based on a preset association relationship, the target data transmission mode being the batch transmission mode or the distributed transmission mode; determine parameter information corresponding to the target data transmission mode stored in the device exchange memory of the terminal device, the parameter information comprising at least one of a start address, a destination address, a data size, and check information; and obtain the target data from the host system through the target data transmission mode based on the parameter information.
[0024] In some embodiments of the present disclosure, the processing module is configured to initialize a batch transmission channel, write the start address and the destination address into an address register in a direct memory access (DMA), and obtain the target data from a storage location corresponding to the start address in a host memory of the host system through the DMA and write the target data into a storage location corresponding to the destination address in a device memory of the terminal device.
[0025] In some embodiments of the present disclosure, the processing module is configured to establish an address mapping relationship between a device local address area and a PCI bus address space, and obtain a target data packet from the host system in response to completion of establishment of the address mapping relationship, the target data packet comprising a PCI bus address and target data.
[0026] A fourth aspect of the present disclosure provides a data transmission apparatus, comprising a transceiver module and a processing module, the transceiver module is configured to send first information, the first information is used to indicate a data transmission mode of a terminal device, the first information comprises a first identifier and parameter information corresponding to the first identifier, and the data transmission mode comprises a batch transmission mode and a distributed transmission mode, and the first information is used for the terminal device to obtain target data from a host system.
[0027] In some embodiments of the present disclosure, the processing module is configured to determine, according to the data transmission connection between the terminal device and the host system, a mapping relationship between a host processing unit of the host system and a device exchange memory of the terminal device.
[0028] In some embodiments of the present disclosure, the processing module is configured to: migrate the target data from the file system to the host processing unit; determine, based on a preset association relationship, a first identifier corresponding to a target data transmission mode, the target data transmission mode being a batch transmission mode or a distributed transmission mode; and in response to completion of the target data migration, send, based on the mapping relationship, the first information to the device exchange memory of the terminal device.
[0029] In some embodiments of the present disclosure, the transceiver module is configured to: in response to completion of the address mapping relationship establishment of the terminal device, send the target data to the terminal device.
[0030] In some embodiments of the present disclosure, the transceiver module is configured to: send the target data packet to the terminal device, the target data packet comprising a PCI bus address and target data, the target data packet being used for the terminal device to write the target data into a storage space of a device local address corresponding to the PCI bus address based on the address mapping relationship.
[0031] A fifth aspect of the present disclosure provides an electronic device, comprising: a processor and a memory for storing a computer program capable of running on the processor, wherein the processor is configured to run the computer program to execute the method described in any one of the embodiments of the first aspect or the second aspect of the present disclosure.
[0032] A sixth aspect of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, the computer instructions being used to make a computer execute the method described in any one of the embodiments of the first aspect or the second aspect of the present disclosure.
[0033] A seventh aspect of the present disclosure provides a program product comprising computer instructions, the computer instructions being used to make a computer execute the method described in any one of the embodiments of the first aspect or the second aspect of the present disclosure.
[0034] An eighth aspect of the present disclosure provides a chip comprising at least one processor and a communication interface; the communication interface is used to receive a signal input into the chip or output a signal from the chip, the processor communicates with the communication interface and realizes the method described in any one of the embodiments of the first aspect or the second aspect of the present disclosure through a logic circuit or an execution code instruction.
[0035] In summary, the data transmission method and device, electronic equipment and medium provided by the present disclosure include: a terminal device receives first information, the first information is used to indicate a data transmission mode of the terminal device, the first information includes a first identifier and parameter information corresponding to the first identifier, and the data transmission mode includes a batch transmission mode and a distributed transmission mode; and the terminal device obtains target data from a host system based on the first information. The data transmission method provided by the present disclosure can enable the terminal device to obtain target data from the host system according to the data transmission mode indicated by the host system, and the host system can dynamically update the indicated data transmission mode, thereby improving the success rate of the terminal device obtaining target data, avoiding potential flow risk, expanding the application range of the data transmission mode, and enabling the data transmission mode to be applied to terminal devices with a DMA controller and terminal devices without a DMA controller.
[0036] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and are not limiting to the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0037] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure and are not an undue limitation on the present disclosure.
[0038] Figure 1 Interaction diagram of the data transmission method proposed by the embodiments of the present disclosure;
[0039] Figure 2 Flowchart of the batch transmission mode proposed by the embodiments of the present disclosure;
[0040] Figure 3 Flowchart of the distributed transmission mode proposed by the embodiments of the present disclosure;
[0041] Figure 4A DMA mode diagram;
[0042] Figure 4B Non-DMA mode diagram;
[0043] Figure 4C Flowchart of the specific implementation of the data transmission method;
[0044] Figure 5 Structure diagram of a data transmission device proposed by the embodiments of the present disclosure;
[0045] Figure 6 Structure diagram of a data transmission device proposed by the embodiments of the present disclosure;
[0046] Figure 7 Structure diagram of an electronic equipment proposed by the embodiments of the present disclosure;
[0047] Figure 8 FIG. 1 is a schematic diagram of a chip for implementing the data transmission method according to an exemplary embodiment. DETAILED DESCRIPTION
[0048] Embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. Examples of the embodiments are shown in the drawings, wherein the same or similar notations denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the drawings are exemplary and are intended to explain the present disclosure, and cannot be understood as a limitation of the present disclosure.
[0049] When the specific firmware on which the PCIe device depends is stored in the host system, the PCIe device can or can not have DMA (Direct Memory Access), so it is crucial how to download the firmware required by the PCIe device into the PCIe device through the PCIe channel. Therefore, in order to ensure that the firmware can be downloaded into the PCIe device, there are two ways of active and passive to download the firmware, but the way of downloading is relatively fixed, that is, the PCIe device can only use one way to download the firmware. If the active acquisition method is used in the case of no DMA, it will cause the download to fail.
[0050] In order to solve the above problems, the present disclosure provides a data transmission method, by increasing the backup scheme of firmware download, the terminal device can download firmware in the active way of DMA and receive firmware in the passive way of non-DMA according to the indication of the host system, thereby improving the download success rate and reducing the potential risk of tape-out; the present scheme can be compatible with various PCIe Device devices with DMA or without DMA.
[0051] In the present application, firmware can be a kind of update data transmitted by encryption. Firmware itself is a collection of program codes, which functions to process data through algorithms, and is usually stored in the internal storage space of the device in binary files (such as.bin,.hex format). The data and target data involved in the embodiments of the present application can represent a kind of firmware.
[0052] The data transmission method provided by the present application will be described in detail below with reference to the accompanying drawings.
[0053] The data transmission method provided by the present disclosure can be applied to a communication system, which includes a terminal device and a host system. The terminal device and the host system can perform data transmission.
[0054] In some embodiments, the terminal device can be a device with a DMA controller or a device without a DMA controller.
[0055] Figure 1 An interaction schematic diagram of a data transmission method is provided for the embodiments of the present disclosure, and the method is performed by a communication system. As shown in the figure, the method comprises the following steps: Figure 1
[0056] Step 101, the terminal device and the host system determine a mapping relationship.
[0057] In some embodiments, the host system determines the mapping relationship between the host processing unit of the host system and the device exchange memory of the terminal device according to the data transmission connection between the host system and the terminal device. Specifically, the host system can establish a mapping relationship between the address space of the host processing unit and the device exchange memory, that is, a mapping relationship between an address space in the host processing unit and an address space in the device exchange memory.
[0058] In some embodiments, the terminal device determines the mapping relationship between the device exchange memory of the terminal device and the host processing unit of the host system according to the data transmission connection between the terminal device and the host system. Specifically, the terminal device can synchronize the mapping relationship established by the host system to the terminal device in a synchronous manner.
[0059] In some embodiments, the data transmission connection between the host system and the terminal device can be a PCIe link, and the terminal device establishes a PCIe data transmission connection with the host system by enabling the PCIe link and the DMA function. The terminal device can have a dedicated DMA controller inside and the DMA controller can work normally, or the terminal device can have no DMA controller or the DMA controller cannot work normally.
[0060] In some embodiments, the device exchange memory of the terminal device can be a SWAP area register, which can be a shared memory area for bidirectional communication between the host system and the terminal device. The host system writes commands or data, and the terminal device reads and executes, or vice versa, the terminal device writes data or feedback, and the host system reads and processes, and so on.
[0061] In some embodiments, the host processing unit of the host system can be a CPU (Central Process Unit) of the host system.
[0062] In some embodiments, the mapping relationship between the device swap memory and the host processing unit time can be used by the terminal device to determine the storage location of the command written by the host system in the device memory based on the mapping relationship, and can be used by the host system to determine the storage location of the command to be written in the device memory of the terminal device based on the mapping relationship.
[0063] For example, as shown in the schematic diagram, Figure 4A When the PCIe Device has a dedicated DMA controller and the DMA controller is working properly, the bootrom code program of the PCIe Device enables the PCIe link and the DMA function.
[0064] For example, as shown in the schematic diagram, Figure 4B When the PCIe Device does not have a DMA controller or the DMA controller is not working properly, the bootrom code program of the PCIe Device enables the PCIe link and the DMA function.
[0065] In some embodiments, the terminal device enters the PCIe download mode after power-on, so as to establish a data transmission connection with the host system.
[0066] In some embodiments, after the data transmission connection is established, the terminal device and the host system determine the mapping relationship between the device swap memory and the host processing unit based on the data transmission connection, so that the two parties can communicate based on the mapping relationship.
[0067] For example, the PCIe Device side is powered on to enter the Bootrom program and enters the PCIe download mode; and the Host System successfully links up; and the mapping between the address space of the BAR (Base Address Register) and the doorbell and the SWAP region register of the PCIe Device side is initialized. The BAR is used to map the register or memory region of the PCIe Device to the physical address space CPU of the host system, and the Host System establishes the mapping between the address spaces, which can be the mapping between the CPU and the SWAP region register. The doorbell is a specific offset (such as BAR0 + 0x1000) in the BAR, and the host system writes to the address to trigger the device action.
[0068] In step 102, the host system sends first information to the terminal device.
[0069] In some embodiments, the host system migrates target data from a file system to a host processing unit; determines a first identifier corresponding to a target data transmission mode based on a preset association relationship, the target data transmission mode being a batch transmission mode or a distributed transmission mode; and in response to completion of migration of the target data, sends first information to a device exchange memory of the terminal device based on a mapping relationship.
[0070] In some embodiments, the first information can be a download command for instructing the terminal device to download firmware.
[0071] In some embodiments, the first information is used to instruct a data transmission mode of the terminal device, and the first information includes a first identifier and parameter information corresponding to the first identifier, the data transmission mode including a batch transmission mode and a distributed transmission mode.
[0072] In some embodiments, the batch transmission mode can be a DMA mode to actively download firmware, and the distributed transmission mode can be a non-DMA mode to passively receive firmware. Specifically, only when the terminal device has a DMA controller and the DMA controller can normally operate, the terminal device can execute the batch transmission mode, and when there is no DMA controller or there is a DMA controller but it cannot normally operate, the terminal device cannot execute the batch transmission mode and needs to execute the distributed transmission mode to obtain data.
[0073] In some embodiments, the host system needs to migrate target data to be downloaded by the terminal device from a file system to a host processing unit, so as to transmit the target data to the terminal device through a data transmission connection.
[0074] In some embodiments, migrating the target data from the file system to the host processing unit can be reading the target data from the file system and writing it into a DDR (Double Data Rate) of a CPU of the host system, the target data having a corresponding storage starting address in the DDR.
[0075] For example, the Host System needs to read firmware from a file system and write it into a certain starting address of a DDR (Double Data Rate) on the Host System side, and assume that this address is SAR.
[0076] In some embodiments, the preset association relationship can be a corresponding relationship between the data transmission mode and the identifier. The host system determines, based on the preset association relationship, a first identifier corresponding to the target data transmission mode indicated to the terminal device this time, and generates first information. The first information includes the first identifier corresponding to the target transmission mode and parameter information corresponding to the target transmission mode, in other words, the parameter information corresponding to the first identifier.
[0077] In some embodiments, after the target data migration is completed, the host system writes the first information into the device swap memory of the terminal device according to the mapping relationship.
[0078] For example, the CPU on the Host System side carries the firmware from the file system to the DDR on the Host System side; the Host System side sends a command to the PCIe Device side.
[0079] For example, the CPU on the Host System side writes the boot cmd (download command) and the parameters required for executing the cmd into the SWAP area register on the PCIe Device side through the PCI link; and writes a signal triggering the execution of the boot cmd into the SWAP area register on the PCIe Device side.
[0080] Step 103: The terminal device reads the first information.
[0081] In some embodiments, the terminal device detects the device swap memory according to a preset period based on the mapping relationship, to determine a first storage location of the first identifier in the device swap memory and a second storage location of the parameter information corresponding to the first identifier.
[0082] In some embodiments, the preset period can be a period for polling set in advance by the terminal device, which can be customized according to the scene or demand.
[0083] In some embodiments, the terminal device detects the device swap memory according to the preset period to determine whether the host system has sent the first information, and determines the storage location of the first information sent by the host system based on the mapping relationship.
[0084] In some embodiments, the terminal device can detect the storage space of the device swap memory according to the preset period. After detecting the first identifier, the terminal device can determine the first storage location of the first identifier sent by the host system in the device swap memory, and further determine the second storage location of the parameter information corresponding to the first identifier in the device swap memory.
[0085] For example, the CPU on the PCIe Device side waits for the firmware download command by polling the doorbell register.
[0086] In some embodiments, the terminal device reads the first identifier from a first storage location in the device memory and reads the parameter information corresponding to the first identifier from a second storage location, thereby determining the data transmission mode indicated by the host system, i.e., the target data transmission mode and the parameter information corresponding to the target data transmission mode. It can be understood that the parameter information includes at least one of the starting address, the destination address, the data size, and the check information of the target data, and for different data transmission modes, as long as the target data is the same, the parameter information is the same.
[0087] In step 104, the terminal device acquires the target data.
[0088] In some embodiments, the terminal device acquires the target data from the host system based on the first information.
[0089] In some embodiments, the terminal device determines the target data transmission mode corresponding to the first identifier based on a preset association relationship, determines the parameter information corresponding to the target data transmission mode stored in the device exchange memory of the terminal device, the parameter information including at least one of the starting address, the destination address, the data size, and the check information, and acquires the target data from the host system through the target data transmission mode based on the parameter information.
[0090] In some embodiments, after reading the first identifier, the terminal device determines the target data transmission mode corresponding to the first identifier based on a preset association relationship, and further determines the read parameter information as the parameter information corresponding to the target data transmission mode.
[0091] In some embodiments, the starting address can be the address at which the target data is stored in the host processing unit, the destination address can be the address at which the target data needs to be written to the terminal device, the data size can be the size of the target data, the target data can exist in the form of a file, the data size is the file size, the check information can be check data or a check value, and the check information is related information for checking whether an error or loss occurs in the transmission process of the target data.
[0092] For example, after the CPU on the PCIe Device side polls the agreed value, it reads all the boot cmd (firmware download command) parameters and starts to execute the boot cmd (firmware download command).
[0093] In some embodiments, the terminal device obtains the target data from the host system through the target data transmission mode based on the parameter information. For example, when the host system indicates the batch transmission mode, the terminal device actively downloads the target data from the host system through the batch transmission mode. Or, when the host system indicates the distribution transmission mode, the terminal device passively receives the target data from the host system through the distribution transmission mode, i.e., the host system sends the target data to the terminal device in a manner so that the terminal device obtains the target data.
[0094] In some embodiments, the terminal device obtains the target data from the host system through the batch transmission mode can be that the terminal device runs the DMA controller, and moves the target data of the host system from the memory of the host system to the storage space of the terminal device through the DMA controller.
[0095] For example, the Host System sends the actively obtained command to the PCIe Device; the PCIe Device uses the DMA controller to move the firmware on the Host side from the DDR on the Host System side to the DDR / SRAM (Static RAM, Static Random Access Memory) on the PCIe Device side.
[0096] In some embodiments, the terminal device obtains the target data from the host system through the distribution transmission mode can be that the host system moves the target data from the memory of the host system to the storage space of the terminal device.
[0097] For example, the Host System side sends the passively obtained command to the PCIe Device side; the firmware is moved from the DDR on the Host System side to the DDR / SRAM on the PCIe Device side by the CPU on the Host side.
[0098] Step 105, the host system sends second information to the terminal device.
[0099] In some embodiments, the second information is used to indicate the transmission result of the target data.
[0100] In some embodiments, the host system judges whether the target data has been completely transmitted to the terminal device, and sends the second information to the terminal device to inform the terminal device whether the data transmission has been completed.
[0101] In some embodiments, under the batch transmission mode, when the terminal device has completed the transmission of the target data through the DMA controller, the host system can write the result of the completion of the transmission of the target data into the device exchange memory, so that the terminal device determines that the target data has been completely transmitted by polling the device exchange memory.
[0102] In some embodiments, in the distribution transmission mode, after the host system writes the target data into the storage space on the terminal device side, the host system can write the target data into the device exchange memory, so that the terminal device determines that the target data has been completely transmitted by polling the device exchange memory.
[0103] For example, in the non-DMA mode, after the CPU on the Host System side writes all the firmware into the PCIe Device side, the CPU writes the result into the register of the SWAP area.
[0104] In the above embodiments, if the terminal device does not receive the second information, it means that the host system has not completely transmitted the target data, and the terminal device cannot proceed to the next step and needs to wait for the host system to write the second information indicating that the target data has been completely transmitted into the device exchange memory before executing the subsequent steps.
[0105] Step 106, the terminal device performs integrity verification on the target data.
[0106] In some embodiments, the terminal device detects the device exchange memory according to a preset period, and in response to detecting that the second information indicates that the target data has been completely transmitted, performs integrity verification on the target data based on the verification information.
[0107] In some embodiments, after the host system detects that the target data has been completely transmitted, the host system informs the terminal device that the target data has been completely transmitted, and the terminal device can perform integrity verification on the target data based on the verification information in the parameter information to determine whether the target data is complete and accurate.
[0108] In some embodiments, in response to successful integrity verification of the target data, the target data is written into the persistent storage medium, and the state of the terminal device is switched to a state of running the target data.
[0109] In some embodiments, switching the state of the terminal device to a state of running the target data can be executing a program jump of the CPU of the terminal device to execute a program corresponding to the target data.
[0110] For example, after the CPU on the PCIe Device side polls the result of downloading the firmware, the CPU on the PCIe Device side executes a verification program. If the verification is correct, the CPU executes a program jump and starts executing the firmware program.
[0111] Step 107, the terminal device sends third information to the host system.
[0112] In some embodiments, the third information is used to indicate the result of the integrity verification.
[0113] In some embodiments, for the batch transmission mode and the distribution transmission mode, the terminal device informs the host system of the result of the integrity check by writing the result into the device exchange memory after performing the integrity check.
[0114] In some embodiments, the terminal device writes the third information into the device exchange memory to send the result of the integrity check to the host system.
[0115] For example, the CPU on the PCIe Device side performs the check procedure and writes the check result into the SWAP area register, and the Host System learns the result of the integrity check by polling the SWAP area register.
[0116] In some embodiments, in the distribution transmission mode, the terminal device performs the integrity check and, after the integrity check succeeds, writes third information into the device exchange memory, the third information indicating that the integrity check succeeds and disabling the address mapping relationship to protect the data in the storage space.
[0117] Step 108: The host system sends fourth information to the terminal device.
[0118] In some embodiments, the host system sends the fourth information to the terminal device in response to the third information indicating that the integrity check of the target data fails.
[0119] In some embodiments, the fourth information is used to update the data transmission mode, and the fourth information includes the second identifier and the parameter information corresponding to the second identifier.
[0120] In some embodiments, the host system can switch the command, i.e., update the data transmission mode of the terminal device, to make the terminal device acquire the target data through another data transmission mode, in the case that the integrity check fails after the terminal device downloads the target data through the target data transmission mode.
[0121] In the above embodiments, the host system can indicate the data transmission mode of the terminal device for acquiring the target data from the host system to the terminal device by sending the indication information, and update the indicated data transmission mode in the case that the terminal device fails to perform through one data transmission mode, so as to make the terminal device acquire the target data from the host system through another data transmission mode, thereby improving the success rate of downloading the target data, avoiding potential tape-out risks, and further, the data transmission mode proposed in the present application can be applied to the PCIe device with a DMA controller or the PCIe device without a DMA controller, thereby expanding the application range and improving the universality.
[0122] Figure 2 The flowchart of the batch transmission mode proposed for the embodiments of the present disclosure is based onFigure 1 The embodiment shown, as in step 104 of Figure 1 further illustrated, as shown in Figure 2 The method comprises the following steps:
[0123] Step 201, initialize the bulk transfer channel, write the start address and the destination address into the address register in the direct memory access (DMA).
[0124] In some embodiments, the bulk transfer channel can be a DMA channel, and the bulk transfer channel is used by the terminal device to transfer the target data stored in the host system to the terminal device through the channel.
[0125] In some embodiments, writing the start address and the destination address into the address register in the DMA can be writing the start address into the source address register in the DMA and writing the destination address into the destination address register in the DMA, so that the terminal device can obtain the target data according to the start address and the destination address.
[0126] For example, if the parameter of the boot cmd indicates that the firmware needs to be downloaded in DMA mode, the CPU on the PCIe Device side starts to initialize the DMA channel and writes the SAR on the Host System side and the destination address DAR of the firmware into the DMA.
[0127] Step 202, through the DMA, obtain the target data from the corresponding storage location in the host memory of the host system at the start address and write the target data into the corresponding storage location in the device memory of the terminal device at the destination address.
[0128] In some embodiments, the terminal device reads the target data from the host memory through the DMA controller according to the start address and the destination address, and writes the target data into the device memory, thereby actively obtaining the target data through bulk data transmission.
[0129] For example, the DMA controller is triggered to start transmitting the firmware, and the result of the polling of the DMA controller transmission is polled.
[0130] In some embodiments, after the terminal device obtains the target data through the DMA, the device exchange memory is polled to obtain the result of the data transmission through the DMA. Specifically, the host system will write a data transmission completion message into the device exchange memory after the target data transmission is completed, so that the terminal device receives the message and determines that the target data transmission is completed, thereby performing integrity verification of the target data, and after the integrity verification is successful, writing the target data into the persistent storage medium and switching the terminal device to a state of running the target data.
[0131] In the above embodiments, the terminal device actively acquires target data from the host system in a batch transmission manner according to the indication of the host system, so as to realize the download update of the target data.
[0132] Figure 3 The flowchart of the distribution transmission manner proposed in the embodiments of the present disclosure is based on Figure 1 The embodiment shown in FIG. 3 further illustrates step 104 in FIG. 1, as shown in Figure 1 The method shown in FIG. 3 includes the following steps: Figure 3
[0133] Step 301: Establishing the address mapping relationship between the device local address area and the PCI bus address space.
[0134] In some embodiments, when the terminal device is instructed by the host system to use the distribution transmission manner, the terminal device can establish the mapping relationship between the DAR on the terminal device side and the PCI bus address space, that is, one device local address in the device local address area and one PCI bus address in the PCI bus address space have a one-to-one correspondence.
[0135] In some embodiments, the device local address area can be a DAR address area, and the address mapping relationship can be the correspondence between the DAR and the DAR PCI.
[0136] For example, if the parameter of the boot cmd indicates that the firmware needs to be downloaded by the CPU mode (i.e., the non-DMA mode) of the Host System, the CPU on the PCIe Device side starts to initialize the ATU and make address mapping between the address DAR and the address space domain of the PCI.
[0137] In some embodiments, the terminal device establishes the address mapping relationship between the device local address area and the PCI bus address space, and after completing the address mapping, writes the completion message into the device exchange memory, so as to enable the host system to acquire the address mapping completion message by polling the device exchange memory.
[0138] In some embodiments, after the terminal device writes the address mapping completion message into the device exchange memory, it can wait for whether the host system writes the data transmission completion message into the device exchange memory, so as to determine whether to perform the integrity check.
[0139] For example, after the PCIe Device address mapping is completed, the mapping completion information is written into the register of the SWAP area; and polling the register of the SWAP area is started to wait for the result of the firmware download by the CPU of the Host System side.
[0140] At step 302, in response to the completion of the address mapping relationship establishment, the target data packet is obtained from the host system.
[0141] In some embodiments, the target data packet includes a PCI bus address and target data.
[0142] In some embodiments, after the terminal device completes the establishment of the address mapping relationship, the host system determines that the terminal device has completed the establishment of the address mapping relationship by polling the device swap memory, and thus sends the target data packet to the terminal device.
[0143] In some embodiments, the method further includes: determining, by the terminal device, a device local address corresponding to the PCI bus address based on the address mapping relationship; and writing the target data into a storage space corresponding to the device local address.
[0144] In some embodiments, the target data packet can be an MWr TLP, and the TLP includes the PCI bus address and the target data, wherein the PCI bus address can be a DAR PCI.
[0145] In some embodiments, based on the address mapping relationship, the terminal device can determine the device local address corresponding to the PCI bus address in the target data packet, and thus write the target data in the target data packet into the storage space corresponding to the device local address, to achieve the distributed transmission mode to obtain the target data.
[0146] For example, the CPU of the Host System side obtains the address mapping completion message by polling the SWAP register; and the CPU of the Host System side reads the data from the SAR of the Host System side and writes the data into the destination address DAR PCI of the firmware.
[0147] For example, after the PCIe Device side receives the MWr TLP, the address conversion is performed to write the data with the address DAR PCI in the TLP into the DAR; the MWr TLP includes the destination address DAR PCI and the corresponding data to be written, and the device side obtains the corresponding destination address DAR through the address conversion, to write the data to be written into the DAR.
[0148] In the above embodiment, the terminal device acquires the target data from the host system in a distributed transmission manner based on the indication of the host system, so as to successfully download the target data and complete the firmware download update in the case that the terminal device does not have a DMA controller or has a DMA controller but cannot normally operate.
[0149] In conclusion, the data transmission method provided by the present disclosure can be compatible with PCIe devices with or without DMA controllers, so that the host system can improve the success rate of the terminal device acquiring target data by updating the indicated data transmission manner, and avoid potential tape-out risks.
[0150] The following is a specific implementation of a data transmission method provided by the present disclosure:
[0151] As shown in the DMA manner diagram shown in Figure 4A When the PCIe Device has a dedicated DMA controller and the DMA controller can normally operate, enable the PCIe link and the DMA function at the bootrom code level of the PCIe Device; wait for the CPU on the Host System side to move the firmware from the file system to the DDR (Double Data Rate, double-speed memory) on the Host System side; the Host System sends an active acquisition command to the PCIe Device; the PCIe Device uses the DMA controller to move the firmware on the Host side from the DDR on the Host System side to the DDR / SRAM (Static RAM, static random access memory) on the PCIe Device side.
[0152] As shown in the non-DMA manner diagram shown in Figure 4B When the PCIe Device does not have a DMA controller or the DMA controller cannot normally operate, enable the PCIe link and the DMA function at the bootrom code program of the PCIe Device; wait for the CPU on the Host System side to move the firmware from the file system to the DDR on the Host System side; the Host System side sends a passive acquisition command to the PCIe Device side; the CPU on the PCIe Device side sets the PCIe controller and re-establishes the address mapping between the PCIe controller and the DDR, and notifies the CPU on the Host side after success; then wait for the CPU on the Host side to move the firmware from the DDR on the Host System side to the DDR / SRAM on the PCIe Device side.
[0153] AsFigure 4C The flow chart of the specific embodiment of the data transmission method shown includes the following steps:
[0154] The premise work, the Host System needs to read the firmware from the file system and write it to a certain starting address of the DDR (Double Data Rate) on the Host System side, assuming that this address is SAR. The firmware of the PCIe Device runs in a certain SRAM or DDR on the PCIe Device side. The firmware needs to know the link address when it is compiled, and this link address is assumed to be DAR.
[0155] 1. The PCIe Device is powered on to enter the Bootrom program, enters the PCIe download mode (default gen4) according to the strap pin; and the Host System successfully links up; initializes the mapping between the BAR (Base Address Register) and the doorbell and SWAP area register address space of the PCIe Device side;
[0156] 2. The CPU on the PCIe Device side polls the doorbell register to wait for the firmware download command.
[0157] 3. The CPU on the Host System side writes the boot cmd (download command) and the parameters required for the execution cmd (download) into the SWAP area register on the PCIe Device side through the PCI link; writes the signal triggering the execution of the boot cmd into the SWAP area register on the PCIe Device side.
[0158] 4. After the CPU on the PCIe Device side polls the agreed value, it reads all the boot cmd parameters and starts executing the boot cmd.
[0159] 5. If the parameters of the boot cmd indicate that the DMA mode is required to download the firmware, the CPU on the PCIe Device side starts to initialize the DMA channel, and writes the SAR of the firmware on the Host System side and the destination address DAR of the firmware into the DMA; triggers the DMA controller to start transmitting the firmware; polls the result of the DMA controller transmission.
[0160] 6. If the parameter of boot cmd indicates that the firmware needs to be downloaded in the CPU mode (i.e. non-DMA mode) of the Host System, the CPU on the PCIe Device side starts to initialize the ATU, and makes address mapping of the address DAR and the address space domain of the PCI;
[0161] 7. After the address mapping is completed, the information of the completed mapping is written into the register of the SWAP area, and the PCIe Device starts polling the register of the SWAP area, and waits for the result of the firmware downloaded by the CPU on the Host System side;
[0162] 8. The CPU on the Host System side acquires the message of the completed address mapping by polling the SWAP register, reads the data from the SAR on the Host System side, and writes the data into the destination address DAR_PCI of the firmware;
[0163] 9. After the PCIe on the PCIe Device side receives the MWr TLP, the address in the TLP is converted to DAR_PCI, and the data in the TLP is written into the DAR; the MWr TLP includes the destination address DAR_PCI and the corresponding data to be written, and the device side obtains the corresponding destination address DAR through address conversion, so as to write the data to be written into the DAR;
[0164] 10. After the CPU on the Host System side writes all the firmware into the PCIe Device side, the result is written into the register of the SWAP area;
[0165] 11. The CPU on the PCIe Device side polls the result of the downloaded firmware, and closes the mapping relationship of the ATU, and protects the data;
[0166] 12. The CPU on the PCIe Device side executes the verification program, and if the verification is correct, executes the CPU jump program, and starts to execute the firmware program.
[0167] In summary, the embodiment has the following beneficial effects:
[0168] 1. The backup scheme for downloading the firmware is added, and the potential risk of tape-out is reduced;
[0169] 2. The PCIe Device devices with DMA or without DMA can be compatible;
[0170] 3. The success rate of downloading the firmware is improved.
[0171] Figure 5 FIG. 1 is a schematic diagram of a data transmission device 500 according to an embodiment of the present disclosure. As shown in the figure, the device comprises a transceiver module 510 and a processing module 520. Figure 5
[0172] The transceiver module 510 is configured to receive first information, the first information being used to indicate a data transmission mode of a terminal device, the first information comprising a first identifier and parameter information corresponding to the first identifier, the data transmission mode comprising a batch transmission mode and a distributed transmission mode; and the processing module 520 is configured to acquire target data from a host system based on the first information.
[0173] In some embodiments, the transceiver module is further configured to determine a mapping relationship between a device exchange memory of the terminal device and a host processing unit of the host system according to a data transmission connection between the terminal device and the host system; detect the device exchange memory according to a preset period based on the mapping relationship, to determine a first storage location of the first identifier in the device exchange memory and a second storage location of the parameter information corresponding to the first identifier; read the first identifier from the first storage location and read the parameter information corresponding to the first identifier from the second storage location.
[0174] In some embodiments, the processing module is further configured to determine a target data transmission mode corresponding to the first identifier based on a preset association relationship, the target data transmission mode being the batch transmission mode or the distributed transmission mode; determine parameter information corresponding to the target data transmission mode stored in the device exchange memory of the terminal device, the parameter information comprising at least one of a start address, a destination address, a data size, and check information; and acquire the target data from the host system based on the parameter information through the target data transmission mode.
[0175] In some embodiments, the processing module is further configured to initialize a batch transmission channel, write the start address and the destination address into a source address register in a direct memory access (DMA), and acquire the target data from a storage location corresponding to the start address in a host memory of the host system through the DMA and write the target data into a storage location corresponding to the destination address in a device memory of the terminal device.
[0176] In some embodiments, the processing module is further configured to establish an address mapping relationship between a device local address area and a PCI bus address space, and acquire a target data packet from the host system in response to completion of establishment of the address mapping relationship, the target data packet comprising a PCI bus address and target data.
[0177] In some embodiments, the processing module is further configured to determine a device local address corresponding to the PCI bus address based on the address mapping relationship, and write the target data into a storage space corresponding to the device local address.
[0178] In some embodiments, the transceiving module is configured to receive second information, the second information being used to indicate a transmission result of the target data; the processing module is further configured to detect the device exchange memory according to a preset period, and in response to the second information indicating that the transmission of the target data is completed, perform integrity check on the target data based on the check information; and in response to the integrity check on the target data being successful, write the target data into the persistent storage medium, and switch the state of the terminal device to a state of running the target data.
[0179] In some embodiments, the transceiving module is further configured to send third information, the third information being used to indicate a result of the integrity check; and in response to the integrity check on the target data being failed, receive fourth information, the fourth information being used to update the data transmission mode, the fourth information including the second identifier and the parameter information corresponding to the second identifier.
[0180] In the above embodiments, the terminal device can obtain the target data from the host system according to the data transmission mode indicated by the host system, and the host system can dynamically update the indicated data transmission mode, thereby improving the success rate of the terminal device obtaining the target data, avoiding potential flow risk, expanding the application range of the data transmission mode, and applying the data transmission mode to both terminal devices with DMA controllers and terminal devices without DMA controllers.
[0181] Figure 6 FIG. 6 is a structural schematic diagram of a data transmission device 600 according to an embodiment of the present disclosure. As shown in FIG. 6, the device includes a transceiving module 610 and a processing module 620. Figure 6
[0182] The transceiving module is configured to send first information, the first information being used to indicate a data transmission mode of the terminal device, the first information including a first identifier and parameter information corresponding to the first identifier, the data transmission mode including a batch transmission mode and a distributed transmission mode, and the first information being used for the terminal device to obtain target data from the host system.
[0183] In some embodiments, the processing module is further configured to determine a mapping relationship between a host processing unit of the host system and a device exchange memory of the terminal device according to a data transmission connection between the host system and the terminal device.
[0184] In some embodiments, the transceiving module is further configured to migrate the target data from a file system to the host processing unit; determine a first identifier corresponding to a target data transmission mode based on a preset association relationship, the target data transmission mode being the batch transmission mode or the distributed transmission mode; and in response to the migration of the target data being completed, send the first information to the device exchange memory of the terminal device based on the mapping relationship.
[0185] In some embodiments, the transceiving module is further configured to send target data to the terminal device in response to the terminal device completing establishment of the address mapping relationship, the address mapping relationship indicating a relationship between a device local address region of the terminal device and a PCI bus address space.
[0186] In some embodiments, the transceiving module is further configured to send a target data packet to the terminal device, the target data packet including a PCI bus address and target data, the target data packet being used to write the target data to a storage space of a device local address corresponding to the PCI bus address based on the address mapping relationship.
[0187] In some embodiments, the transceiving module is further configured to send second information in response to completion of the target data transmission, the second information being used to indicate a transmission result of the target data.
[0188] In some embodiments, the transceiving module is further configured to receive third information, the third information being used to indicate a result of integrity verification of the terminal device; and send fourth information in response to the integrity verification of the target data failing, the fourth information being used to update a data transmission mode of the terminal device, the fourth information including the second identifier and parameter information corresponding to the second identifier.
[0189] In the above embodiments, the host system can indicate the terminal device to obtain a data transmission mode of target data by sending indication information to the terminal device, and update the indicated data transmission mode in the case of obtaining failure, thereby improving the success rate of the terminal device obtaining the target data and avoiding potential flow risk.
[0190] Figure 7 FIG. 7 is a structural schematic diagram of an electronic device 700 for implementing the above data transmission method according to an example embodiment.
[0191] Referring to Figure 7 , the electronic device 700 can include one or more of the following components: a processing component 702, a memory 704, a power supply component 706, a multimedia component 708, an audio component 710, an input / output (I / O) interface 712, a sensor component 714, and a communication component 716.
[0192] The processing component 702 usually controls overall operations of the electronic device 700, such as operations associated with displaying, making phone calls, data communications, camera operations, and recording operations. The processing component 702 can include one or more processors 720 to execute instructions to complete all or part of steps of the methods described above. Further, the processing component 702 can include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 can include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0193] Memory 704 is configured to store various types of data to support operations of electronic device 700. Examples of such data include instructions for any application or methods operating on electronic device 700, contact data, phonebook data, messages, pictures, videos, and the like. Memory 704 can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic storage, flash memory, magnetic or optical disks.
[0194] Power component 706 supplies electrical power for various components of electronic device 700. Power component 706 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing electrical power for electronic device 700.
[0195] Multimedia component 708 includes a screen providing an output interface between electronic device 700 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding movement, but also detect duration and pressure related to the touching or sliding operation. In some embodiments, multimedia component 708 includes a front camera and / or a back camera. The front and / or back camera can receive external multimedia data when electronic device 700 is in an operational mode, such as a photographing mode or a video mode. Each of the front and back camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0196] Audio component 710 is configured to output and / or input audio signals. For example, audio component 710 includes a microphone (MIC) configured to receive external audio signals when electronic device 700 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in memory 704 or transmitted via communication component 716. In some embodiments, audio component 710 also includes a speaker for outputting audio signals.
[0197] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, which can be a keypad, a click wheel, buttons, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0198] Sensor assembly 714 includes one or more sensors for providing state assessments of various aspects of electronic device 700. For example, sensor assembly 714 may detect the on / off state of electronic device 700, the relative positioning of components such as the display and keypad of electronic device 700, changes in position of electronic device 700 or a component of electronic device 700, the presence or absence of user contact with electronic device 700, orientation or acceleration / deceleration of electronic device 700, and temperature changes of electronic device 700. Sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 714 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0199] Communication component 716 is configured to facilitate wired or wireless communication between electronic device 700 and other devices. Electronic device 700 can access wireless networks based on communication standards, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio), or combinations thereof. In one exemplary embodiment, communication component 716 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 716 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0200] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0201] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, which can be executed by a processor 720 of an electronic device 700 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0202] Embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform the data transmission method described in the above embodiments of this disclosure.
[0203] Embodiments of this disclosure also provide a computer program product, including a computer program that is executed by a processor using the data transmission method described in the above embodiments of this disclosure.
[0204] Figure 8 This is a schematic diagram illustrating the structure of a chip 800 for implementing the above-described data transmission method according to an exemplary embodiment. (Refer to...) Figure 8 The chip 800 includes at least one communication interface 801 and a processor 802. The communication interface 801 is used to receive signals input to the chip 800 or signals output from the chip 800. The processor 802 communicates with the communication interface 801 and implements the data transmission method described in the above embodiments of this disclosure through logic circuits or executed code instructions.
[0205] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses, systems, and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0206] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0207] Any processes or methods described in the flowcharts or otherwise described herein can be understood as representing code modules, segments, or portions of code which include one or more executable instructions for implementing specific logic functions (or steps) of the processes. The various embodiments of the present disclosure can include additional or fewer steps or processes, and the order of the steps or processes can be altered, as will be appreciated by those skilled in the art, as the described embodiments of the present disclosure can be implemented in a variety of ways.
[0208] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be embodied in non-transitory computer-readable media, which can be executed by a processing module, or other device, to perform the functions or steps represented therein. The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a list of instructions to implement the logic functions represented therein, and the scope of the present disclosure encompasses additional implementations in which the functions are performed in a different order, or in substantially simultaneous fashion, or in reverse order, as will be appreciated by those skilled in the art, as the described embodiments of the present disclosure can be implemented in a variety of ways.
[0209] It is to be understood that the various parts of the embodiments of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above embodiments, the various steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, and in another embodiment, the hardware can be implemented with any or a combination of the following technologies, which are all well known in the art: a discrete logic circuit having logic gates for implementing logic functions upon an application of data signals; an application specific integrated circuit having appropriate combinational logic gates; a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0210] Those skilled in the art of the present technology can understand that all or part of the steps carried out by the above-mentioned embodiment method can be completed by a program instructing the relevant hardware, and the program can be stored in a computer readable storage medium. When the program is executed, it includes one of the steps of the method embodiment or a combination thereof.
[0211] In addition, each functional unit in various embodiments of the present disclosure can be integrated into one processing module, or each unit can exist physically independently, or two or more units can be integrated into one module. The integrated module can be realized in the form of hardware or in the form of a software functional module. If the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0212] Although the embodiments of the present disclosure have been shown and described above, it should be understood that the above-mentioned embodiments are exemplary and should not be construed as limiting the present disclosure, and those skilled in the art can make changes, modifications, replacements and variations to the above-mentioned embodiments within the scope of the present disclosure.
Claims
1. A data transmission method, characterized by, The method is executed by a terminal device, and the method comprises: receiving first information, the first information being used for indicating a data transmission mode of the terminal device, the first information comprising a first identifier and parameter information corresponding to the first identifier, the data transmission mode comprising a batch transmission mode and a distribution transmission mode, and the parameter information comprising at least one of a start address, a destination address, a data size, and check information; the receiving first information comprises: determining a mapping relationship between a device exchange memory of the terminal device and a host processing unit of a host system according to a data transmission connection between the terminal device and the host system; based on the mapping relationship, detecting the device exchange memory according to a preset period, determining a first storage location of the first identifier in the device exchange memory and a second storage location of the parameter information corresponding to the first identifier; reading the first identifier from the first storage location and reading the parameter information corresponding to the first identifier from the second storage location; based on the first information, obtaining target data from the host system, the target data being firmware; the distribution transmission mode passively receives target data sent by a CPU of the host system through an address mapping relationship between a device local address area and a PCI bus address space; the first information indicates that the data transmission mode of the terminal device is the batch transmission mode, and the obtaining the target data from the host system based on the parameter information comprises: initializing a batch transmission channel, and writing the start address and the destination address into a source address register in direct memory access (DMA); obtaining the target data from a corresponding storage location of the host memory of the host system through the DMA, and writing the target data into a corresponding storage location of the device memory of the terminal device.
2. The method of claim 1, wherein, the obtaining the target data from the host system based on the first information comprises: determining a target data transmission mode corresponding to the first identifier based on a preset association relationship, the target data transmission mode being the batch transmission mode or the distribution transmission mode; determining parameter information corresponding to the target data transmission mode stored in the device exchange memory of the terminal device; based on the parameter information, obtaining the target data from the host system through the target data transmission mode.
3. The method of claim 2, wherein, the target data transmission mode is the distribution transmission mode, and the obtaining the target data from the host system through the target data transmission mode based on the parameter information comprises: establishing an address mapping relationship between the device local address area and the PCI bus address space; in response to completion of establishment of the address mapping relationship, obtaining a target data packet from the host system, the target data packet comprising a PCI bus address and the target data.
4. The method of claim 3, wherein, the method further comprises: based on the address mapping relationship, determining a device local address corresponding to the PCI bus address; writing the target data into a storage space corresponding to the device local address.
5. The method of claim 4, wherein, the method further comprises: receiving second information, the second information being used to indicate a transmission result of the target data; detecting the device exchange memory according to the preset period, and performing integrity check on the target data based on the check information in response to detecting that the second information indicates that the transmission of the target data is completed; in response to the integrity check on the target data being successful, writing the target data into a persistent storage medium, and switching a state of the terminal device to a state of running the target data.
6. The method of claim 5, wherein, The method further includes: sending third information, the third information being used to indicate a result of the integrity check; in response to the integrity check on the target data failing, receiving fourth information, the fourth information being used to update the data transmission mode, and the fourth information including a second identifier and parameter information corresponding to the second identifier.
7. A data transmission method, characterized by, The method is performed by a host system, and the method includes: sending first information, the first information being used to indicate a data transmission mode of a terminal device, the first information including a first identifier and parameter information corresponding to the first identifier, the data transmission mode including a batch transmission mode and a distribution transmission mode, the first information being used for the terminal device to acquire target data from the host system, and the parameter information including at least one of a start address, a destination address, a data size, and check information, the target data being firmware; The method further includes determining a mapping relationship between a host processing unit of the host system and a device exchange memory of the terminal device according to a data transmission connection between the host system and the terminal device; The batch transmission mode is that the terminal device writes the start address and the destination address into a source address register in a direct memory access (DMA), and acquires the target data from a corresponding storage location of the host memory of the host system through the DMA, and writes the target data into a corresponding storage location of a device memory of the terminal device through the destination address; The first information indicates that the data transmission mode of the terminal device is the distribution transmission mode, and the method further includes sending the target data to the terminal device in response to the terminal device completing establishment of an address mapping relationship, the address mapping relationship representing a relationship between a device local address region of the terminal device and a PCI bus address space.
8. The method of claim 7, wherein, The sending of the first information includes: migrating the target data from a file system to the host processing unit; determining the first identifier corresponding to a target data transmission mode based on a preset association relationship, the target data transmission mode being the batch transmission mode or the distribution transmission mode; in response to the target data migration being completed, sending the first information to the device exchange memory of the terminal device based on the mapping relationship.
9. The method of claim 7, wherein, The sending of the target data to the terminal device includes: sending a target data packet to the terminal device, the target data packet comprising a PCI bus address and the target data, the target data packet being used for the terminal device to write the target data into a storage space of a device local address corresponding to the PCI bus address based on the address mapping relationship.
10. The method of claim 9, wherein, The method further comprises: in response to completion of the target data transmission, sending second information, the second information being used for indicating a transmission result of the target data.
11. The method of claim 7, wherein, The method further comprises: receiving third information, the third information being used for indicating a result of integrity check of the terminal device; in response to failure of the integrity check of the target data, sending fourth information, the fourth information being used for updating a data transmission mode of the terminal device, the fourth information comprising a second identifier and parameter information corresponding to the second identifier.
12. A data transmission apparatus, characterized by comprising: The apparatus comprises a transceiving module and a processing module, the transceiving module is configured to receive first information, the first information being used for indicating a data transmission mode of a terminal device, the first information comprising a first identifier and parameter information corresponding to the first identifier, the data transmission mode comprising a batch transmission mode and a distribution transmission mode, the parameter information comprising at least one of a start address, a destination address, a data size, and check information, the distribution transmission mode being used for passively receiving target data sent by a host system CPU based on an address mapping relationship between a device local address region and a PCI bus address space; the transceiving module is configured to determine a mapping relationship between a device exchange memory of the terminal device and a host processing unit of the host system based on a data transmission connection between the terminal device and the host system; based on the mapping relationship, the transceiving module is configured to detect the device exchange memory according to a preset period, to determine a first storage location of the first identifier in the device exchange memory and a second storage location of the parameter information corresponding to the first identifier; the transceiving module is configured to read the first identifier from the first storage location and the parameter information corresponding to the first identifier from the second storage location; the processing module is configured to acquire target data from the host system based on the first information, the target data being firmware; when the first information indicates that the data transmission mode of the terminal device is the batch transmission mode, the processing module is configured to initialize a batch transmission channel, to write the start address and the destination address into a source address register in a direct memory access (DMA), and to acquire the target data from a storage location corresponding to the start address in a host memory of the host system through the DMA and write the target data into a storage location corresponding to the destination address in a device memory of the terminal device.
13. The data transmission apparatus of claim 12, wherein, the processing module is configured to: based on a preset association relationship, determine a target data transmission mode corresponding to the first identifier, the target data transmission mode being the batch transmission mode or the distribution transmission mode; determine parameter information corresponding to the target data transmission mode stored in a device exchange memory of the terminal device; based on the parameter information, acquire the target data from the host system through the target data transmission mode.
14. The data transmission apparatus according to claim 13, wherein, The processing module is configured to: establish an address mapping relationship between the device local address region and the PCI bus address space; in response to the address mapping relationship being established, obtain a target data packet from the host system, the target data packet comprising a PCI bus address and the target data.
15. A data transmission apparatus, characterized by comprising: The device comprises a transceiver module and a processing module, The transceiver module is configured to send first information, the first information being used to indicate a data transmission mode of a terminal device, the first information comprising a first identifier and parameter information corresponding to the first identifier, the data transmission mode comprising a batch transmission mode and a distributed transmission mode, the first information being used for the terminal device to obtain target data from a host system, and the parameter information comprising at least one of a start address, a destination address, a data size, and check information, the target data being firmware; The processing module is configured to determine a mapping relationship between a host processing unit of the host system and a device exchange memory of the terminal device according to a data transmission connection between the terminal device and the host system; The batch transmission mode comprises the terminal device writing the start address and the destination address into a source address register in a direct memory access (DMA), and obtaining the target data from a corresponding storage location of a host memory of the host system via the DMA, and writing the target data into a corresponding storage location of a device memory of the terminal device via the destination address; The first information indicates that the data transmission mode of the terminal device is the distributed transmission mode, and the transceiver module is further configured to, in response to the terminal device completing establishment of an address mapping relationship, send the target data to the terminal device, the address mapping relationship representing a relationship between a device local address region of the terminal device and a PCI bus address space.
16. The data transmission apparatus of claim 15, wherein The processing module is configured to: migrate the target data from a file system to the host processing unit; determine the first identifier corresponding to a target data transmission mode based on a preset association relationship, the target data transmission mode being the batch transmission mode or the distributed transmission mode; in response to the target data being migrated, send the first information to a device exchange memory of the terminal device based on the mapping relationship.
17. The data transmission apparatus of claim 16, wherein The transceiver module is configured to: send a target data packet to the terminal device, the target data packet comprising a PCI bus address and the target data, the target data packet being used for the terminal device to write the target data into a storage space of a device local address corresponding to the PCI bus address based on the address mapping relationship.
18. An electronic device, comprising: comprise: a processor and a memory for storing a computer program capable of running on the processor, wherein the processor is configured to execute the computer program, and perform the method of any one of claims 1 to 6 or 7 to 11.
19. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to cause the computer to perform the method of any one of claims 1 to 6 or 7 to 11.
20. A program product, characterized by comprise computer instructions for causing a computer to perform the method of any one of claims 1 to 6 or 7 to 11.
21. A chip, characterized by comprising at least one processor and a communication interface; the communication interface is used to receive a signal inputted into the chip or outputted from the chip, the processor is in communication with the communication interface and realizes the method as claimed in any one of claims 1 to 6 or 7 to 11 through logic circuit or executing code instruction.
Citation Information
Patent Citations
Cross-PCIe domain data transmission method and device, equipment and medium
CN120234267A
Methods and apparatus for DMA engine descriptors for high speed data systems
US20210124706A1