CN109857686A - A kind of method that DMA data synchronous transfer becomes asynchronous transmission - Google Patents
A kind of method that DMA data synchronous transfer becomes asynchronous transmission Download PDFInfo
- Publication number
- CN109857686A CN109857686A CN201910230653.1A CN201910230653A CN109857686A CN 109857686 A CN109857686 A CN 109857686A CN 201910230653 A CN201910230653 A CN 201910230653A CN 109857686 A CN109857686 A CN 109857686A
- Authority
- CN
- China
- Prior art keywords
- data packet
- transmission
- cpu
- dma
- transfer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Abstract
The invention discloses a kind of methods that DMA data synchronous transfer becomes asynchronous transmission, S1, set high-priority task for the current data packet of transmission, being allocated resources to described by CPU is currently data packet;S2, the starting DMA transfer corresponding with the current data packet in the transmission process that CPU distributes resource to the current data packet, go to low priority task for the DMA transfer;The cpu resource that S3, release high-priority task occupy, resource needed for distributing the MDA transmission by CPU, completes the DMA transfer;S4, step S1 ~ S3 is repeated, realizes the data transfer operation of next data packet and its corresponding DMA transfer;DMA transfer corresponding with data packet in data transmission procedure and data packet can be transmitted asynchronous transmission by the present invention, improve the efficiency of transmission of data packet, and promote cpu busy percentage.
Description
Technical field
The invention belongs to the transmission technique field of DMA (DirectMemory Access, direct memory access) data, tools
Body is related to a kind of method of DMA data synchronous transfer change asynchronous transmission.
Background technique
DMA data transfer refers to that data-moving is gone to complete by other individually hardware system independently of CPU, does not have to CPU and joins
With data-moving;In the prior art, when data-moving is completed, general data moves hardware generation interrupt event and removes notice CPU,
Data-moving has been completed.But when encountering some special circumstances, such as when moving data is less, or interrupts expense and generate
Overhead it is excessive when, although using CPU is synchronous wait DMA data transfer to terminate by the way of often more efficiently;But together
The mode that step waits needs to occupy CPU, to the phenomenon that cpu resource waste occur, and data transmission efficiency is relatively low.
Summary of the invention
It is existing to solve the purpose of the present invention is to propose to a kind of method that DMA data synchronous transfer becomes asynchronous transmission
The wasting of resources phenomenon and corresponding data transmission efficiency occurred during DMA data synchronous transfer due to occupying cpu resource
Low problem, specific technical solution are as follows:
A kind of method that DMA data synchronous transfer becomes asynchronous transmission, the method includes the steps:
S1, high-priority task is set by the current data packet of transmission, being allocated resources to described by CPU is currently data packet;
S2, starting is corresponding with the current data packet in the transmission process that CPU distributes resource to the current data packet
The DMA transfer is gone to low priority task by DMA transfer;
The cpu resource that S3, release high-priority task occupy distributes the MDA transmission required resource, described in completion by CPU
DMA transfer;
S4, repeat step S1 ~ S3, realize the data packet of transmission in need and its corresponding DMA transfer data transfer operation.
The method that DMA data synchronous transfer of the invention becomes asynchronous transmission, in data transmission procedure, by data packet portions
It is set as high-priority task, DMA transfer corresponding with data packet is set as low priority task, first by CPU to high preferential
The allocation of packets resource of grade task is transmitted, and starts DMA transfer simultaneously, after current data packet is transmitted, release
Corresponding cpu resource, and the resource for distributing specified size to DMA transfer carries out DMA data transfer realizes that data packet and DMA's is different
Step transmission;Compared with prior art, the present invention can by data packet and DMA asynchronous transmission, improving data transmission efficiency and CPU's
Utilization rate.
Detailed description of the invention
Fig. 1 is the flow chart signal for the method that DMA data synchronous transfer described in the embodiment of the present invention becomes asynchronous transmission;
Fig. 2 is the cpu resource become in the embodiment of the present invention with the DMA data synchronous transfer during the method for asynchronous transmission
Switching diagram meaning.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described.
In embodiments of the present invention, a kind of method of DMA data synchronous transfer change asynchronous transmission is provided, specifically, side
Method comprises the following steps that
Step 1: setting high-priority task for the current data packet of transmission, being allocated resources to described by CPU is currently data
Packet.
Step 2: starting and the current data in the transmission process that CPU distributes resource to the current data packet
Corresponding DMA transfer is wrapped, the DMA transfer is gone into low priority task.Step 3: what release high-priority task occupied
Cpu resource, resource needed for distributing the MDA transmission by CPU, completes the DMA transfer.
Step 4: repeat the above steps one, step 2 and step 3, realize transmission in need data packet and its correspondence
DMA transfer data transfer operation.
Refering to fig. 1, in combination with corresponding source code, it is assumed that need to transmit n data packet altogether, n data packet is respectively provided with
For high-priority task, and low priority task is set by the corresponding DMA transfer of each data packet;In conjunction with Fig. 2, then when first
Data packet reaches, and first distributes resource to high-priority task by CPU, i.e., first handles the first data packet to the n-th data packet, and is locating
When managing each data packet, the corresponding DMA transfer of data packet is started and waits being given to low priority of the task;In low priority
Task start and when wait the corresponding DMA transfer of the first data packet to terminate, at this time the second new data packet, which reaches, needs
It handles, likewise, the second data packet is high-priority task;When having handled the second data packet, CPU release, low priority
DMA transfer task obtain scheduling and execute, at this time the DMA transfer of the first data packet or terminated to transmit, in actual operation,
There is no occupancy or less occupancy CPU time, and the DMA transfer for waiting the first data packet to be gone to terminate for the task of low priority;To
Realizing the transmission of synchronous DMA data from process becomes asynchronous transmission, substantially increases data transmission efficiency and cpu busy percentage.
The following are the processes of data processing and DMA transfer when handling by the method for the invention each data packet to describe
Source code, wherein Task 1 indicates that the description source code of data processing, Task 2 indicate the description source code of DMA transfer, specifically
Are as follows:
1 high-priority task code exemplary flow of Task
void TASK1_main(void)
{
EVTS reqEvts = Task1_Init();//TASK initialization
While(1)
{
EVTS evts = Event_Obtain(TASK1_ID, reqEvts, TRUE);// obtain all task
signal
evts &= reqEvts;// filter oneself task signal
task1 data procedure;
configure TASK2 parameters;
Send_signal(TASK2_ID, (void **)&pCmd);// TASK2 is sent a signal to, start TASK2
}
}
Task2 low priority task code exemplary flow
void TASK2_main(void)
{
EVTS reqEvts = Task2_Init();//TASK initialization
While(1)
{
EVTS evts = Event_Obtain(TASK2_ID, reqEvts, TRUE);// obtain all task
signal
evts &= reqEvts;// filter oneself task signal
configure DMA parameters, start DMA transfer.
while(1) //wait DMA transmission finished
{
If(DMA transfer finished)
break;
}
Send_signal(TASKn_ID, (void **)&pCmd);// other task is sent a signal to, continue subsequent processing
}
}
In embodiment, if multiple data packets need to be transmitted, each data packet treatment process includes Task 1 and Task 2 two
Process described by source code.
The method that DMA data synchronous transfer of the invention becomes asynchronous transmission, in data transmission procedure, by data packet portions
It is set as high-priority task, DMA transfer corresponding with data packet is set as low priority task, first by CPU to high preferential
The allocation of packets resource of grade task is transmitted, and starts DMA transfer simultaneously, after current data packet is transmitted, release
Corresponding cpu resource, and the resource for distributing specified size to DMA transfer carries out DMA data transfer realizes that data packet and DMA's is different
Step transmission;Compared with prior art, the present invention can by data packet and DMA asynchronous transmission, improving data transmission efficiency and CPU's
Utilization rate.
The foregoing is merely a prefered embodiment of the invention, is not intended to limit the scope of the patents of the invention, although referring to aforementioned reality
Applying example, invention is explained in detail, for a person skilled in the art, still can be to aforementioned each specific
Technical solution documented by embodiment is modified, or carries out equivalence replacement to part of technical characteristic.All utilizations
The equivalent structure that description of the invention and accompanying drawing content are done directly or indirectly is used in other related technical areas, together
Reason is within the invention patent protection scope.
Claims (1)
1. a kind of method that DMA data synchronous transfer becomes asynchronous transmission, which is characterized in that the method includes the steps:
S1, high-priority task is set by the current data packet of transmission, being allocated resources to described by CPU is currently data packet;
S2, starting is corresponding with the current data packet in the transmission process that CPU distributes resource to the current data packet
The DMA transfer is gone to low priority task by DMA transfer;
The cpu resource that S3, release high-priority task occupy distributes the MDA transmission required resource, described in completion by CPU
DMA transfer;
S4, repeat step S1 ~ S3, realize the data packet of transmission in need and its corresponding DMA transfer data transfer operation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910230653.1A CN109857686B (en) | 2019-03-26 | 2019-03-26 | Method for converting synchronous transmission of DMA data into asynchronous transmission |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910230653.1A CN109857686B (en) | 2019-03-26 | 2019-03-26 | Method for converting synchronous transmission of DMA data into asynchronous transmission |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109857686A true CN109857686A (en) | 2019-06-07 |
CN109857686B CN109857686B (en) | 2020-12-29 |
Family
ID=66901840
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910230653.1A Active CN109857686B (en) | 2019-03-26 | 2019-03-26 | Method for converting synchronous transmission of DMA data into asynchronous transmission |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109857686B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5881248A (en) * | 1997-03-06 | 1999-03-09 | Advanced Micro Devices, Inc. | System and method for optimizing system bus bandwidth in an embedded communication system |
CN101034383A (en) * | 2007-04-24 | 2007-09-12 | 北京中星微电子有限公司 | DMA controller and transmit method for implementing software/hardware reusing |
CN101634975A (en) * | 2009-08-20 | 2010-01-27 | 广东威创视讯科技股份有限公司 | Method for realizing DMA data transmission and apparatus thereof |
CN101661447A (en) * | 2008-08-26 | 2010-03-03 | 深圳艾科创新微电子有限公司 | Transmission device and transmission method for direct memory access |
CN102495818A (en) * | 2011-12-09 | 2012-06-13 | 上海爱信诺航芯电子科技有限公司 | Method for improving communication speed rate of software-mode serial peripheral interface (SPI) |
US20120254523A1 (en) * | 2008-02-27 | 2012-10-04 | Kentaro Shimada | Storage system which utilizes two kinds of memory devices as its cache memory and method of controlling the storage system |
CN103793342A (en) * | 2012-11-02 | 2014-05-14 | 中兴通讯股份有限公司 | Multichannel direct memory access (DMA) controller |
CN106294233A (en) * | 2015-06-29 | 2017-01-04 | 华为技术有限公司 | The transfer control method of a kind of direct memory access and device |
CN107562659A (en) * | 2016-06-30 | 2018-01-09 | 中兴通讯股份有限公司 | A kind of data-moving device and method |
CN109491937A (en) * | 2018-10-24 | 2019-03-19 | 山东超越数控电子股份有限公司 | A kind of data transmission method and device of Scatter-Gather DMA |
-
2019
- 2019-03-26 CN CN201910230653.1A patent/CN109857686B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5881248A (en) * | 1997-03-06 | 1999-03-09 | Advanced Micro Devices, Inc. | System and method for optimizing system bus bandwidth in an embedded communication system |
CN101034383A (en) * | 2007-04-24 | 2007-09-12 | 北京中星微电子有限公司 | DMA controller and transmit method for implementing software/hardware reusing |
US20120254523A1 (en) * | 2008-02-27 | 2012-10-04 | Kentaro Shimada | Storage system which utilizes two kinds of memory devices as its cache memory and method of controlling the storage system |
CN101661447A (en) * | 2008-08-26 | 2010-03-03 | 深圳艾科创新微电子有限公司 | Transmission device and transmission method for direct memory access |
CN101634975A (en) * | 2009-08-20 | 2010-01-27 | 广东威创视讯科技股份有限公司 | Method for realizing DMA data transmission and apparatus thereof |
CN102495818A (en) * | 2011-12-09 | 2012-06-13 | 上海爱信诺航芯电子科技有限公司 | Method for improving communication speed rate of software-mode serial peripheral interface (SPI) |
CN103793342A (en) * | 2012-11-02 | 2014-05-14 | 中兴通讯股份有限公司 | Multichannel direct memory access (DMA) controller |
CN106294233A (en) * | 2015-06-29 | 2017-01-04 | 华为技术有限公司 | The transfer control method of a kind of direct memory access and device |
CN107562659A (en) * | 2016-06-30 | 2018-01-09 | 中兴通讯股份有限公司 | A kind of data-moving device and method |
CN109491937A (en) * | 2018-10-24 | 2019-03-19 | 山东超越数控电子股份有限公司 | A kind of data transmission method and device of Scatter-Gather DMA |
Non-Patent Citations (2)
Title |
---|
GUOLIANG MA: ""Design and implementation of an advanced DMA controller on AMBA-based SoC"", 《2009 IEEE 8TH INTERNATIONAL CONFERENCE ON ASIC》 * |
余再祥: ""DMA并行传输机制的设计与实现"", 《微电子学与计算机》 * |
Also Published As
Publication number | Publication date |
---|---|
CN109857686B (en) | 2020-12-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3073374B1 (en) | Thread creation method, service request processing method and related device | |
CN108762896B (en) | Hadoop cluster-based task scheduling method and computer equipment | |
CN108270732B (en) | A kind of Streaming Media processing method and system | |
CN109697122B (en) | Task processing method, device and computer storage medium | |
JP5453825B2 (en) | Program parallel execution system and program parallel execution method on multi-core processor | |
EP3306866A1 (en) | Message processing method, device and system | |
CN106445659B (en) | A kind of spacecraft periodically blendes together Random Task dispatching method | |
JP6275865B2 (en) | Multi-channel access method and apparatus | |
CN108111337B (en) | Method and equipment for arbitrating main nodes in distributed system | |
CN116033025A (en) | Cloud edge cooperation-based power distribution network automatic calculation task scheduling method and system | |
CN104461722B (en) | A kind of job scheduling method for cloud computing system | |
CN104702534A (en) | Method and device for processing data of multi-process sharing port | |
CN106775975A (en) | Process scheduling method and device | |
CN109857686A (en) | A kind of method that DMA data synchronous transfer becomes asynchronous transmission | |
CN110401939B (en) | Low-power consumption bluetooth controller link layer device | |
CN110175078B (en) | Service processing method and device | |
CN102045199A (en) | Performance optimization method for multi-server multi-buffer zone parallel packet sending | |
CN109656716B (en) | Slurm job scheduling method and system | |
WO2012167591A1 (en) | Processing method and system for distributed operating command | |
CN209657106U (en) | Control equipment and system | |
CN108287748B (en) | Virtual machine and container parallel scheduling method | |
CN105992360B (en) | Resource allocation method and device | |
CN104796994A (en) | Resource scheduling method for wireless communication system | |
JP2010178098A (en) | Vehicle control network repeater | |
CN110519390A (en) | A kind of low-power consumption bluetooth controller link layer implementation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |