System on chip, peripheral data transmission method thereof and electronic equipment

By using a DMA controller to transport peripheral data to shared memory in the system-on-chip, the problem of long paths between the processor and peripherals is solved, and data transmission efficiency and system performance are improved.

CN119003431APending Publication Date: 2024-11-22PHYTIUM TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411139987.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In a system on chip, the path between the processor and the peripheral is longer, resulting in a longer wait time for the processor to access the peripheral, reducing the overall data transmission performance.

Method used

By introducing a DMA controller in the system on chip and attaching it to the bus of the second processor, the data in the peripheral controller is transported to the shared memory by using the DMA controller, so that the first processor can be able to get from the shared memory Peripheral data is read from the second processor to avoid the fullness of the core resources of the second processor and improve the utilization rate of the core resource and processing efficiency.

Benefits of technology

It effectively improves the overall data transmission performance of the system on chip, reduces the time-consuming transmission of peripheral data, improves the continuity of bus data transmission, and avoids the waste of bandwidth resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003431A_ABST
    Figure CN119003431A_ABST
Patent Text Reader

Abstract

The invention provides a system-on-chip, a peripheral data transmission method thereof and electronic equipment. The system-on-chip comprises a first processor, a second processor, a direct register access (DMA) controller, a peripheral controller and a shared memory, and the DMA controller, the shared memory and the second processor are hooked to the same bus. The peripheral data transmission method comprises the steps that a first processor writes read-write parameters for a peripheral controller into a shared memory; the second processor configures and enables the DMA controller by using the read-write parameters; and after the peripheral controller is enabled, the DMA controller carries the peripheral data in the peripheral controller to the shared memory, so that the first processor can read the peripheral data from the shared memory. According to the embodiment of the invention, the problems of data blockage, too long consumed time and the like in data transmission of the internal and external devices of the system-on-chip are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of chip technology, and in particular to a peripheral data transmission method and electronic device of a system on chip. Background Art

[0002] The multi-processor architecture of System on a Chip (SoC) integrates multiple processor cores on a single chip to achieve higher performance, lower power consumption, and more compact system design. This architecture is often used in applications that need to process a large number of parallel tasks or require higher computing power. In the multi-processor architecture of the system on a chip, each processor core can run programs and perform tasks independently, and communicate and collaborate through shared memory or other communication mechanisms.

[0003] In a multi-processor system-on-chip, the path between the processor and the peripherals is long, and the response waiting time of the processor accessing the peripherals is long, resulting in problems such as low overall data transmission performance of the system-on-chip. Summary of the invention

[0004] In view of this, the present disclosure provides a system on chip and its peripheral data transmission method and electronic device, which can effectively improve the transmission efficiency of peripheral data in the system on chip, thereby improving the overall data transmission performance of the system on chip and the continuity of bus data flow.

[0005] According to a first aspect of the present disclosure, a peripheral data transmission method of a system on chip is provided, the system on chip comprising a first processor, a second processor, a direct register access DMA controller, a peripheral controller, and a shared memory, wherein the DMA controller, the shared memory, and the second processor are mounted on the same bus; the peripheral data transmission method of the system on chip comprises: the first processor writes read and write parameters for the peripheral controller to the shared memory; the second processor configures and enables the DMA controller using the read and write parameters; after being enabled, the DMA controller moves the peripheral data in the peripheral controller to the shared memory, so that the first processor can read the peripheral data from the shared memory.

[0006] In some implementations of the first aspect of the present disclosure, the second processor configures and enables the DMA controller using the read / write parameters, including:

[0007] The second processor estimates the bus transmission duration according to the peripheral bus transmission rate and the amount of read and write data indicated by the read and write parameters, and the peripheral bus is used to connect the peripheral controller;

[0008] If the bus transfer duration is greater than the DMA configuration duration threshold, the second processor configures and enables the DMA controller.

[0009] In some implementations of the first aspect of the present disclosure, it also includes: if the bus transfer duration is less than or equal to the DMA configuration duration threshold, the second processor reads the peripheral data from the data register address of the peripheral controller and sends it to the shared memory, so that the first processor can read the peripheral data from the shared memory.

[0010] In some implementations of the first aspect of the present disclosure, the second processor configures and enables the DMA controller using the read-write parameters, including: determining a DMA channel corresponding to the peripheral controller; setting a data register address of the peripheral controller as a source address of the DMA controller; setting a shared memory space address corresponding to the peripheral controller as a target address of the DMA controller; setting a data transmission length of the DMA controller according to the amount of read and write data in the read-write parameters; and enabling the DMA controller.

[0011] In some implementations of the first aspect of the present disclosure, the determining the DMA channel corresponding to the peripheral controller includes one of the following:

[0012] Apply for an idle DMA channel of the DMA controller and bind the idle DMA channel to the peripheral controller;

[0013] If the DMA channel bound to the peripheral controller is currently marked as idle, directly use the DMA channel bound to the peripheral controller;

[0014] If all DMA channels in the DMA controller are occupied, retrieve the DMA channels in the bound state, release the DMA channels marked as idle and in the bound state to obtain the idle DMA channels, and bind the idle DMA channels to the peripheral controller.

[0015] In some implementations of the first aspect of the present disclosure, the DMA controller moves the peripheral data in the peripheral controller to the shared memory so that the first processor can read the peripheral data from the shared memory, including:

[0016] The DMA controller transfers the peripheral data stored at the data register address of the peripheral controller to the shared memory, and initiates a second interrupt after the transfer is completed;

[0017] In response to the second interrupt, the second processor runs an interrupt service function to initiate a third interrupt to the first processor, so that the first processor reads the peripheral data from the shared memory in response to the third interrupt.

[0018] In some embodiments of the first aspect of the present disclosure, a transfer task module is provided in the second processor, and the transfer task module is used to wake up the DMA controller configuration program of the second processor in response to the first interrupt from the first processor; the second processor configures and enables the DMA controller using the read and write parameters, specifically: the second processor runs the DMA controller configuration program to complete the configuration and enabling of the DMA controller.

[0019] In some implementations of the first aspect of the present disclosure, the read-write parameters include multiple groups, each group of read-write parameters is for a different peripheral controller; the second processor uses the read-write parameters to configure and enable the DMA controller, including: in response to a first interrupt initiated by the first processor, the second processor reads the multiple groups of read-write parameters written by the first processor from the shared memory, the second processor sorts the multiple groups of read-write parameters, and executes the configuration and enabling of the DMA controller for each group of read-write parameters in a pipeline manner according to the sorting, different read-write parameters are assigned to different DMA channels to use different DMA channels to carry peripheral data of different peripheral controllers.

[0020] In some implementations of the first aspect of the present disclosure, the second processor sorts the multiple groups of read and write parameters, including:

[0021] The second processor sorts the multiple groups of read and write parameters according to one of the following information:

[0022] The priority of the peripheral controller corresponding to the read and write parameters;

[0023] The timing of the read data request corresponding to the read and write parameters;

[0024] The application priority for read data requests corresponding to the read and write parameters.

[0025] In some implementations of the first aspect of the present disclosure, after being enabled, the DMA controller moves the peripheral data in the peripheral controller to the shared memory so that the first processor can read the peripheral data from the shared memory, including:

[0026] The DMA controller uses different DMA channels to pipeline the peripheral data of the peripheral controller to the shared memory according to the sequence, and initiates a second interrupt each time a DMA channel transmission completion is detected;

[0027] Each time the second interrupt is received, the second processor initiates a third interrupt, and the third interrupt is used to notify the first processor that the peripheral data transmission of the corresponding peripheral controller is completed, so that the first processor reads the corresponding peripheral data from the shared memory in response to the third interrupt, until the peripheral data of the peripheral controller corresponding to multiple sets of read and write parameters can be read by the first processor.

[0028] In some implementations of the first aspect of the present disclosure, the peripheral controller includes one or more of the following:

[0029] Universal serial communication interface UART;

[0030] Serial communication bus interface I2C;

[0031] Synchronous serial data interface SPI;

[0032] Memory card interface SD / MMC;

[0033] Digital audio interface I2S;

[0034] Enhanced serial peripheral interface eSPI.

[0035] According to a second aspect of the present disclosure, a system on chip is provided, which includes a first processor, a second processor, a direct register access DMA controller, a peripheral controller, and a shared memory, wherein the DMA controller, the shared memory, and the second processor are mounted on the same bus; the first processor is used to write read and write parameters for the peripheral controller to the shared memory; the second processor is used to configure and enable the DMA controller using the read and write parameters; the DMA controller is used to, after being enabled, move peripheral data in the peripheral controller to the shared memory, so that the first processor can read the peripheral data from the shared memory.

[0036] According to a third aspect of the present disclosure, an electronic device is provided, comprising: the above-mentioned system on chip.

[0037] It can be seen from the above technical solution that the embodiment of the present disclosure adds DMA in the system on chip, and the DMA controller is set on the bus where the second processor is located. The second processor only needs to configure and enable the DMA controller based on the read and write parameters in the shared memory. After that, the DMA controller can move the peripheral data from the peripheral controller to the shared memory without the participation of the second processor. Therefore, after enabling the DMA controller, the core resources of the second processor can be automatically released for other peripheral tasks, thereby effectively avoiding the core resources of the second processor from being occupied, solving the data congestion problem of the second processor, and improving the core resource utilization and processing efficiency of the second processor; at the same time, because the intermediate link of the DMA controller in moving data between the shared memory and the peripheral controller is simpler and consumes less time, the time spent by the DMA controller to move data is often less than the time spent by the second processor to directly read data from the peripheral controller, and the time spent by the DMA controller to move data is usually less than the time to complete the actual data transmission on the peripheral bus. Therefore, the method of the embodiment of the present disclosure can also reduce the transmission time of peripheral data, improve the continuity of bus data transmission, allow the peripheral bus to transmit at full bandwidth, reduce the waste of bandwidth resources, and thus improve the overall data transmission performance of the system on chip. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 An exemplary architecture diagram of a system on a chip provided for an embodiment of the present disclosure;

[0040] Figure 2 A schematic diagram of a flow chart of a peripheral device data transmission method of a system on chip provided in an embodiment of the present disclosure;

[0041] Figure 3 A schematic diagram of a peripheral data transmission process for SPI involved in an embodiment of the present disclosure;

[0042] Figure 4 This is a timing diagram of peripheral device data transmission in a multi-peripheral device scenario involved in an embodiment of the present disclosure;

[0043] Figure 5 A schematic block diagram of an electronic device provided in accordance with an embodiment of the present disclosure. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0045] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments, and are not intended to limit the present disclosure. The singular forms "a", "said" and "the" used in the embodiments of the present disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0046] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0047] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0048] Terminology explanation:

[0049] RV core: a processor core based on the RISC-V instruction set architecture. RISC-V is an open instruction set architecture (ISA) based on the principles of reduced instruction set computers (RISC). The design of RISC-V ISA is concise, modular, and scalable, and can support different application requirements. It defines a set of basic instruction sets and also provides standard extensions, such as floating point, vector, encryption, etc., so that users can choose the appropriate instruction set extension according to their needs. The second processor of the disclosed embodiment is constructed using the RV core.

[0050] Peripherals: Also known as SoC peripherals, external hardware devices connected to the SoC, including but not limited to serial port devices, audio devices, storage devices, etc.

[0051] Direct Memory Access (DMA): A technology used to improve data transmission efficiency in computer systems. It can move data between memory and peripherals without CPU control, which can reduce the CPU burden and improve the overall system performance.

[0052] Static Random-Access Memory (SRAM): A type of random access memory whose "static" characteristic means that as long as the power is on, the data stored in it can be constantly maintained without periodic refresh. It provides higher performance. SRAM is mainly used in scenarios that require fast data access, such as cache.

[0053] Exemplary Systems

[0054] An embodiment of the present disclosure provides a system on chip, which may include: a first processor, a second processor, a DMA controller, a peripheral controller, and a shared memory, wherein the DMA controller, the shared memory, and the second processor are connected to the same bus; the system on chip of the embodiment of the present disclosure may execute the following peripheral data transmission method.

[0055] Specifically, the first processor can be used to write read and write parameters for the peripheral controller to the shared memory, the second processor can be used to configure and enable the DMA controller using the read and write parameters, and the DMA controller can be used to move the peripheral data in the peripheral controller to the shared memory after being enabled so that the first processor can read the peripheral data from the shared memory.

[0056] The exemplary architecture of the system on chip provided by the embodiments of the present disclosure is described in detail below.

[0057] Figure 1 FIG. 1 shows an example of the architecture of the system on chip 100 provided by the embodiment of the present disclosure. Figure 1 As shown, the system on chip 100 of the embodiment of the present disclosure may include a first processor, a second processor, a DMA controller, a shared memory, a peripheral controller, a system bus, a peripheral bus, and a second processor bus, etc. Among them, the system bus is a primary bus, the peripheral bus and the second processor bus are both secondary buses, the peripheral bus and the second processor bus are connected through the system bus, the first processor is mounted on the system bus, the second processor, the shared memory and the DMA controller are all mounted on the second processor bus, each peripheral controller is connected to the peripheral bus, and the first processor is connected to the system bus.

[0058] In some implementations, the system on chip 100 may further include a memory ( Figure 1(not shown), the memory may be the memory of the system on chip, or may be other memory built into the system on chip, which is mounted on the system bus, and the first processor may access the memory through the system bus, and the second processor may access the memory through the second processor bus and the system bus. For example, because DDR has a higher data transmission rate and efficiency, and can transmit data twice in each clock cycle, providing a higher bandwidth, the memory of the embodiment of the present disclosure is preferably a double data rate synchronous dynamic random access memory (DDR, Double Data Rate Synchronous Dynamic Random Access Memory) or the like. It is understandable that the memory may also be any other type of random access memory (RAM), such as SDR, etc., and the embodiment of the present disclosure does not limit this.

[0059] In some embodiments, see Figure 1 The system on chip 100 may further include an SRAM or other similar memory as a second processor memory, which is used to store program-related data of the second processor, that is, the program of the second processor runs on the SRAM.

[0060] See also Figure 1, each peripheral controller (also referred to as a peripheral controller interface) is connected to the second processor via a peripheral bus, a system bus, and a second processor bus. Different types of peripheral controllers can communicate with corresponding external hardware devices through different standard bus protocols. Exemplarily, the peripheral controller may include multiple. Exemplarily, the peripheral controller may include, but is not limited to, one or more of the following: a universal serial communication interface (UART, Universal Asynchronous Receiver-Transmitter), a serial communication bus interface (I2C, Inter-Integrated Circuit), a synchronous serial data interface (SPI, Serial Peripheral Interface), a high-definition audio interface (HAD, High Definition Audio), a memory card interface (SD / MMC, Secure Digital / Multimedia Card), a Gigabit Ethernet controller interface (GMAC, Gigabit Media Access Control), a neural processing unit (NPU, Neural Processing Unit), a digital audio interface standard (I2S, Inter-IC Sound), a codec (CODEC, Coder-Decoder), an enhanced serial peripheral interface (eSPI, Enhanced Serial Peripheral Interface), etc. In specific applications, the peripheral controller can be expanded as needed, and the embodiments of the present disclosure do not limit this.

[0061] Exemplarily, the first processor may be a single-core processor or a multi-core processor, and the core of the first processor may be, but is not limited to, an ARM core, an RV core, or other types of processor cores.

[0062] Exemplarily, the second processor may be a single-core processor, and the second processor may adopt a processor core based on the RISC-V instruction set architecture (referred to herein as RV core), an ARM core, or the same processor core as the first processor.

[0063] In some implementations, the first processor may use a large core and the second processor may use a small core. The first processor may serve as the main processor of the system on chip and the second processor may serve as the slave processor of the system on chip. All kinds of tasks in the application layer of the system on chip may be handled by the first processor, and the second processor may be used to execute related processing of specific components in the system on chip, such as peripherals, input and output interfaces, etc.

[0064] For example, the first processor can be used to perform application layer tasks, preferably a multi-core processor, including but not limited to core 1, core 2, ..., core n, n is an integer greater than 2, and the cores in the first processor can be the same or different. The second processor can be a processor (IOP, IO Processor IOP) that processes input and output (I / O) operations, preferably a single-core processor, which can be used to manage various peripheral controllers to achieve communication between the system on chip 100 and the peripherals. The first processor and the second processor can communicate through the inter-core communication component, the second processor can interact with the peripheral controller through the second processor bus and the peripheral bus, and the first processor obtains the peripheral data stored in the peripheral controller through the second processor.

[0065] Exemplarily, the first processor and the second processor may communicate with each other through, for example, an inter-core communication component, a low-speed serial bus, a high-speed serial bus, or any other feasible manner, wherein the inter-core communication component may include but is not limited to a register group (regfile), a shared memory group (share mem, shared memory), and the like. Figure 1 The shared memory in is included in the shared memory group. For specific applications, see Figure 1 The process of transmitting data from the first processor to the second processor may be: the data from the first processor sequentially passes through the system bus and the second processor bus to enter the shared memory, and the second processor accesses the shared memory through the second processor bus to read the data. The process of the second processor returning data to the first processor is similar to this and will not be described in detail.

[0066] In addition to the aforementioned first processor and second processor, the system on chip 100 of the embodiment of the present disclosure may also include other processors. For example, the system on chip 100 may also include a third processor (not shown in the figure), which may also be used as a slave processor, and may be used to perform processing such as system control and security tasks. Security tasks may include but are not limited to encryption and decryption, security authentication, etc. System control may include but is not limited to system power on and off, system configuration, etc. The third processor may be connected to the system bus, and the third processor may communicate with the first processor through the system bus, shared memory, register group, etc.

[0067] Since the second processor and the peripheral controller are mounted on different secondary buses, the data transmission between the second processor and the peripheral controller needs to pass through the peripheral bus, the system bus and the second processor bus, the transmission path is long and time-consuming, and the time the second processor waits for the peripheral controller to respond plus the necessary time for other codes to run will be longer than the time to complete the actual data transmission on the peripheral bus, resulting in discontinuous data flow on the bus, the peripheral bus cannot be fully transmitted, the core resources of the second processor are occupied again, and other services cannot be processed in time, which ultimately causes problems such as waste of bandwidth resources and data congestion of the second processor. In view of this, the DMA is set in the system on chip 100 provided in the embodiment of the present disclosure, and the DMA is mounted on the second processor bus, and the peripheral data transmission between the second processor and the peripheral controller is realized through DMA, thereby solving the above problems.

[0068] It should be noted that the above system 100 is only for illustration, and the system architecture applicable to the embodiments of the present disclosure is not limited thereto. Those skilled in the art should understand that the following method of the embodiments of the present disclosure can be applied to other forms of on-chip systems, as long as the on-chip system includes two processors and the DMA controller is connected to the bus to which the processor that can directly interact with the peripheral controller belongs.

[0069] Exemplary Methods

[0070] Figure 2 FIG. 1 is a flow chart showing a peripheral data transmission method of a system on chip provided by an embodiment of the present disclosure. Figure 2 , the peripheral device data transmission method 200 may include:

[0071] Step 201, the first processor writes read and write parameters for the peripheral controller into the shared memory;

[0072] Step 202, the second processor configures and enables the DMA controller using the read and write parameters;

[0073] Step 203: After being enabled, the DMA controller moves the peripheral data in the peripheral controller to the shared memory, so that the first processor can read the peripheral data from the shared memory.

[0074] The read and write parameters for the peripheral controller refer to data reading parameters for the peripheral controller or data writing parameters for the peripheral controller.

[0075] In the embodiment of the present disclosure, by adding DMA in the system on chip, the DMA controller is set on the bus where the second processor is located, and the second processor only needs to configure and enable the DMA controller according to the read and write parameters written by the first processor to the shared memory, and then the DMA controller can move the peripheral data of the peripheral controller to the shared memory, so that the first processor can obtain the peripheral data by accessing the shared memory. Since the DMA controller does not need to participate in the process of moving the peripheral data, the core resources of the second processor will be automatically released to process other tasks, thereby effectively avoiding the core resources of the second processor from being occupied, solving the data congestion problem of the second processor, and improving the core resource utilization and processing efficiency of the second processor; at the same time, since the intermediate link of the DMA controller to move data between the shared memory and the peripheral controller is simpler and consumes less time, the time consumed by the DMA controller to move data is often less than the time spent by the second processor to directly read data from the peripheral controller, and the time consumed by the DMA controller to move data is usually less than the time to complete the actual data transmission on the peripheral bus, therefore, the method of the embodiment of the present disclosure can also reduce the transmission time of the peripheral data, improve the continuity of the bus data transmission, and allow the peripheral bus to transmit at full bandwidth, reduce the waste of bandwidth resources, and thus improve the overall data transmission performance of the system on chip.

[0076] In the embodiments of the present disclosure, peripheral data may include but is not limited to the following: 1) Device data: including reading data from peripheral devices and passing it to applications, and transmitting data generated by applications to peripheral devices. 2) Status information: the driver may pass status information of peripheral devices to applications, and the status information includes connection status, error information, device configuration, etc. 3) Event notification: the driver may send event notifications to applications, such as device plug-in and unplug events, error events, completion events, etc. 4) Control commands: the application may send control commands to the peripherals through the driver, and the driver is responsible for passing these commands to the peripherals. 5) Interrupt processing: the driver is responsible for processing interrupt signals sent by peripheral devices and notifying the application of corresponding interrupt events. Of course, peripheral data may also include others, which are not limited by the embodiments of the present disclosure.

[0077] If the read / write parameters for peripheral control may include but are not limited to the amount of data to be transmitted and the data address. When reading, the second processor configures the data address as the destination address of the DMA controller, and configures the peripheral data register as the source address of the DMA controller, so as to read the data into the data address through the DMA controller. When sending, the first processor writes the data to be sent to the data address, and the second processor configures the data address as the source address of the DMA controller, and configures the peripheral data register as the destination address of the DMA controller, so as to send the data to the peripheral controller through the DMA controller, and transmit it out through the peripheral controller. Since the data register address of each peripheral controller is usually fixed, there is no need to pass the data register address to the second processor through the read / write parameters. Amount of read / write data In addition, other content may also be included in the read / write parameters, and this is not limited by the embodiments of the present disclosure.

[0078] The data register of the peripheral controller is used to transmit data to or receive data from the peripheral. The data register is usually used to transfer data between the peripheral and the system on chip, which is the peripheral data in this article.

[0079] In step 201, the first processor may also write the read instruction corresponding to the above read / write parameters together with the read / write parameters into the shared memory, so that the second processor can perform subsequent processing using the read / write parameters under the triggering of the read instruction. Specifically, the read instruction can be used to wake up the transport task module in the second processor, so that the transport task module can perform subsequent processing using the read / write parameters. For details, please refer to the relevant description below, which will not be repeated here.

[0080] The read / write parameters and the read instructions may be generated by the first processor according to the read request of the application program. Alternatively, the read / write parameters and the read instructions may be user input information received by the first processor through the application layer. This embodiment of the present disclosure does not limit this.

[0081] It should be noted that the embodiments of the present disclosure do not limit the format, content, and acquisition method of the read and write parameters and read instructions.

[0082] In some implementations, step 202 may include: the second processor estimates the bus transmission time according to the peripheral bus transmission rate and the amount of read and write data indicated by the read and write parameters, the peripheral bus being a bus for connecting the peripheral controller to the external device, outside the SoC, and connected to the peripheral device by the SoC pin; if the bus transmission time is greater than the DMA configuration time threshold, the second processor configures and enables the DMA controller. Thus, the DMA controller can be used for peripheral data transmission when it is determined that the bus transmission time is greater than the DMA controller transmission time, so that the application of the DMA controller can reduce the data transmission time as much as possible.

[0083] Furthermore, the method of the embodiment of the present disclosure may also include: if the bus transmission time is less than or equal to the DMA configuration time threshold, the second processor reads the peripheral data from the data register address of the peripheral controller and sends it to the shared memory, so that the first processor can read the peripheral data from the shared memory. Thus, when the bus transmission time is less than or equal to the DMA controller transmission time, the original direct data transmission method can be used without using the DMA controller to carry out peripheral data transfer, thereby reducing the data transmission time as much as possible.

[0084] The DMA configuration duration threshold can be an empirical value. Specifically, when using a DMA controller to transfer data, it is necessary to apply for an idle DMA channel and initialize the DMA channel. After the DMA controller completes the transfer, an interrupt will be generated to process the DMA channel. These two parts are the necessary time to configure the DMA controller. The necessary time for these two parts is fixed. The time spent on these two parts is the DMA configuration duration. The DMA configuration duration threshold can be an empirical value of the DMA configuration duration. For example, the following DMA transfer process can be run once or multiple times: When using a DMA controller to transfer data, it is necessary to apply for an idle DMA channel and initialize the DMA channel. After the DMA controller completes the transfer, an interrupt will be generated to process the DMA channel; the running time of each DMA transfer process is counted and the average value is taken as the DMA configuration duration threshold.

[0085] In some examples, the bus transmission time can be calculated by the following formula (1):

[0086] Bus transfer time = (1 / bus transfer rate)*8*number of bytes (1)

[0087] Among them, " / " means division, "*" means multiplication, and the number of bytes is the number of bytes of the read and write data. Taking SPI as an example, the SPI bus transmission rate is 25Mbps (that is, 25 megabits of data are transmitted per second), then it takes (1 / 25000000)*8=0.32us to transmit 1 byte of data, and 3.2us to transmit 10 bytes of data.

[0088] In specific applications, the second processor can make a judgment before each peripheral data transmission. If the bus transmission time is longer than the DMA configuration time threshold, it is considered to be a large data transmission, and the DMA controller is used to transmit the peripheral data. Otherwise, the original direct data transmission method or other applicable methods can be used to transmit peripheral data.

[0089] Figure 3 A schematic diagram showing a specific implementation process of the peripheral data transmission method according to an embodiment of the present disclosure is shown. Figure 3In the example, taking SPI flash reading as an example, the first processor runs an operating system, the application and the SPI driver framework run on the operating system, and the underlying driver framework related to the SPI controller runs in the second processor. Figure 3 In the example of FIG. 1 , a DMA controller is introduced into the architecture of the second processor to transmit peripheral data, thereby greatly improving the overall data transmission efficiency of the system on chip. The peripheral data transmission process of other peripheral controllers is the same as this principle, and those skilled in the art should understand that the DMA controller can be used to transmit peripheral data. Figure 3 Directly derive the peripheral data transmission process of other peripheral controllers. Figure 3 The technical details of the embodiments of the present disclosure are described in detail.

[0090] In some implementations, in step 201, the first processor may write read and write parameters for the peripheral controller into the shared memory in response to the read data request initiated by the application layer. Specifically, step 201 may include: in response to the read data request initiated by the application layer, the peripheral driver layer of the first processor writes the read command and read and write parameters corresponding to the read data request into the shared memory to trigger a first interrupt, and the first interrupt is used to trigger the second processor to configure and enable the DMA controller.

[0091] Specifically, Figure 3 For example, a user application (User application) in the user space initiates a SPI flash read data request, and the SPI driver layer responds to the read data request. After the read data request is processed by the SPI device driver (spi device driver), the memory technology device (MTD, Memory Technology Device) layer, the SPI core (spi core) and the SPI controller driver (spi master driver) in the SPI driver framework, the corresponding read command and read-write parameters are written into the shared memory to trigger a first interrupt for the second processor, and the first interrupt is used to notify the second processor that there is a command to be processed.

[0092] Among them, the SPI core (spi core) completes the processing by calling components within the Linux operating system driver framework such as spi transfer and spi_nor. During the processing of the SPI controller driver (spi master driver), the Transfer_one_message callback function will be called to complete the processing and transmission of the spi_transfer linked list.

[0093] In some implementations, step 202 may include the following process: first, determine the DMA channel corresponding to the peripheral controller; second, set the data register address of the peripheral controller as the source address of the DMA controller; third, set the address of the shared memory space corresponding to the peripheral controller as the target address of the DMA controller; fourth, set the data transmission length of the DMA controller according to the read and write data volume in the read and write parameters; and finally, enable the DMA controller. Thus, the configuration and enabling of the DMA controller can be realized, so that the source address of the DMA controller is the data register address of the peripheral controller, and the target address is the shared memory space address of the corresponding peripheral controller, so that the DMA controller can complete the transfer of the corresponding peripheral data after enabling.

[0094] In a specific application, a shared memory space corresponding to each peripheral controller can be set in the shared memory, and the address of the shared memory space of each peripheral controller can be pre-stored in the second processor, so that the second processor can find its shared memory space address through information such as the peripheral controller identification when configuring the DMA controller. Figure 3 For example, the shared memory includes a first part and a second part. The first part can be used to store read and write parameters and read instructions for different peripheral controllers ( Figure 3 The other part is used to store the peripheral data of different peripheral controllers ( Figure 3 The two parts can be divided into multiple spaces, each corresponding to a peripheral controller. For example, the first part of the shared memory can be set to a first shared memory space corresponding to SPI, and the first shared memory space is used to store the read and write parameters and read instructions of SPI. The second part can be set to a second shared memory space corresponding to SPI, and the second shared memory space can be used to store the peripheral data of SPI.

[0095] Among them, there are many specific implementation methods for determining the DMA channel corresponding to the peripheral controller. In some implementation methods, exemplarily, the method for determining the DMA channel corresponding to the peripheral controller can be one of the following: 1) Apply for an idle DMA channel of the DMA controller and bind the idle DMA channel to the peripheral controller; 2) If the DMA channel bound to the peripheral controller is currently marked as idle, directly use the DMA channel bound to the peripheral controller; 3) If all DMA channels in the DMA controller are occupied, retrieve the DMA channel in the bound state, release the DMA channel marked as idle and in the bound state to obtain the idle DMA channel, and bind the idle DMA channel to the peripheral controller. Therefore, when configuring the DMA controller, it is possible to select a suitable DMA channel for each peripheral controller in combination with various factors such as specific application scenarios, the actual situation of the DMA channel, and the number of peripheral controllers, so as to further reduce the time consumed by the DMA controller to transmit data.

[0096] Considering that after adding a DMA controller, each time the DMA controller is configured, it is necessary to apply for an idle DMA channel for initialization, and the DMA controller releases the DMA channel after completing data transmission, which increases the time consumed by the DMA controller to transmit data. Therefore, the aforementioned 1) and 2) methods can be used to determine the DMA channel of the peripheral controller, and bind the peripheral controller to the DMA channel. In this way, the basic initialization of the DMA channel will be completed when the second processor core is started. During the configuration process of the DMA controller, only the source address, target address, and amount of data to be transmitted need to be set. The configuration time of the DMA controller can be greatly shortened, thereby further reducing the time consumed by the DMA controller to transmit peripheral data.

[0097] See also Figure 3 , the DMA controller (DMA controller) contains multiple groups of DMA channels chan1, chan2, chan3, ..., the multiple groups of DMA channels are respectively assigned to multiple SPI controllers (spi controllers), DMA channel chan1 is assigned to spi controller1, DMA channel chan2 is assigned to spi controller3, DMA channel chan3 is assigned to spi controller3, DMA channel chan1 can be used to transfer peripheral data between the shared memory space data corresponding to spi controller1 and spi controller1, DMA channel chan2 can be used to transfer peripheral data between the shared memory space data corresponding to spi controller2 and spi controller2, DMA channel chan3 can transfer peripheral data between the shared memory space data corresponding to spicontroller3 and spi controller3. In specific applications, one SPI controller needs to be assigned two DMA channels, one channel for reading data and one channel for sending data. The aforementioned DMA channels chan1, chan2, chan3 ... etc. respectively contain two DMA channels.

[0098] Exemplarily, the state of the DMA channel can be indicated by a variable. Specifically, a variable indicating the state of the DMA channel in the DMA controller can be pre-stored in the memory of the second processor, and the variable can indicate three states, namely, a use state, an idle state, and a bound state. For example, the three states of the DMA channel can be indicated by three different variables, or by multiple values ​​of one variable.

[0099] If there are many peripheral controllers and the number of DMA channels is insufficient to bind a dedicated DMA channel to each peripheral controller, the first processor can count the transmission data volume of the historical peripheral data of each peripheral controller, and the peripheral controllers with a larger amount of peripheral data transmitted in a single time can be bound to a fixed DMA channel, while the peripheral controllers with a smaller amount of peripheral data transmitted in a single time can continue to use the commonly used method of applying for space DMA channels. In this way, when the DMA channels are limited and there are many peripheral controllers, dedicated DMA channels can be set mainly for the peripheral controllers with a larger amount of peripheral data, which can improve the utilization rate of the DMA channels and further reduce the time taken by the DMA controller to transmit peripheral data.

[0100] If there are many peripheral controllers and limited DMA channels, and the DMA channels may be occupied because they are bound to fixed peripheral controllers, then the aforementioned method 3) can be used to determine the DMA channels of the peripheral controllers, thereby efficiently and quickly completing the DMA channel allocation in the DMA controller configuration when the DMA channels are limited, thereby further reducing the time consumed by the DMA controller to transmit peripheral data. Specifically, when the DMA controller is used for the first time, each peripheral controller can bind the currently used DMA channel and mark the state of the DMA channel as the use state. After the DMA channel is used, the DMA channel is not released immediately, but only marked as idle. The next time the peripheral controller can continue to use the DMA channel to transmit peripheral data, only simple configuration is required, which can save the configuration time of the DMA controller. When all DMA channels are occupied and the new peripheral controller has no DMA channels to use, the DMA channels in the bound state can be retrieved. When there is an idle DMA channel in the bound state, the DMA channel is released and allocated to the new peripheral controller for use. Thus, all DMA channel resources in the DMA controller can be fully utilized to further shorten the configuration time of the DMA controller, thereby reducing the time consumed by the DMA controller to transmit peripheral data.

[0101] Step 203 may include: the DMA controller transfers the peripheral data stored at the data register address of the peripheral controller to the shared memory, and initiates a second interrupt after the transfer is completed; and, in response to the second interrupt, the second processor runs an interrupt service function to initiate a third interrupt to the first processor, so that the first processor reads the peripheral data from the shared memory in response to the third interrupt. Thus, the DMA controller can notify the second processor through an interrupt after the transfer is completed, and the second processor then notifies the first processor through an interrupt, so that the first processor can obtain the required peripheral data from the shared memory in a timely manner.

[0102] In some implementations, an interrupt service function may be set in the second processor, and the interrupt service function is used to initiate a third interrupt and release a DMA channel at the same time. The interrupt service function may include but is not limited to a DMA interrupt service function. Specifically, the second processor may run an interrupt service function in response to the second interrupt, and while initiating a third interrupt through the interrupt service function to notify the first processor, it may also release the corresponding DMA channel by running the interrupt service function, so that the DMA controller allocates the DMA channel to other peripheral controllers for use. In specific applications, the second processor may release the DMA channel by writing a reset register.

[0103] In some implementations, a transport task module is provided in the second processor, and the transport task module is used to wake up the DMA controller configuration program of the second processor in response to the first interrupt from the first processor. In step 202, the second processor runs the DMA controller configuration program to complete the configuration and enablement of the DMA controller. In addition, the transport task module can also be used to initiate a third interrupt to the first processor after confirming that the peripheral data transmission is completed to notify the first processor to read the peripheral data from the shared memory.

[0104] See also Figure 3 The second processor is provided with a transport task module (spi_task), the SPI driver framework of the first processor and the transport task module (spi_task) can communicate through interrupt notification, and the DMA controller (DMAcontroller) can interact with the transport task module (spi_task) through interruption.

[0105] Specifically, see Figure 3 , the SPI peripheral data transmission process can include:

[0106] First, after the application initiates a read request for the SPI, the SPI driver framework writes the corresponding read command and read / write parameters into the shared content in response to the read request to trigger a first interrupt, and notifies the second processor through the first interrupt that there is a command to be processed.

[0107] Then, in response to the first interrupt, the first processor wakes up the SPI task module spi_task, and spi_task calls the corresponding read data interface according to the read command and read-write parameters in the shared memory (the read data interface is a submodule of the SPI task module, that is, the read data interface can be a pre-configured read data function in the operating system of the second processor) to trigger the second processor to run the DMA controller configuration program to execute the following process: under the triggering of the first interrupt, the read-write parameters and read instructions in the shared memory are read, and it is determined whether to use the DMA transmission mode according to the read-write parameters and read instructions (the specific determination method can be seen in the previous text and will not be repeated here). If the bus transmission time exceeds the DMA configuration time threshold, the DMA transmission mode is used, and the DMA data transmission mode is adopted, that is, the DMA controller is configured and enabled. After the DMA controller is enabled, the core resources of the first processor are released and enter an idle state (idle) or switch to other peripheral tasks.

[0108] Finally, the DMA controller executes the peripheral data transfer between the SPI controller and the shared memory. After the transmission is completed, the DMA controller initiates a second interrupt to the second processor. The second processor runs the DMA interrupt processor function to confirm that the processing is completed and initiates a third interrupt to the SPI driver framework of the first processor through spi_task to notify the first processor. The SPI driver framework of the first processor reads the peripheral data from the shared memory space in response to the third interrupt.

[0109] As can be seen from the above, by setting up a handling task module in the second processor, the second processor can be better compatible with the original direct data transmission method and the DMA data transmission method, and select the appropriate data transmission method at the right time, thereby completing the transmission of peripheral data between the first processor and the peripheral controller more efficiently and quickly.

[0110] Through the method of the embodiment of the present disclosure, the DMA controller can also realize pipeline transmission of peripheral data between multiple peripheral controllers and shared memory, thereby further shortening the data transmission time of multiple peripheral controllers.

[0111] In some implementations, in step 201, the first processor may write multiple sets of read-write parameters into the shared memory simultaneously or successively, and each set of read-write parameters may be for different peripheral controllers. For example, the multiple sets of read-write parameters may include a first read-write parameter, a second read-write parameter, and a third read-write parameter, the first read-write parameter is for SPI, the second read-write parameter is for UART, and the third read-write parameter is for I2C.

[0112] When the read-write parameters include multiple groups, step 202 may include: in response to the first interrupt initiated by the first processor, the second processor reads the multiple groups of read-write parameters written by the first processor from the shared memory, the second processor sorts the multiple groups of read-write parameters, and executes the configuration and enabling of the DMA controller of each group of read-write parameters in a pipeline manner according to the sorting, and different read-write parameters are assigned different DMA channels to use different DMA channels to carry peripheral data of different peripheral controllers. Since the core resources of the first processor will be automatically released when the DMA controller executes the peripheral data transfer, when multiple groups of read-write parameters are synchronously processed, the first processor can process multiple "first processor->second processor->first processor" execution processes in a pipeline manner, and each peripheral controller only needs to wait for the DMA configuration and enabling of the peripheral controller in the previous sorting to be completed, and the time consumption of DMA configuration and enabling is at the microsecond level, so the data transmission time of multiple peripheral controllers will be greatly reduced.

[0113] When the read-write parameters include multiple groups, step 203 may include: the DMA controller uses different DMA channels to pipeline-transfer the peripheral data of the peripheral controller to the shared memory in order, and initiates a second interrupt each time a DMA channel transmission is detected to be completed; each time the second interrupt is received, the second processor initiates a third interrupt, and the third interrupt is used to notify the first processor that the peripheral data transmission of the corresponding peripheral controller is completed, so that the first processor reads the corresponding peripheral data from the shared memory in response to the third interrupt, and so on, until the peripheral data of the peripheral controller corresponding to multiple groups of read-write parameters are written into the shared memory space and the first processor is notified.

[0114] In a specific application, the first processor may initiate a first interrupt for multiple groups of read and write parameters, or may initiate a first interrupt for each of the multiple groups of read and write parameters.

