Background technology
In the prior art, when high-speed peripheral will and Installed System Memory or will zones of different at Installed System Memory between, when carrying out the quick transmission of mass data, adopt the direct memory access mode to transmit defeated certificate usually.
Direct memory visit (DMA) mode is opened up direct exchanges data path between peripherals and main memory, during operate as normal, all working cycle all is used to carry out the program of CPU; Behind the DSR that peripherals will input or output, steal or divert a work period, for peripherals and the direct swap data of main memory.After this cycle, CPU continues to carry out original program again.This mode is to increase dedicated processes parts dma controller to replace central processing unit work in IOS, and makes the direct and main memory dealing of the data that transmit in batch, by the DMA parts data of data block is counted and definite core address one by one.Except carrying out respectively not needing the intervention of CPU pre-treatment and the aftertreatment with interrupting when the starting and ending of data block.
The most tangible characteristics of DMA are that it is not with software but adopts a special controller to control internal memory to exchange with data between the peripheral hardware, need not get involved by CPU, improve the work efficiency of CPU greatly.Before carrying out the transmission of DMA data, dma controller can be applied for bus control right to CPU, if CPU allows, then control is surrendered, therefore, when exchanges data, bus control right is grasped by dma controller, and after end of transmission (EOT), dma controller is given back CPU with bus control right.
In traditional DMA transport process, generally to do the bus cycles and steal and finish, single transmits and often takies 3~5 bus cycles, for high-speed bus, by frequent cycle stealing, can influence bus bandwidth.
To high-speed bus, the DMA requesting party also needs bandwidth requirement on the other hand, to improve the DMA transmission efficiency.In the SOC design, there is very big gap (as outside DMA request) in the I/O memory access speed of bus transfer rate and DMA device, does not very mate, and traditional DMA device has reduced the transfer efficiency of high-speed bus.
Summary of the invention
The technical problem to be solved in the present invention provides a kind of direct memory access means, improve the data transmission efficiency between high-speed bus and the low speed bus, when adopting a plurality of DMA device, not obvious to the influence of bus transmission efficiency, improved the SOC chip performance on the whole.
In order to solve the problems of the technologies described above, the invention provides a kind of direct memory access transport device, comprise a buffer zone, the value of fastening control module, APB bus interface module, WB bus interface module and a control circuit module, the setting of the door value of fastening in the described door of the register controlled in the described control circuit module value of fastening control module, by being set, the keeper value decide the speed of described direct memory access transport device transmission data adaptive, wherein:
The described door value of fastening control module is used to set the size of the door value of fastening;
Described APB bus interface module is used for being connected of described direct memory access transport device and high-speed bus;
Described WB bus interface module is used for being connected of described direct memory access transport device and low speed bus;
Described control circuit module is used for above-mentioned module, data flow and transmission speed coupling.
In such scheme, the asynchronous handshake processing module, DMA FIFO that described control circuit module comprises single read/write process module towards low speed bus, doubleclocking territory be pointer management module and towards the Burst read/write operation processing module of high-speed bus end to end.
In such scheme, the dynamic change of described door value of fastening, control bus cycle stealing frequency.
In such scheme, the data transmission between described direct memory access transport device and the high-speed bus is finished by the BURST operation.
A kind of direct memory access transport device, comprise a buffer zone, the door value of fastening control module, APB bus interface module and control circuit module, the setting of the door value of fastening in the described door of the register controlled in the described control circuit module value of fastening control module, by being set, the keeper value decide the speed of described direct memory access transport device transmission data adaptive, described direct memory access transport device directly links to each other with peripheral hardware, wherein:
The described door value of fastening control module is used to set the size of the door value of fastening;
Described APB bus interface module is used for being connected of described direct memory access transport device and high-speed bus;
Described control circuit module is used for above-mentioned module, data flow and transmission speed coupling.
The invention provides a kind of direct memory access transmission method, may further comprise the steps:
A) determine whether high-speed bus supports the Burst operation,, it can be transformed into and support the Burst operation if do not support;
B) row buffer of being with keeper is set;
C) set up buffer head tail pipe reason mechanism;
D) determine dma control circuit,, start data fifo and go into/go out management according to DMA control mode decoding corresponding control signal, the transfer operation of low speed bus read/write, high-speed bus Burst operation, and return the various states of accusing;
E) determine the cross clock domain handshake mechanism;
F) towards the Burst operational design of high-speed bus, bus B urst operation often has strict sequential requirement, and FIFO goes into/and going out may be not too consistent, need carry out indirect conversion, makes both sides can carry out complete Burst operation;
G) transfer operation of low speed bus design.
As from the foregoing, a kind of direct memory access means of the present invention and method thereof improve the data transmission efficiency between high-speed bus and the low speed bus, when adopting a plurality of DMA device, not obvious to the influence of bus transmission efficiency, improved the SOC chip performance on the whole.
Embodiment
Describe technical scheme of the present invention in detail below in conjunction with accompanying drawing.
Fig. 1 is direct memory visit conveyer structural drawing of the present invention, as shown in the figure, direct memory visit (DMA) conveyer is made up of keeper value control module 1, APB bus interface 2 (towards the high speed processor bus), WB bus interface 3 (towards the peripheral bus of low speed), fifo buffer 4 and control circuit module 5.
Each passage of DMA all is furnished with mode control register, the first location of memory buffer register, DMA address register and transmits the byte number register, wherein mode register provides the dirigibility of DMA channel arrangement, decides DMA to transmit the adaptive problem of speed by the keeper value is set.
Keeper value control module 1 is used to be provided with the door value of fastening, and when decision initiates data is moved fast; Require to select different keeper values for use at different DMA passages, it realizes that by the dma state control register in the control circuit module 5 the keeper value is a little bit smaller fast usually, otherwise selects the keeper value to reach a bit; APB bus interface 2 is mainly done the Burst operation, realizes that between APB high-speed bus and fifo buffer 4 rapid data transmits; WB bus interface 3 is mainly done the single read/write operation, towards dma device, can take the WB bus, also can not take the WB bus; Fifo buffer 4 is the data buffering areas that will transmit, guarantees that data are reliable and secure, is furnished with capable significance bit (FIFOvalid[i]), byte enable position FIFOen[i] [j]; Control circuit module 5 works in different clock-domains management FIFO, and DMA is transmitted data initiate control.
For DMA read operation (buffer zone from the dma device to SDRAM), as shown in Figure 2, when the DMA buffer zone can transmit byte number and reaches the keeper value, begin to carry out APB_wrBurst and transmit, in the transport process, in case initiate, the Burst size is variable (during the APB bus transmitted, dma device still can constantly write fifo buffer), till the buffer data sky, the each transmission is no less than 8*Criterion (keeper value) byte number, discharges the APB bus then.Dma device is constantly write number toward fifo buffer, in the time of can transmitting byte number and reach the keeper value again Deng the DMA buffer zone, repeat aforementioned number operation, (DMA passes on and finishes but will do " forcing sky " operation at last, but still have a few bytes in the FIFO), operate by mono-recordable and to finish.
For DMA write operation (from the buffer zone of SDRAM to dma device), as shown in Figure 3, pass data from SDRAM toward the DMA buffer zone, be as the criterion with the keeper value, when the buffering number that can place is no less than the keeper value, start APB_rdBurst, in the transport process, the Burst size is variable, and till expiring with buffer data, the each transmission is no less than 8*Criterion (keeper value) byte number.Dma device when waiting the buffering number that can place to be no less than the keeper value again, repeats aforementioned operation constantly from the fifo buffer reading of data, transmits until DMA and finishes.
In fact, during the dma device read operation as long as in the fifo buffer data are arranged, continuous reading of data just; , just continuous during the dma device write operation toward the buffer zone write data as long as buffer zone is discontented.As for the keeper value is to dispose for the high-speed bus transfer efficiency, and the keeper value is optionally by the setting of DMA passage, for system configuration has increased dirigibility, needs system suitably to dispose when initialization.DMA_mode (register) at first is set, control bit comprise interrupt enabling, transmitting that data width, direction of transfer, keeper choosing value, channel start, channel end, passage are clear, channel failure etc.; Secondly, the dma device address is set; The first location of buffer zone in the main memory is set then; The byte number that DMA transmits is set at last.
Fig. 4 is the dma control circuit module frame chart, as shown in the figure, places oneself in the midst of the quick DMA passage between high-speed bus and the low speed bus.Comprise a lower module: towards the single read/write process module 51 of low speed bus, mainly according to fifo status, organize DMA transfer operation (the quite main equipment of low speed bus), WB_ack is (at the corresponding WB_ack_h of doubleclocking territory difference, WB_ack_1), be to get handshake between the two, guarantee that data interaction is accurate; The asynchronous handshake processing module 52 in doubleclocking territory mainly towards FIFO (high-frequency clock territory) with towards the signal Synchronization problem between the single read/write process module 51 (low-speed clock territory) of low speed bus, guarantees that control signal is correctly reliable; DMA FIFO is pointer management module 53 end to end, and the head and the tail pointer during major control DMA data turnover FIFO is adjusted, and therefrom obtains the validity of byte number and buffering row; Burst read/write operation processing module 54 towards high-speed bus, mainly according to fifo status, if DMA writes transmission, then acknowledge(ment) signal Burst_inreq is (when the buffering number that can place is no less than the keeper value, the meeting set), if DMA reads to transmit, then acknowledge(ment) signal Burst_outreq is (when the DMA buffer zone can transmit byte number and reaches the keeper value, the meeting set), Burst_lastreq (does not transmit end if the byte number that transmits is not complete row and DMA, the meeting set), initiate Burst operation (the quite main equipment of APB bus) to the APB bus.
The DMA workflow as shown in Figure 4, when low-speed device requires to carry out the DMA read operation, FIFO pointer processing element end to end holds number to low speed bus initiation read operation according to impact damper, till buffer zone " near full " state (only empty delegation), processing element is initiated the Burst write operation according to the keeper value to high-speed bus during this period, till buffer zone does not have complete line to transmit, in case the DMA counter is " zero ", just do the buffer zone operation of " forcing sky ", and be DMA and transmit end process; When low-speed device requirement carrying out DMA writes read operation, FIFO pointer processing element end to end holds number to high-speed bus initiation Burst read operation according to impact damper, till the byte number that buffer zone has been got surpasses Counter Value or buffer zone " near full " state (only empty delegation), processing element is initiated write operation according to buffer state to low high-speed bus during this period, till buffer zone does not have to transmit byte, in case the DMA counter is " zero ", just is DMA and transmits end process.
Fig. 6 is the quick DMA transfer approach of the Efficient and Flexible process flow diagram that is suitable for high-speed bus, does specifying in conjunction with block diagram:
Step 100: determine whether high-speed bus supports the Burst operation,, it can be transformed into and support the Burst operation if do not support;
Step 110: the row buffer that the band keeper is set, the width of row is consistent with the data width of high-speed bus usually, and establish corresponding row effective marker position FIFOvalid[n-1:0], wherein n is the total line number of buffer zone, every capable byte effective marker position FIFOen[n-1:0]] [m-1:0], wherein m is the byte number of row;
Step 120: set up buffer head tail pipe reason mechanism, transmit at the DMA read/write respectively and establish line pointer, as Head_wb (low speed bus writes), Tail_apb (high-speed bus reads); Head_apb (high-speed bus writes), Tail_wb (low speed bus reads).And calculate available buffering line number and valid data can pass line number.
Step 130: determine dma control circuit,, start data fifo and go into/go out management according to DMA control mode decoding corresponding control signal, the transfer operation of low speed bus read/write, high-speed bus Burst operation, and return the various states of accusing.
Step 140: determine the cross clock domain handshake mechanism, increase answer signal WB_ack etc., (passing through WB_ack) finished in low speed bus processing module affirmation FIFO operation, could stop current transfer operation, but the WB_ack signal will carry out the cross clock domain operation.
Step 150: towards the Burst operational design of high-speed bus, bus B urst operation often has strict sequential requirement, and FIFO goes into/going out may be not too consistent, need carry out indirect conversion, make both sides can carry out complete Burst operation, certainly also to support the mono-recordable operation, may not enough buffer lines when transmitting ending because of DMA.
Step 160: the transfer operation design of low speed bus, this transfer operation may be single also may be block transfer, this will treat with a certain discrimination, fairly simple to single pass operation, as long as confirming data advances/goes out FIFO and just finish transfer operation, for the block transfer operation a bit, need monitoring FIFO overflow problem, might stop the block transfer operation at any time with regard to more complicated.
Dma operation of the present invention must have DMA passage initialization operation, and will do asynchronous process to the fifo buffer control operation, because controlling resource is shared, except interlock process, also wants asynchronous handshake, guarantees that control operation safety carries out.
In addition, the quick DMA conveyer of Efficient and Flexible can apply in the sheet (as LCD show, UART transmits fast, USB transmits fast) and the DMA rapid data transmission of sheet outer (transmitting) as outside DMA, control circuit module in the DMA transmitting device can directly not connect in LCD by the total toe-in mouth of WB, realizes data transmission; 16 DMA passages can be provided, greatly improve the usefulness that the SOC data transmit, promote bus transfer efficient greatly.
In sum, the present invention adopts the Burst operation of AS bus, DMA FIFO, dma device control, the APB_Burst operation, DMA FIFO, DMA reads and writes the trinity, finish DMA transfer operation efficiently jointly, the quick DMA of Efficient and Flexible transmits and is implemented in the dma control circuit module, fast interface articulates APB_Bus, DMA interface is mounted on WB_Bus, each passage all is furnished with the mode control register, the first location of memory buffer register, DMA address register and transmission byte number register, wherein mode register provides the dirigibility of DMA channel arrangement, decides DMA to transmit the adaptive problem of speed by the keeper value is set.And be out that available more DMA transfer equipment, high line send efficient, improve chip performance on the whole.