Data transmission method, system and device, electronic equipment and medium
Two-way data transmission between the application and the data processing chip is carried out through the serial peripheral interface (SPI), which solves the problem of low data transmission efficiency between the application and the additional chip, realizes efficient data interaction, and improves the operation of the application efficiency.
Patent Information
- Application Number
- CN202411294376.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-31
AI Technical Summary
The data transmission efficiency between the application and the attached chip is low, which affects the operation efficiency of the application.
Data transmission is carried out through the serial peripheral interface (SPI), and its full duplex feature is used to realize fast two-way data interaction between the application program and the data processing chip.
It improves the data transmission efficiency between the application processor and the data processing chip, makes full use of the characteristics of the serial peripheral interface, and improves the operation efficiency of the application.
Smart Images

Figure CN119226210A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a data transmission method, system, device, electronic device and medium. Background Art
[0002] At present, the usage rate of various applications in daily life is increasing, and the functions of applications are becoming more and more diverse. In order to reduce the burden of the processor and reduce costs, some applications (such as image applications) often attach separate chips (Integrated Circuit, IC) to perform some data processing operations.
[0003] During the operation of such applications, the application processor (AP) used to run the application needs to exchange a large amount of data with the application attached chip, so the data transmission efficiency between the AP and the application attached chip will greatly affect the operation efficiency of the application. Therefore, how to improve the data transmission efficiency between the AP used to run the application and the application attached chip has become an urgent problem to be solved. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a data transmission method, system, device, electronic device and medium to solve the problem of how to improve the data transmission efficiency between an AP for running an application and an application attached chip.
[0005] In a first aspect, an embodiment of the present application provides a data transmission method, including:
[0006] Get the first data of the application;
[0007] Transmitting the first data to a data processing chip via a serial peripheral interface;
[0008] And, obtaining the second data sent by the data processing chip through the serial peripheral interface.
[0009] In a second aspect, an embodiment of the present application provides a data transmission system, the system comprising an application layer, a core layer and a hardware layer; the hardware layer comprises a data processing chip;
[0010] The core layer is connected to the hardware layer via a serial peripheral interface;
[0011] The application layer is used to send the first data of the application program to the core layer;
[0012] The core layer is used to obtain the first data of the application layer, and transmit the first data to the data processing chip through the serial peripheral interface;
[0013] The data processing chip is used to process the first data and generate second data; and send the second data through the serial peripheral interface;
[0014] The core layer is used to receive the second data through the serial peripheral interface and transmit the second data to the application layer.
[0015] In a third aspect, an embodiment of the present application provides a data transmission device, the device comprising:
[0016] A first module is used to obtain first data of an application program;
[0017] A first transmission module, used for transmitting the first data to a data processing chip through a serial peripheral interface;
[0018] And, a second acquisition module is used to acquire second data sent by the data processing chip through the serial peripheral interface.
[0019] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the data transmission method described in the first aspect are implemented.
[0020] In a fifth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the data transmission method described in the first aspect are implemented.
[0021] In a sixth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0022] In a seventh aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0023] The data transmission method provided in the embodiment of the present application obtains the first data of the application program; transmits the first data to the data processing chip through the serial peripheral interface; and obtains the second data sent by the data processing chip through the serial peripheral interface. In this way, the first data of the application program is transmitted to the data processing chip through the serial peripheral interface, and at the same time, the second data sent by the data processing chip is received through the serial peripheral interface, which can make full use of the full-duplex characteristics of the serial peripheral interface and improve the data transmission efficiency between the data processing chip and the application processor used to run the application program. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flowchart of a data transmission method provided by an embodiment of the present application;
[0025] Figure 2 is a schematic diagram of a camera system in the related art;
[0026] Figure 3 is a schematic diagram of another camera system provided in an embodiment of the present application;
[0027] Figure 4 It is a schematic diagram of a data transmission process provided by an embodiment of the present application;
[0028] Figure 5 It is a structural diagram of a data transmission system provided in an embodiment of the present application;
[0029] Figure 6 It is a structural schematic diagram of a data transmission device provided in an embodiment of the present application;
[0030] Figure 7 is a structural diagram of an electronic device provided in an embodiment of the present application;
[0031] Figure 8 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0033] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0034] The technical solution provided by the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0035] Figure 1 is a flowchart of a data transmission method provided by an embodiment of the present application, such as Figure 1 As shown, the method may include the following steps:
[0036] Step 101: Obtain first data of an application.
[0037] Step 102: Transmit the first data to a data processing chip via a serial peripheral interface.
[0038] And, step 103, obtaining the second data sent by the data processing chip through the serial peripheral interface.
[0039] The embodiments of the present application can be applied to any electronic device, for example, a mobile phone, a tablet or a computer. The above application can be an application that has a need to interact with a data processing chip, and accordingly, the above data processing chip refers to a chip attached to the application that performs data processing operations. In one case, the above application can be a camera, and accordingly, the above data processing chip can be a chip for image processing.
[0040] Among them, the above-mentioned first data may be sent by an AP used to run an application, and refers to data that the application needs to make the data processing chip process. In one case, when the application is a camera, in the multi-camera consistency (Spatial Alignment Transform, SAT) scenario, the above-mentioned first data may be configuration data such as the zoom ratio (Zoom Ratio) of each frame image, the set sensor flag (Fallback Sensor Flag), and of course, the collected image data, which can be specifically set according to the data processing requirements of the application and the data processing chip.
[0041] Furthermore, the embodiments of the present application can be applied to the kernel space of an electronic device, and the application program often runs in the user space, so that the embodiments of the present application can obtain the first data of the application program through the pre-registered user space and kernel space data interaction interface. Exemplarily, taking the application program as a camera as an example, the data interaction interface between the user space and the kernel space can be a camera serial peripheral interface (cam_spi_inf).
[0042] The above-mentioned serial peripheral interface (Serial Peripheral Interface, SPI) is a synchronous serial peripheral interface, which is a high-speed, full-duplex interface that can achieve fast two-way communication. Specifically, the embodiment of the present application can drive the SPI through a serial peripheral interface driver (Serial Peripheral Interface core, SPI core), transmit the first data to the data processing chip through the SPI, so that the data processing chip obtains the first data through the SPI.
[0043] At the same time, in the embodiment of the present application, the second data sent by the data processing chip can also be received through the serial peripheral interface. The second data can be data processed by the data processing chip. For example, taking the application as a camera, the second data can be data such as grid data (Grid) corresponding to the current image, crop window (Crop) and selected sensor identification (Select Sensor Id).
[0044] For example, the embodiment of the present application takes a camera as an example. Figure 2 is a schematic diagram of a camera system in the related art, such as Figure 2 As shown, in the related art, there are usually two interfaces for communication between the sensor and the AP. The sensor sends image data to the AP through the image path (Image Path) formed by the camera serial interface (CSI) in the mobile industry processor interface (MIPI), and the AP controls the sensor (reads and writes the sensor) through the control path (Ctrl Path) formed by the integrated circuit bus (Inter-Integrated Circuit, IIC), where CSI is a unidirectional interface and IIC is a low-speed interface. If there is a scenario with a separately attached chip, the data exchange efficiency using CSI and IIC is low due to the large amount of communication data between the AP and the IC and the need for two-way communication.
[0045] On this basis, the embodiment of the present application adopts the SPI interface to realize data transmission between AP and IC. Figure 3 is a schematic diagram of another camera system provided in an embodiment of the present application, such as Figure 3 As shown, SPI is used to form a control path between IC and AP, so that the sensor control data between IC and AP can be transmitted through the SPI interface, and the full-duplex feature of SPI can be used to achieve efficient data transmission.
[0046] In summary, the data transmission method provided in the embodiment of the present application obtains the first data of the application; transmits the first data to the data processing chip through the serial peripheral interface; and obtains the second data sent by the data processing chip through the serial peripheral interface. In this way, the first data of the application is transmitted to the data processing chip through the serial peripheral interface, and at the same time, the second data sent by the data processing chip is received through the serial peripheral interface, which can make full use of the full-duplex characteristics of the serial peripheral interface and improve the data transmission efficiency between the data processing chip and the application processor used to run the application.
[0047] Optionally, the operation of transmitting the first data to the data processing chip through the serial peripheral interface may include the following steps in the embodiment of the present application:
[0048] Step 201: Encapsulate the first data into a first data packet based on a communication protocol;
[0049] Step 202: Transmit the first data packet to a data processing chip via a serial peripheral interface; the data processing chip is used to receive the first data packet via the serial peripheral interface, and parse the first data packet based on the communication protocol to obtain the first data.
[0050] The communication protocol may be pre-set, and may include data transmission rules, such as adding a header, a tail, and adding a check value, such as a cyclic redundancy check value (CRC), etc. Specifically, the communication protocol may be stored in a stack to form a protocol stack, and the step 201 may encapsulate the first data into a first data packet that can be parsed by a data processing chip by calling the protocol stack.
[0051] Specifically, since there is data interaction between the application program and the data processing chip, in order to ensure the accuracy and security of data transmission between the two, a communication protocol can be predefined for the data interaction between the two.
[0052] Furthermore, after the first data is encapsulated into a first data packet based on the communication protocol, the first data packet is transmitted to the data processing chip through the serial peripheral interface SPI. Accordingly, after the data processing chip receives the first data packet through the serial peripheral interface, the data processing chip can parse the first data packet through the above communication protocol to obtain the first data.
[0053] In an embodiment of the present application, the first data is encapsulated into a first data packet based on a communication protocol; the first data packet is transmitted to a data processing chip through a serial peripheral interface; the data processing chip is used to receive the first data packet through the serial peripheral interface, and parse the first data packet based on the communication protocol to obtain the first data. In this way, the first data is encapsulated and parsed in sequence through the communication protocol, which can ensure the accuracy and security of data transmission. At the same time, by setting a communication protocol, the embodiment of the present application can be applied to different applications and data processing chips, thereby improving the scalability and portability of data transmission.
[0054] Optionally, the data processing chip outputs an indication signal before sending the second data. The operation of acquiring the second data sent by the data processing chip through the serial peripheral interface may specifically include the following steps in this embodiment of the application:
[0055] Step 301: upon receiving the indication signal, obtaining second data sent by the data processing chip through the serial peripheral interface.
[0056] Among them, the above-mentioned indication signal can be a high-level signal or a low-level signal, which can be set according to actual needs, and the embodiment of the present application does not limit this. Specifically, the data processing chip can output the indication signal through a general-purpose input / output interface (GPIO) before sending the second data. Accordingly, the embodiment of the present application can receive the indication signal output by the data processing chip through the GPIO.
[0057] Optionally, the embodiment of the present application can also create a listening thread, which can monitor the GPIO interface, and when the indication signal is monitored, it is determined that the data processing chip has the second data to be sent, and the second data sent by the data processing chip can be obtained through the serial peripheral interface. Optionally, the above-mentioned listening thread can be created in the kernel space, or it can also be created in the user space, and the embodiment of the present application does not limit this. In one case, after the listening thread is created in the user space, the listening thread can be registered to the kernel space through the instance registration interface (event callback interface, event_cb_inf) of the kernel space, so that the kernel space can call the listening thread to monitor the GPIO in real time.
[0058] In the embodiment of the present application, the data processing chip outputs an indication signal before sending the second data, and the second data sent by the data processing chip is obtained through the serial peripheral interface when the indication signal is received. In this way, by setting the indication signal and performing the second data acquisition operation when the indication signal is received, unnecessary data acquisition operations can be avoided, and resource utilization can be improved to a certain extent.
[0059] Optionally, the second data is obtained after the data processing chip is encapsulated based on the communication protocol. After the above operation of obtaining the second data sent by the data processing chip through the serial peripheral interface, the embodiment of the present application may further include the following steps:
[0060] Step 401: parsing the second data based on the communication protocol to obtain third data;
[0061] Step 402: Transmit the third data to the application.
[0062] The communication protocol may be set by itself, and may include data transmission rules, such as adding a packet header, a packet tail, and adding a check value, such as a cyclic redundancy check value (CRC) and other rules. Specifically, the communication protocol may be stored in a stack to form a protocol stack, and the step 401 may parse the second data by calling the protocol stack to obtain the third data. Accordingly, the second data is obtained by encapsulating the third data by the data processing chip based on the communication protocol.
[0063] Furthermore, the third data obtained by parsing can be transmitted to the application program. Specifically, when the embodiment of the present application is applied to the kernel space, the third data can be transmitted to the application program in the user space through the data interaction interface between the kernel space and the user space.
[0064] In the embodiment of the present application, the second data is obtained after the data processing chip is encapsulated based on the communication protocol, and the third data is obtained by parsing the second data based on the communication protocol; the third data is transmitted to the application. In this way, in the case where the second data is obtained after being encapsulated based on the communication protocol, after obtaining the second data sent by the data processing chip, the embodiment of the present application can parse the second data again based on the communication protocol, and transmit the parsed third data to the application, so that the accuracy of data transmission can be further guaranteed while ensuring data security.
[0065] Optionally, the operation of obtaining the first data of the application program in the embodiment of the present application may further include the following steps:
[0066] Step 501: Create a first thread in response to a startup operation of the application.
[0067] Step 502: Call the first thread to obtain first data of the application.
[0068] Among them, the above creation operation can be implemented through a thread pool, or can also be implemented by inheriting the Thread class, and the embodiments of the present application do not limit this. Furthermore, after the application is started, the application is often run by the main thread. In order to avoid the impact of data transmission on the normal operation of the application, the embodiments of the present application can create a first thread, and receive the first data through the first thread, so that the data transmission is independent of the operation of the application.
[0069] Optionally, before obtaining the first data of the application, the embodiment of the present application may further include the following steps:
[0070] Step 601: Create a second thread.
[0071] The above operation of parsing the second data based on the communication protocol to obtain the third data may specifically include: step 602, calling the second thread to parse the second data based on the communication protocol to obtain the third data.
[0072] The second thread may be created when the application is started, or may be created in advance, and the present embodiment does not limit this. Further, the present embodiment may parse the second data through the created second thread.
[0073] In the embodiment of the present application, a second thread is created and the second thread is called to parse the second data based on the communication protocol to obtain the third data. In this way, the parsing operation can be independent of the operation of the application, and to a certain extent, the parsing operation can be prevented from affecting the normal operation of the application.
[0074] Optionally, the embodiment of the present application may further include the following steps:
[0075] Step 701: When a data read request is received from the application, the data read request is sent to the data processing chip through the serial peripheral interface; when the data processing chip receives the data read request through the serial peripheral interface, the fourth data indicated by the data read request is written to the cache address indicated by the data read request.
[0076] Step 702: Obtain the fourth data from the cache address indicated by the data read request, and send the fourth data to the application.
[0077] The data read request may be sent by an application according to actual needs, and the data read request may include information such as the requested data size, data format, data cache address, data type, etc. Accordingly, when the data processing chip receives the data read request through the serial peripheral interface, the fourth data indicated by the request may be written into the cache address (Buffer) indicated by the chip.
[0078] Furthermore, the corresponding fourth data may be read from the cache address.
[0079] Optionally, the fourth data may be obtained by the data processing chip after encapsulation based on the communication protocol. Accordingly, after obtaining the fourth data from the indicated cache address, the fourth data may be parsed based on the communication protocol to obtain the fifth data, and then the fifth data may be sent to the application.
[0080] In the embodiment of the present application, when receiving the data read request sent by the application, the data read request is sent to the data processing chip through the serial peripheral interface; when the data processing chip receives the data read request through the serial peripheral interface, the fourth data indicated by the data read request is written to the cache address indicated by the data read request; the fourth data is obtained from the cache address indicated by the data read request, and the fourth data is sent to the application. In this way, the application can actively obtain data from the data processing chip through the serial peripheral interface through the data read request, thereby realizing real-time interaction between the application and the data processing chip.
[0081] For example, in the embodiment of the present application, the application is a camera, and the data processing chip is an image processing chip. Figure 4 is a schematic diagram of a data transmission process provided by an embodiment of the present application, such as Figure 4 As shown in the figure, the camera runs in the user space. The camera hardware abstraction layer (Camera Hal) in the user space includes the camera main thread (Camera main thread), the listening thread (SPI Handle thread), and the threads for sending and reading data. The core layer in the kernel space includes the SPI protocol stack, the SPI data sending and receiving thread, the SPI data parsing thread, and the SPI core. It also includes the instance registration interface event_cb_inf and the data interaction interface cam_spi_inf between the kernel space and the user space. Among them, HardWare refers to the hardware layer, which includes IC, GPIO, and SPI.
[0082] Specifically, the SPI protocol stack is used to store the communication protocol, the SPI data sending and receiving thread corresponds to the first thread, and the SPI data parsing thread corresponds to the second thread.
[0083] Specifically, the listening thread is registered to the core layer through event_cb_inf, so that the core layer can call the listening thread to listen to the output signal of GPIO. Correspondingly, when IC wants to actively send data to AP, IC will first send an indication signal through GPIO. When SPI Core calls the listening thread to listen to the indication signal, it determines that IC has the second data to be sent. Furthermore, the SPI data receiving and sending thread reads the second data of IC through SPI, and then the SPI data parsing thread parses the third data sent by IC according to the SPI protocol stack. Furthermore, the core layer sends the parsed data to Camera Hal through the event_cb_inf interface.
[0084] Alternatively, if Figure 4 Taking the paths ①, ②, and ③ in the example, Camera Hal can send the first data to the SPI data transceiver thread of the core layer through cam_spi_inf. Correspondingly, the SPI data transceiver thread encapsulates the first data through the SPI protocol stack (for example, adding a header, CRC check value, etc.). Then the SPI data transceiver thread sends the encapsulated data to the IC through the SPI Core.
[0085] At the same time, since SPI is a full-duplex bus, when AP sends data to IC, if IC also has second data, it will also read the corresponding amount of second data from IC. Furthermore, the SPI data transceiver thread will first send the data read from IC to the SPI data parsing thread, which will parse the third data read from IC according to the SPI protocol stack. Finally, the third data is transmitted to Camera Hal through the event_cb_inf interface.
[0086] Alternatively, if Figure 4 Taking the paths ①, ②, ③, ④, and ⑤ in the example, Camera Hal can also send the data read request to the SPI data transceiver thread of the core layer through cam_spi_inf. Furthermore, the SPI data transceiver thread completes the encapsulation of the data read request through the SPI protocol stack (for example: adding a packet header, CRC check value, etc.). Then the SPI data transceiver thread sends the encapsulated data read request to the IC through the SPI Core. Furthermore, after the IC receives the data read request from the AP, it will fill the corresponding data into the buffer area and wait for the AP to read.
[0087] Alternatively, if Figure 4 Taking the paths ⑥, ⑦, ③, ④, and ⑨ in the example, the IC can also send an indication signal to the core layer through GPIO before sending the second data. When the core layer receives the indication signal, it calls the SPI data transceiver thread to read the second data that the IC needs to send through SPI. Furthermore, the SPI data parsing thread can be called to parse the second data to obtain the third data, and the third data can be transmitted to the Camera Hal.
[0088] Optionally, the SPI data transceiver thread on the AP side can always read data from the data processing chip, and also send the data read from the data processing chip to the SPI data parsing thread, which parses the data read from the data processing chip according to the SPI protocol stack, and finally sends the parsed data to the Camera Hal through the event_cb_inf interface.
[0089] In summary, the data transmission method provided in the embodiments of the present application can realize bidirectional and fast data transmission interaction between the AP and the data processing chip.
[0090] Figure 5 is a structural diagram of a data transmission system provided in an embodiment of the present application, such as Figure 5 As shown, the system 80 includes an application layer 801, a core layer 802 and a hardware layer 803; the hardware layer 803 includes a data processing chip 8031;
[0091] The core layer 802 is connected to the hardware layer 803 via a serial peripheral interface;
[0092] The application layer 801 is used to send the first data of the application program to the core layer;
[0093] The core layer 802 is used to obtain the first data of the application layer, and transmit the first data to the data processing chip through the serial peripheral interface;
[0094] The data processing chip 8031 is used to process the first data and generate second data; and send the second data through the serial peripheral interface;
[0095] The core layer 802 is configured to receive the second data through the serial peripheral interface and transmit the second data to the application layer.
[0096] Optionally, the core layer includes a protocol stack for storing a communication protocol, and the core layer is specifically used for:
[0097] Based on the communication protocol, encapsulating the first data into a first data packet, and transmitting the first data packet to the data processing chip through the serial peripheral interface;
[0098] The data processing chip is specifically used to: receive the first data packet through the serial peripheral interface, and parse the first data packet based on the communication protocol to obtain the first data.
[0099] Optionally, the hardware layer further includes a general input and output interface, and the general input and output interface is connected to the core layer;
[0100] The data processing chip is further used for: before sending the second data through the serial peripheral interface, outputting an indication signal through the universal input and output interface;
[0101] The core layer is specifically configured to: upon receiving the indication signal, receive the second data through the serial peripheral interface, and transmit the second data to the application layer.
[0102] Optionally, the data processing chip is specifically used to: perform data processing on the first data to obtain third data, and encapsulate the third data based on a communication protocol to obtain the second data;
[0103] The core layer is specifically used to: parse the second data based on the communication protocol to obtain third data, and transmit the third data to the application layer.
[0104] Optionally, the core layer is specifically used for:
[0105] In response to a start operation of the application, creating a first thread;
[0106] The first thread is called to obtain first data of the application layer.
[0107] Optionally, the core layer is specifically used for:
[0108] Before acquiring the first data of the application layer, creating a second thread;
[0109] The second thread is called to parse the second data based on the communication protocol to obtain third data.
[0110] Optionally, the application layer is further used to: send a data read request of the application to the core layer;
[0111] The core layer is further configured to: upon receiving the data read request, send the data read request through the serial peripheral interface;
[0112] The data processing chip is further used for: when receiving the data read request through the serial peripheral interface, writing the fourth data indicated by the data read request into the cache address indicated by the data read request;
[0113] The core layer is further configured to obtain the fourth data from the cache address indicated by the data read request, and transmit the fourth data to the application layer.
[0114] In summary, the data transmission system provided in the embodiment of the present application obtains the first data of the application program; transmits the first data to the data processing chip through the serial peripheral interface; and obtains the second data sent by the data processing chip through the serial peripheral interface. In this way, the first data of the application program is transmitted to the data processing chip through the serial peripheral interface, and at the same time, the second data sent by the data processing chip is received through the serial peripheral interface, which can make full use of the full-duplex characteristics of the serial peripheral interface and improve the data transmission efficiency between the data processing chip and the application processor used to run the application program.
[0115] Figure 6 is a structural diagram of a data transmission device provided in an embodiment of the present application, such as Figure 6 As shown, the device 90 comprises:
[0116] A first acquisition module 901, used to acquire first data of an application program;
[0117] A first transmission module 902, configured to transmit the first data to a data processing chip via a serial peripheral interface;
[0118] And, a second acquisition module 903 is used to acquire second data sent by the data processing chip through the serial peripheral interface.
[0119] Optionally, the first transmission module includes:
[0120] A first encapsulation submodule, configured to encapsulate the first data into a first data packet based on a communication protocol;
[0121] The second transmission submodule is used to transmit the first data packet to the data processing chip through the serial peripheral interface; the data processing chip is used to receive the first data packet through the serial peripheral interface, and parse the first data packet based on the communication protocol to obtain the first data.
[0122] Optionally, before sending the second data, the data processing chip outputs an indication signal, and the second acquisition module is specifically configured to:
[0123] When the indication signal is received, the second data sent by the data processing chip is acquired through the serial peripheral interface.
[0124] Optionally, the second data is obtained after the data processing chip is encapsulated based on a communication protocol, and the device further includes:
[0125] A parsing module, used for parsing the second data based on the communication protocol to obtain third data;
[0126] A third transmission module is used to transmit the third data to the application.
[0127] Optionally, the first acquisition module includes:
[0128] A first creation submodule, configured to create a first thread in response to a startup operation of the application program;
[0129] A calling submodule is used to call the first thread to obtain the first data of the application.
[0130] Optionally, the device 80 further includes:
[0131] A second creation module, used for creating a second thread;
[0132] The parsing module is specifically used to: call the second thread to parse the second data based on the communication protocol to obtain third data.
[0133] Optionally, the device further comprises:
[0134] a first sending module, configured to, upon receiving a data read request sent by the application, send the data read request to the data processing chip through the serial peripheral interface; upon receiving the data read request through the serial peripheral interface, the data processing chip writes the fourth data indicated by the data read request to the cache address indicated by the data read request;
[0135] The second sending module is used to obtain the fourth data from the cache address indicated by the data read request, and send the fourth data to the application.
[0136] In summary, the data transmission device provided in the embodiment of the present application obtains the first data of the application program; transmits the first data to the data processing chip through the serial peripheral interface; and obtains the second data sent by the data processing chip through the serial peripheral interface. In this way, the first data of the application program is transmitted to the data processing chip through the serial peripheral interface, and at the same time, the second data sent by the data processing chip is received through the serial peripheral interface, which can make full use of the full-duplex characteristics of the serial peripheral interface and improve the data transmission efficiency between the data processing chip and the application processor used to run the application program.
[0137] The data transmission device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0138] The data transmission device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0139] The data transmission device provided in the embodiment of the present application can achieve Figure 1 The process of implementing the method embodiment is not described here to avoid repetition.
[0140] Alternatively, if Figure 7 As shown, the embodiment of the present application further provides an electronic device 1500, including a processor 15001 and a memory 15002, wherein the memory 15002 stores a program or instruction that can be run on the processor 15001, and the program or instruction implements the steps of the method of the above embodiment when executed by the processor 15001. And the same technical effect can be achieved, so it will not be repeated here to avoid repetition.
[0141] It should be noted that the electronic devices in the embodiments of the present application include mobile electronic devices and non-mobile electronic devices.
[0142] Figure 8 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0143] The electronic device 1600 includes but is not limited to: a radio frequency unit 1601, a network module 1602, an audio output unit 1603, an input unit 1604, a sensor 1605, a display unit 1606, a user input unit 1607, an interface unit 1608, a memory 1609, and a processor 1610 and other components.
[0144] Those skilled in the art will appreciate that the electronic device 1600 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1610 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 8 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0145] The processor 1610 is used to obtain first data of an application; transmit the first data to a data processing chip via a serial peripheral interface; and obtain second data sent by the data processing chip via the serial peripheral interface.
[0146] The electronic device provided in the embodiment of the present application obtains the first data of the application program; transmits the first data to the data processing chip through the serial peripheral interface; and obtains the second data sent by the data processing chip through the serial peripheral interface. In this way, the first data of the application program is transmitted to the data processing chip through the serial peripheral interface, and at the same time, the second data sent by the data processing chip is received through the serial peripheral interface, which can make full use of the full-duplex characteristics of the serial peripheral interface and improve the data transmission efficiency between the data processing chip and the application processor used to run the application program.
[0147] Optionally, processor 1610 is also used to encapsulate the first data into a first data packet based on a communication protocol; transmit the first data packet to a data processing chip through a serial peripheral interface; the data processing chip is used to receive the first data packet through the serial peripheral interface, and parse the first data packet based on the communication protocol to obtain the first data.
[0148] Optionally, the processor 1610 is further configured to, upon receiving the indication signal, obtain second data sent by the data processing chip through the serial peripheral interface.
[0149] Optionally, the processor 1610 is further configured to parse the second data based on the communication protocol to obtain third data; and transmit the third data to the application.
[0150] Optionally, the processor 1610 is further configured to create a first thread in response to a startup operation of the application; and call the first thread to receive first data of the application.
[0151] Optionally, the processor 1610 is further configured to create a second thread; and call the second thread to parse the second data based on the communication protocol to obtain third data.
[0152] Optionally, processor 1610 is also used to, upon receiving a data read request sent by the application, send the data read request to the data processing chip through the serial peripheral interface; upon receiving the data read request through the serial peripheral interface, the data processing chip writes the fourth data indicated by the data read request to the cache address indicated by the data read request; obtains the fourth data from the cache address indicated by the data read request, and sends the fourth data to the application.
[0153] It should be understood that in the embodiment of the present application, the input unit 1604 may include a graphics processor (Graphics Processing Unit, GPU) 16041 and a microphone 16042, and the graphics processor 16041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1606 may include a display panel 16061, and the display panel 16061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1607 includes a touch panel 16071 and at least one of other input devices 16072. The touch panel 16071 is also called a touch screen. The touch panel 16071 may include two parts: a touch detection device and a touch controller. Other input devices 16072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0154] The memory 1609 can be used to store software programs and various data, including but not limited to application programs and operating systems. The memory 1609 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instruction required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 1609 may include a volatile memory or a non-volatile memory, or the memory 1609 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 1609 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0155] The processor 1610 may include one or more processing units; optionally, the processor 1610 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 1610.
[0156] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method of the aforementioned embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0157] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0158] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data transmission method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0159] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0160] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned data transmission method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0161] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0162] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0163] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data transmission method, characterized in that: The method comprises: Get the first data of the application; Transmitting the first data to a data processing chip via a serial peripheral interface; The second data sent by the data processing chip is acquired through the serial peripheral interface.
2. The method according to claim 1, characterized in that The step of transmitting the first data to the data processing chip via the serial peripheral interface includes: Based on a communication protocol, encapsulate the first data into a first data packet; The first data packet is transmitted to a data processing chip through a serial peripheral interface; the data processing chip is used to receive the first data packet through the serial peripheral interface, and parse the first data packet based on the communication protocol to obtain the first data.
3. The method according to claim 1, characterized in that The data processing chip outputs an indication signal before sending the second data; The acquiring, through the serial peripheral interface, the second data sent by the data processing chip comprises: When the indication signal is received, the second data sent by the data processing chip is acquired through the serial peripheral interface.
4. The method according to claim 3, characterized in that The second data is obtained after the data processing chip is encapsulated based on the communication protocol; after the second data sent by the data processing chip is obtained through the serial peripheral interface, the method further includes: Parsing the second data based on the communication protocol to obtain third data; The third data is transmitted to the application.
5. The method according to claim 1, characterized in that The obtaining of first data of the application comprises: In response to a start operation of the application, creating a first thread; The first thread is called to obtain first data of the application.
6. The method according to claim 4, characterized in that Before obtaining the first data of the application, the method further includes: creating a second thread; The parsing the second data based on the communication protocol to obtain third data includes: The second thread is called to parse the second data based on the communication protocol to obtain third data.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: When receiving a data read request sent by the application, the data read request is sent to the data processing chip through the serial peripheral interface; when receiving the data read request through the serial peripheral interface, the data processing chip writes the fourth data indicated by the data read request to the cache address indicated by the data read request; The fourth data is obtained from the cache address indicated by the data read request, and the fourth data is sent to the application.
8. A data transmission system, characterized in that: The system includes an application layer, a core layer and a hardware layer; the hardware layer includes a data processing chip; The core layer is connected to the hardware layer via a serial peripheral interface; The application layer is used to send the first data of the application program to the core layer; The core layer is used to obtain the first data of the application layer, and transmit the first data to the data processing chip through the serial peripheral interface; The data processing chip is used to process the first data and generate second data; and send the second data through the serial peripheral interface; The core layer is used to receive the second data through the serial peripheral interface and transmit the second data to the application layer.
9. The system according to claim 8, characterized in that The core layer includes a protocol stack for storing communication protocols, and the core layer is specifically used for: Based on the communication protocol, encapsulate the first data into a first data packet, and transmit the first data packet to the data processing chip through the serial peripheral interface; The data processing chip is specifically used to: receive the first data packet through the serial peripheral interface, and parse the first data packet based on the communication protocol to obtain the first data.
10. The system according to claim 8, characterized in that The hardware layer also includes a general purpose input and output interface, and the general purpose input and output interface is connected to the core layer; The data processing chip is further used for: before sending the second data through the serial peripheral interface, outputting an indication signal through the universal input and output interface; The core layer is specifically configured to: upon receiving the indication signal, receive the second data through the serial peripheral interface, and transmit the second data to the application layer.
11. The system according to claim 10, characterized in that The data processing chip is specifically used to: perform data processing on the first data to obtain third data, and encapsulate the third data based on a communication protocol to obtain the second data; The core layer is specifically used to: parse the second data based on the communication protocol to obtain third data, and transmit the third data to the application layer.
12. The system according to claim 8, characterized in that The core layer is specifically used for: In response to a start operation of the application, creating a first thread; The first thread is called to obtain first data of the application layer.
13. The system according to claim 11, characterized in that The core layer is specifically used for: Before acquiring the first data of the application layer, creating a second thread; The second thread is called to parse the second data based on the communication protocol to obtain third data.
14. The system according to any one of claims 8 to 13, characterized in that: The application layer is further used to: send a data read request of the application to the core layer; The core layer is further configured to: upon receiving the data read request, send the data read request through the serial peripheral interface; The data processing chip is further used for: when receiving the data read request through the serial peripheral interface, writing the fourth data indicated by the data read request into the cache address indicated by the data read request; The core layer is further configured to obtain the fourth data from the cache address indicated by the data read request, and transmit the fourth data to the application layer.
15. A data transmission device, characterized in that: The device comprises: A first acquisition module, used to acquire first data of an application program; A first transmission module, used for transmitting the first data to a data processing chip through a serial peripheral interface; And, a second acquisition module is used to acquire second data sent by the data processing chip through the serial peripheral interface.
16. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the data transmission method according to any one of claims 1 to 7 are implemented.
17. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the data transmission method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Multiple communication interface extension method and system based on SOC system-on-chip, chip, computer readable storage medium and electronic equipment
CN120821688A