[0115] There may be multiple ways for the second processor to sort multiple groups of read and write parameters. In one example, the second processor may sort multiple groups of read and write parameters according to one of the following information: 1) the priority of the peripheral controller corresponding to the read and write parameters; 2) the timing of the read data request corresponding to the read and write parameters; 3) the application priority of the read data request corresponding to the read and write parameters. In addition, the read and write parameters may be sorted in combination with other information. In other examples, multiple groups of read and write parameters may also be sorted by, for example, random sorting. In this regard, the embodiments of the present disclosure are not limited. The order of the read and write parameters is the order of data transfer of the peripheral controller. By sorting the read and write parameters, flexible sorting of data transfer of the peripheral controller can be achieved, thereby adapting to the specific needs of various application scenarios.

[0116] In some embodiments, the configuration and enabling of the DMA controller for each group of read-write parameters in a pipelined manner may include: first, the second processor configures the DMA controller for the first read-write parameter ranked first to allocate a first DMA channel for carrying peripheral data of the first peripheral controller, enables the first DMA channel of the DMA controller, and the read address of the first read-write parameter is the data register address of the first peripheral controller; secondly, the second processor configures the DMA controller for the second read-write parameter ranked second first to allocate a second DMA channel for carrying peripheral data of the second peripheral controller, enables the second DMA channel of the DMA controller, and the read address of the second read-write parameter is the data register address of the second peripheral controller; and so on, until the configuration and enabling of the DMA controller for all read-write parameters are completed.

[0117] In some embodiments, the pipelined transfer process of peripheral data may include: first, after the first DMA channel is enabled, the DMA controller uses the first DMA channel to transfer the peripheral data of the first peripheral controller to the shared memory space corresponding to the first peripheral controller in the shared memory and initiates a second interrupt, and the second processor responds to the second interrupt to initiate a third interrupt to the first processor to notify the first processor to read the peripheral data of the first peripheral controller from the shared memory space corresponding to the first peripheral controller in the shared memory; secondly, after the second DMA channel is enabled, the DMA controller uses the second DMA channel to transfer the peripheral data of the second peripheral controller to the shared memory space corresponding to the second peripheral controller in the shared memory and initiates a second interrupt, and the second processor responds to the second interrupt to initiate a third interrupt to the first processor to notify the first processor to read the peripheral data of the second peripheral controller from the shared memory space corresponding to the second peripheral controller in the shared memory; and so on, until the peripheral data of all peripheral controllers are stored in the shared memory and notified to the first processor.

[0118] Figure 4 The figure shows a schematic diagram of the pipeline transmission of peripheral data between three peripheral controllers (SPI, UART, and I2C) and the shared memory by the DMA controller. Figure 4 In the example, there are multiple groups of read-write parameters, namely, first read-write parameters, second read-write parameters and third read-write parameters. The first read-write parameters are for SPI, the second read-write parameters are for UART, and the third read-write parameters are for I2C.

[0119] See also Figure 4 , the data transfer process for multiple peripheral controllers may include:

[0120] The applications of three peripherals (i.e., SPI device, UART device, and I2C device) simultaneously initiate read requests. In response to these read requests, the first processor writes corresponding three sets of read / write parameters and their corresponding read instructions into the shared memory and issues a first interrupt to the second processor.

[0121] In response to the first interrupt, the second processor sorts the corresponding three peripheral controllers according to the priority, wherein the SPI has the highest priority, the UART has the second highest priority, and the I2C has the lowest priority;

[0122] According to the order, the second processor first configures and enables the DMA controller to allocate the first DMA channel to the SPI, and after the configuration is completed, the core resources of the second processor are automatically released;

[0123] After the DMA controller is enabled, the first DMA channel is used to move the peripheral data from the SPI data register to the SPI shared memory space. At the same time, the second processor continues to configure and enable the DMA controller to allocate the second DMA channel to the UART. After the configuration is completed, the core resources of the second processor are automatically released again. After that, the second processor configures and enables the DMA controller again to allocate the third DMA channel to the I2C.

[0124] After completing the SPI peripheral data transfer, the DMA controller initiates a second interrupt to the second processor, and continues to use the second DMA channel to transfer the peripheral data from the UART data register to the shared memory space of the UART according to the enabling sequence after issuing the second interrupt. At the same time, the second processor initiates a third interrupt to the first processor in response to the second interrupt to notify the first processor of the execution result of the SPI data transfer. The first processor reads the SPI peripheral data from the shared memory space of the SPI in response to the third interrupt.

[0125] After completing the UART peripheral data transfer, the DMA controller again initiates a second interrupt to the second processor, and continues to use the third DMA channel to transfer the peripheral data from the I2C data register to the I2C shared memory space in the enabling order after issuing the second interrupt. At the same time, the second processor responds to the second interrupt and initiates a third interrupt to the first processor to notify the first processor of the execution result of the UART data transfer. The first processor responds to the third interrupt and reads the UART peripheral data from the UART shared memory space.

[0126] Finally, after completing the I2C peripheral data transfer, the DMA controller initiates the second interrupt to the second processor for the third time. After issuing the second interrupt, the DMA controller stops the data transfer. At the same time, the second processor responds to the second interrupt and initiates the third interrupt to the first processor to notify the first processor of the execution result of the I2C data transfer. The first processor responds to the third interrupt and reads the I2C peripheral data from the I2C shared memory space. At this point, the peripheral data transfer of the three peripheral controllers is completed.

[0127] pass Figure 4 It can be seen that in the peripheral data transmission process of multiple peripheral controllers, the embodiment of the present disclosure can adopt pipeline execution. The second processor only needs to execute the configuration and enablement of the DMA controller. The DMA controller can complete the data transfer without the participation of the second processor. Therefore, the transmission efficiency of the peripheral data is higher, and the data congestion of the second processor is also effectively solved.

[0128] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0129] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. The program includes instructions. When the instructions are executed by one or more processors of a computing device, the steps of the peripheral data transmission method of the on-chip system described in the aforementioned method embodiment are executed.

[0130] The embodiment of the present disclosure further provides an electronic device, which may include the aforementioned system on chip 100.

[0131] Another electronic device provided by the present disclosure is as follows: Figure 5 As shown, the electronic device 500 includes one or more processors 501, and also includes a memory 502 for storing one or more programs, which are executed by the one or more processors 501 to implement the method flow shown in the above embodiments of the present disclosure and / or the program units corresponding to each unit in the device.

[0132] The various components are interconnected using different buses and can be mounted on a common motherboard or in other ways as needed. The processor 501 can process instructions executed within the electronic device, including instructions stored in or on the memory to display graphical information of the user interface on an external input / output device (such as a display device coupled to the interface). In other embodiments, if desired, multiple processors and / or multiple buses can be used with multiple memories and multiple memories.

[0133] The processor 501 may include one or more single-core processors or multi-core processors. The processor 501 may include any combination of general-purpose processors or dedicated processors (such as image processors, application processors, baseband processors, etc.).

[0134] The memory 502 is a computer-readable storage medium provided by the present disclosure, which can be used to store non-transient software programs, non-transient computer executable programs and units, such as the following in the embodiments of the present disclosure: Figure 2 The processor 501 executes the non-transient software programs, instructions and units stored in the memory 502, thereby executing the above method embodiments. Figure 2 The methods shown correspond to programs, instructions, and units.

[0135] The electronic device 500 may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.

[0136] The input device 503 can receive input digital or character information, and generate signal input related to user settings and function control related to the debugging device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 504 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0137] The above-mentioned programs (also referred to as software, software applications, or codes) include machine instructions for programmable processors, and these computer programs can be implemented using object-oriented programming languages, assembly or machine languages.

[0138] With the development of time and technology, the meaning of medium is becoming more and more extensive, and the propagation path of computer programs is no longer limited to tangible media, and can also be downloaded directly from the network, etc. Any combination of one or more computer-readable storage media can be used. Computer-readable storage media can be used but not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing programs, which can be used by or in combination with instruction execution systems, devices or devices.

[0139] The technical solution provided by the present disclosure is described in detail above. The principles and implementation methods of the present disclosure are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present disclosure. At the same time, for those skilled in the art, according to the idea of ​​the present disclosure, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present disclosure.

[0140] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.

Claims

1. A peripheral data transmission method of a system on chip, characterized in that: The system on chip includes a first processor, a second processor, a direct register access DMA controller, a peripheral controller, and a shared memory, wherein the DMA controller, the shared memory, and the second processor are connected to the same bus; The peripheral data transmission method of the system on chip includes: The first processor writes read and write parameters for the peripheral controller into the shared memory; The second processor configures and enables the DMA controller using the read and write parameters; After being enabled, the DMA controller moves the peripheral data in the peripheral controller to the shared memory, so that the first processor can read the peripheral data from the shared memory.

2. The method according to claim 1, characterized in that The second processor configures and enables the DMA controller using the read / write parameters, including: The second processor estimates the bus transmission duration according to the peripheral bus transmission rate and the amount of read and write data indicated by the read and write parameters, and the peripheral bus is used to connect the peripheral controller; If the bus transfer duration is greater than the DMA configuration duration threshold, the second processor configures and enables the DMA controller.

3. The method according to claim 2, characterized in that Also includes: If the bus transfer duration is less than or equal to the DMA configuration duration threshold, the second processor reads the peripheral data from the data register address of the peripheral controller and sends it to the shared memory, so that the first processor can read the peripheral data from the shared memory.

4. The method according to claim 1, characterized in that: The second processor configures and enables the DMA controller using the read / write parameters, including: Determine a DMA channel corresponding to the peripheral controller; Setting the data register address of the peripheral controller as the source address of the DMA controller; Setting the shared memory space address corresponding to the peripheral controller to the target address of the DMA controller; Setting the data transmission length of the DMA controller according to the read / write data amount in the read / write parameters; Enable the DMA controller.

5. The method according to claim 4, characterized in that The determining of the DMA channel corresponding to the peripheral controller includes one of the following: Apply for an idle DMA channel of the DMA controller and bind the idle DMA channel to the peripheral controller; If the DMA channel bound to the peripheral controller is currently marked as idle, directly use the DMA channel bound to the peripheral controller; If all DMA channels in the DMA controller are occupied, retrieve the DMA channels in the bound state, release the DMA channels marked as idle and in the bound state to obtain the idle DMA channels, and bind the idle DMA channels to the peripheral controller.

6. The method according to claim 1, characterized in that The DMA controller transfers the peripheral data in the peripheral controller to the shared memory so that the first processor can read the peripheral data from the shared memory, including: The DMA controller transfers the peripheral data stored at the data register address of the peripheral controller to the shared memory, and initiates a second interrupt after the transfer is completed; In response to the second interrupt, the second processor runs an interrupt service function to initiate a third interrupt to the first processor, so that the first processor reads the peripheral data from the shared memory in response to the third interrupt.

7. The method according to claim 1, characterized in that The second processor is provided with a handling task module, and the handling task module is used to wake up the DMA controller configuration program of the second processor in response to the first interrupt from the first processor; The second processor configures and enables the DMA controller using the read / write parameters, specifically: the second processor runs a DMA controller configuration program to complete the configuration and enabling of the DMA controller.

8. The method according to claim 1, characterized in that The read-write parameters include multiple groups, each group of read-write parameters is for a different peripheral controller; The second processor configures and enables the DMA controller using the read / write parameters, including: In response to a first interrupt initiated by the first processor, the second processor reads from the shared memory the multiple sets of read-write parameters written by the first processor, The second processor sorts the multiple groups of read and write parameters, and executes the configuration and enabling of the DMA controller of each group of read and write parameters in a pipeline manner according to the sorting. Different read and write parameters are assigned to different DMA channels to use different DMA channels to transfer peripheral data of different peripheral controllers.

9. The method according to claim 8, characterized in that The second processor sorts the multiple groups of read and write parameters, including: The second processor sorts the multiple groups of read and write parameters according to one of the following information: The priority of the peripheral controller corresponding to the read and write parameters; The timing of the read data request corresponding to the read and write parameters; The application priority for read data requests corresponding to the read and write parameters.

10. The method according to claim 8, characterized in that After being enabled, the DMA controller moves the peripheral data in the peripheral controller to the shared memory, so that the first processor can read the peripheral data from the shared memory, including: The DMA controller uses different DMA channels to pipeline the peripheral data of the peripheral controller to the shared memory according to the sequence, and initiates a second interrupt each time a DMA channel transmission completion is detected; Each time the second interrupt is received, the second processor initiates a third interrupt, and the third interrupt is used to notify the first processor that the peripheral data transmission of the corresponding peripheral controller is completed, so that the first processor reads the corresponding peripheral data from the shared memory in response to the third interrupt, until the peripheral data of the peripheral controller corresponding to multiple sets of read and write parameters can be read by the first processor.

11. The method according to claim 1, characterized in that: The peripheral controller includes one or more of the following: Universal serial communication interface UART; Serial communication bus interface I2C; Synchronous serial data interface SPI; Memory card interface SD / MMC; Digital audio interface I2S; Enhanced Serial Peripheral Interface eSPI.

12. A system on chip, characterized in that: The system on chip includes a first processor, a second processor, a direct register access DMA controller, a peripheral controller, and a shared memory, wherein the DMA controller, the shared memory, and the second processor are connected to the same bus; The first processor is used to write read and write parameters for the peripheral controller into the shared memory; The second processor is used to configure and enable the DMA controller using the read and write parameters; The DMA controller is used to transfer the peripheral data in the peripheral controller to the shared memory after being enabled, so that the first processor can read the peripheral data from the shared memory.

13. An electronic device, characterized in that: include: The system on chip of claim 12.

Citation Information

Cited By

  • Command control method and peripheral control system

    CN122633609A