Direct memory access transfer controller and use

Abstract: A data transfer controller comprises a first register for storing address information for accessing a source area storing data to be transferred, a second register for storing first information relative to a number of data ready to be transferred, a third register for storing second information relative to a number of times by which a data transfer is performed in response to each transfer request, first means coupled to said first and third registers for performing a data transfer from the source area to a destination area by a number of times designated by said second information in response to each transfer request, and second means coupled to said second register and said first means for generating a transfer completion signal when the number of data transferred reaches the number designated by said first information.

Description: BACKGROUND OF THE INVENTION This invention relates to a data transfer controller for transferring data between a memory and a peripheral unit in a direct memory access (referred to as "DMA" hereinafter) manner. Description of the Prior Art In a data processing system using a microcomputer, it is frequently required to transfer data between a peripheral unit and a memory. If such a data transfer is performed by a central processing unit (referred to as "CPU" hereinafter) through an interrupt program routine responsive to an interrupt request from the peripheral unit, the so-called overhead for shifting the program process to the interrupt routine is increased to deteriorate the data processing efficiency. Therefore, as well known in the art, a DMA controller is provided for transferring data between a peripheral unit and a memory without intervention of the CPU, i.e. without intervention of a software program. DMA controller needs control and parameter information for performing the data transfer. These information is fed from CPU. When the DMA controller receives a data transfer request from a peripheral unit such as communication control circuit, a display control circuit or a printer, it requires a bus control right from CPU. In response thereto, CPU halts the current program processing and then transfers the bus control right to DMA controller. Thus, the DMA controller starts to perform data transfer between a peripheral unit and a memory. The data transfer by the DMA controller continues unit data are transferred between the memory and the peripheral unit by the number designated by CPU. When the data transfer is completed, the DMA controller supplies a completion signal to the peripheral unit and CPU. In response thereto, the peripheral unit copes with necessary procedure including prohibition against DMA transfer, whereas CPU prepares data to be next transferred and then reinitializes the DMA controller to write new control and parameter information into the DMA controller. Some peripheral unit, a printer in particular, requires only a few byte data per one DMA request and frequently issues such a DMA request. In this case, the DMA transfer completion condition frequently occurs, so that CPU must perform the reinitialization process for the controller to write thereinto necessary information such as a DMA startup address, the number of data to be transferred and so on. This means that CPU is required to have correspondingly great burden for the DMA controller. Moreover, the DMA controller refuses to accept the DMA transfer request until the reinitialization by CPU is completed, resulting in lowering in efficiency of DMA transfer. BRIEF SUMMARY OF THE INVENTION It is therefore an object of the present invention to provide an improved a data transfer controller. It is another object of the present invention to provide a DMA controller for enhancing the efficiency of DMA transfer without requiring a heavy program load of CPU. A data transfer controller according to the present invention is defined in appended claim 1. The controller does not generate the data transfer completion signal even when the data transfer responsive to one transfer request is completed. The completion signal is generated when the data transfer responsive to one transfer request is performed predetermined times to transfer all the data ready to be transferred from the source area to the destination area. BRIEF DESCRIPTION OF THE DRAWINGS The above and other objects, features and advantages of this invention will become more apparent from the following detailed description taken in conjunction with the accompanying drawings, wherein: Fig. 1 is a block diagram of a data processing system equipped with a DMA controller according to a first embodiment of the present invention; Fig. 2 is an internal block diagram of the DMA controller shown in Fig. 1; Fig. 3 is a block diagram of a terminal count control circuit shown in Fig. 2; Fig. 4 is a block diagram of a DMA count control circuit shown in Fig. 2; Fig. 5 is a timing chart for illustrating an operation of the first embodiment of the present invention; Fig. 6 is a memory map for illustrating an operation of the first embodiment of the present invention; Fig. 7 is a block diagram of a DMA controller according to a second embodiment of the present invention; Fig. 8 is a block diagram of a DMA controller according to a third embodiment of the present invention; Fig. 9 is a block diagram of a terminal count control circuit shown in Fig. 8; and Fig. 10 is a timing chart for illustrating an operation of the third embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION Referring to Fig. 1, a data processing system includes a DMA controller (referred to as "DMAC" hereinafter) 10 according to a first embodiment of the present invention. The data processing system further includes a CPU 11, a first peripheral unit 14, a printer 12 as a second peripheral unit 14, a memory 13. The DMAC 10 performs a data transfer between the memory 13 and the peripheral unit 12 or 14. Data and address buses 15, 16 interconnects the respective units 10 through 14 to one another. The data received by the peripheral unit 14 from an external I/O device (not shown) is transferred to memory 13 under the control of DMAC 10. CPU processes the data, and the processed data are transferred to the peripheral unit 12. The unit 12 controls the printing operation in response to the sent data. CPU 11 contains a program counter, program status word, various control registers and so forth (all not shown), executes a storing of instructions and controls the relinquishment and gaining of usage of the data bus 15 and address bus 16 to and from DMAC 10. Memory 13 includes a program memory storing a program for CPU 11 and a data memory for storing various data for CPU 11 and DMAC 10. The data memory in memory 13 contains an area assigned for DMA transfer. DMAC 10, on receiving a DMA request signal 100 from the peripheral unit 12, sends a bus control request signal 130 to CPU 11, and on receiving a bus-control acknowledge signal 140 from CPU 11, sends a DMA acceptance signal 110 to the peripheral unit 12. Then it performs the DMA transfer. In operation, when CPU 11 prepares in the memory 13 data to be transferred to the unit 12, it initializes DMAC 10 to write the initial address for DMA transfer, the number of times by which DMA transfer is performed or repeated in response to each DMA request, the number of data to be transferred or prepared, and so forth, by the program execution. Thereafter, CPU 11 proceeds to execute the program for other data processing. When DMAC 10 receives the DMA request signal 100, it sends the bus-control request signal 130 to CPU 11. CPU 11 arbitrates requests from other peripheral circuits, and, if there is no interrupt request higher in priority than the bus request of the DMAC, sends a bus-control acknowledge signal 140 to DMAC 10. On receiving bus-control acknowledge signal 140, DMAC 10 transmits to peripheral device 12 one-word data stored at the initial address in the memory area in memory 13 based on the preset initial address. The DMA address is thereafter incremented or decremented. DMAC 10 transmits to peripheral device 12 the next one-word data stored at the next address in memory 13 based on the updated DMA address. Similar DMA transfer is repeated the preset times. After the DMA transfer has been repeated the preset times, DMAC 10 withdraws the bus-control request signal 130 to return the usage right of the buses 15 and 16 to CPU 11. CPU 11 thereby resumes the program execution. The DMA address updated remains in DMAC 10. Again on receiving the DMA request signal 100 from the peripheral unit 12, DMAC 10 sends the bus-control request signal 130 and then receives the bus-control acknowledge signal 140. The DMA transfer is thereby performed by use of the DMA address previously updated. After the DMA transfer is repeated the preset times, the bus-control request signal 130 is withdrawn, as mentioned above. When all the data which bad been prepared by CPU 11 in the memory 13 have been transferred to the unit 12 by the repetition of the DMA transfer described above, DMAC 10 produces the DMA end signal 120 to CPU 11 and the peripheral unit 12. In response to the signal 120, CPU 11 prepares new data to be transferred to the unit 12 and then initializes DMAC 10 to write the control and parameter data for performing next DMA transfer operation on the newly prepared data. According to the system as described above, even if the peripheral unit 12 as a printer requires only a few words, 4 words for example, per one data transfer request, CPU is free from the DMAC initialization process responsive to the completion of each data transfer. The repetition of the DMA transfer responsive to each data transfer request can be accomplished so far as data to be transferred are stored in successive addresses of the memory 13. Turning to Fig. 2, DMAC 10 includes a DMA request control circuit 200 which, once the request signal 100 receives, outputs a request flag signal 201, and on receiving an equality-detected signal 204 stated later, stops the request flag signal 201; a DMA access arbitration circuit 210 which, on receiving the request flag signal 201, outputs a bus control request signal 130 to CPU 11 (Fig. 1), and on receiving a bus control acknowledge signal 140 from CPU 11, outputs a DMA execution acknowledge signal 202; a DMA address generating circuit 230 including an address register 231 for storing the address for accessing the memory 13 and an address updating circuit 232 for incrementing or decrementing the content of the register 231; a terminal count control circuit 240; a DMA count control circuit 250; a DMA control register 260 for temporarily storing control information such as information representative of whether the DMA count control circuit 250 is activated or not, this information being outputted as an activation control signal 205 to DMA count control circuit 250; and a DMA response control circuit 220 which, on receiving the DMA execution acknowledge signal 202, sends the DMA acceptance signal 110 representive of execution cycle of DMA transfer to the peripheral equipment 12, and on receiving a DMA end detection signal 203, sends out a DMA end signal 120 to CPU 11 and unit 12. The respective circuits 210, 230, 240 and 250 run in synchronism with a bus-cycle reference signal 150 supplied from CPU 11. Referring to Fig. 3, the terminal count control circuit 240 includes a terminal count register 310 for storing information representative of the number of data ready to be transferred and stored in the memory 13, a decrementer 320 which, each time the data transfer is performed, reads out the content of terminal count register 310, decrements it by one, and restores the resultant data to the register 310, a zero detection circuit 330 supplied with the resultant data, and AND gates 30 and 31. The zero detection circuit 330 produces a zero detection signal 301 when the data from the decrementer 320 becomes "0". The AND gate 30 activates the decrementer 320 through a signal 302 when both the bus cycle reference signal 150 and DMA execution acknowledge signal 202 take an active level. The AND gate 31 responds to the zero detection signal 301 and the DMA execution acknowledge signal 202 to produce the DMA end detection signal 203. Turning to Fig. 4, the DMA count control circuit 250 includes register 410 for storing information representing times by which the data transfer is repeated or performed (i.e., representing how many times the data transfer is performed) in response to one transfer request, a counter 430 incremented each time DMA transfer is performed, a comparator 420 comparing the content of the register 410 with that of counter 430 to produce an equality signal 401 when both of them become equal to each other, an AND gate 41 for producing a count signal 402 in response to the bus cycle reference signal 150 and the DMA acknowledge signal 202, and an AND gate 42 for producing the signal 204 in response to the DMA acknowledge signal 202, the activation control signal 205 and the equality detection signal 401. Further detailed description on an operation will be made below with reference to Figs. 1 to 4 and further to Figs. 5 and 6. Assume that the peripheral unit (printer) 12 needs 4-word per one data request. Data to be transferred to the unit 12 are prepared by CPU 11 and then stored in a source area B1 of the memory 13 as shown in Fig. 6. The area B1 has a starting address TA. The data to be transferred are stored from the starting address TA up to an address EA + 1. The number of the data is assumed to be 40 in the present description. CPU 11 continues to execute a program and then initialize DMAC 10. More specifically, the DMA control register 260 is set with information representing the number of bits to be transferred by each DMA-transfer procedure and with mode information representing the activation of the DMA count control circuit 250. In this embodiment, the number of bits to be transferred at a time is one word, that is, 16 bits. The activation control signal 205 goes to the active state (high level). The address register 231 (Fig. 2) is set with the starting address TA (Fig. 6). The terminal count register 310 is set with "40" and the register 410 is set with "3". The counter 430 is previously reset. After these initialization, CPU 11 proceeds to the program execution for other data operations with continuously checking the generation of the bus control request signal 130 from DMAC 10. On the other hand, when the peripheral device 12 is commanded to start printing, it produces the DMA request signal 100 to DMAC 10. In response to the signal 100, the DMA request control circuit 200 activates the request flag 201 (see bus cycle (A) in Fig. 5). In response thereto, the DMA access arbitration circuit 210 sends the bus control request signal 130 to CPU 11. CPU 11, on receiving bus-control reques signal 130, halts its current program processing by holding the contents of the program counter (PC), the program status word (PSW) and the various registers as they are and by bringing bus terminals to a high impedance state, and then returns the bus control acknowledge signal 140 to DMAC 100. In response thereto, the DMA access arbitration circuit 210 changes the DMA execution acknowledge signal 202 to the active level (see bus cycle (B) in Fig. 5) to initiate the DMA execution cycle. In the DMA execution cycle, in synchronism with the bus cycle reference signal 150, a read bus cycle is initiated by DMAC 10 using the content (address TA at the startup) of address resistor 231 (Fig. 2) to read out the data stored in the address TA of the memory 13. This data is in turn transferred to the peripheral device 12 via the data bus 15. The content of the address register 231 is thereafter updated to a next address (TA + 1) by the circuit 232. In the terminal count control circuit 240, since the DMA execution acknowledge signal 202 is in the active (high) level, the signal 302 (Fig. 3) is generated to command the decrementer 320 to decrement the content of the register 310 by one. In the DMA count control circuit 250, the count signal 402 (Fig. 4) is generated to increment the content of the counter 430 by one (see bus cycle (C) in Fig. 5). The count value of counter 430 may be outputted as a count signal 206 to inform that whether or not DMA transfer is being executed. When the DMA transfer is repeated 4 times, i.e. when 4-word data are transferred to the unit 12, the content of counter 430 become "3" (see bus cycle (E) in Fig. 5), so that the comparator 420 produces the signal 401. Since both the DMA execution acknowledge signal 202 and the control signal 205 are at the high level, the signal 204 is generated (see the (E) in Fig. 5). In response to the signal 204, the DMA request control circuit 200 withdraws the request flag signal 201. This causes that the DMA access arbitration circuit 210 stops the generation of the bus control request signal 130 and changes the DMA execution acknowledge signal 202 to an inactive low level (see bus cycle (E) in Fig. 5). By the above-described process 4-word data stored in the area A1 of the memory 13 are transferred to the peripheral unit 12. After this, the content of address register 231 represents the address "TA + 4". Similarly, the content of the terminal count register 310 are updated to the value "36". The counter 430 are automatically initialized to "0" (see the bus cycle (F) Fig. 5). On the other hand, since the signal 130 is withdrawn, CPU 11 resumes the suspended program execution by use of the contents of the PD, PSW and various registers. When the peripheral unit 12, produces again the DMA request signal 100, the DMA data transfer is again initiated in the manner as described above and performed 4 times based on information stored in the address registers 231 and 310. Each time the DMA request signal 100 is produced, the DMA transfer is repeated 4 times. When 40-word data, i.e. all the data stored in the area B1 of the memory 13 has been transferred to the unit 12, the content of the terminal count control register 310 go to "0". The circuit 330, thereby produces the zero detection signal 301. Since the DMA execution acknowledge signal 202 is at high level, the DMA end detection signal 203 goes to the active high level. In response the DMA end detection signal 203, the DMA response control circuit 220 sends the DMA end signal 120 to the peripheral unit 12 and CPU 11. CPU 11 thus recognize all the data having been transferred, so that it initializes again DMAC 10 after preparing and setting next data to be transferred into the memory 13. If the control register 260 (Fig. 2) is set with information for deactivating the DMA count control circuit 250, the control signal 205 remains low to invalidate the signal 204. In this case, DMAC 10 performs a conventional DMA-transfer using the DMA address generating circuit 230 and the terminal count control circuit 240. In place of setting the register 260 with information for deactivating the DMA count control circuit 250, the register 410 may be set with a value which never become equal to the content indicated by the counter 430. no equality signal 401 is thereby produced by the comparator circuit 420. This is equivalent to the deactivation of the DMA count control circuit 250. According to the present invention, each DMA transfer round in which DMA transfer is repeated a preset number of times at one DMA request can be followed by the next DMA-transfer round without initialization of DMAC 10 by CPU 11. Therefore, so far as the memory area in memory from which DMA transfer of data is transferred is indicated by successive addresses or addresses with a predetermined relationship, it is possible to perform the data transfer without needing the initialization by CPU at each DMA request, contributing to much offloading the proceeding function of CPU. Referring to Fig. 7, DMAC according to a second embodiment of the present invention is distinguished from DMAC of Fig. 2 in that the equality detection signal 204 from the DMA count control circuit 250 is supplied as control signal to the terminal count control circuit 240. Other constructional parts are the same as those shown in Fig. 2. The signal 204 is supplied to the AND gate circuit 30 instead of bus cycle reference signal 150. Accordingly, each time the detection signal 204 is produced, the content of the terminal count register 310 is decremented by one. Since the content of the counter 310 is decremented after a plurality of data ("4" in the above description) are transferred, the register 310 is initially set with information representing how many DMA request signals 100 can be received. In the above description, "10" is set into the counter 310. According to this embodiment, the terminal count register 310 can be constituted with the smaller number of bits. The decrementer 320 is also constituted with a smaller scale. Referring to Fig. 8, there is shown DMAC according to a third embodiment of the present invention. This DMAC responds to two kinds of DMA request signals 100a and 100b from the peripheral unit 12 to enable to select different DMA transfer in accordance with which kind of DMA request signal is sent from. More specifically, DMA request control circuit 200a has two inputs supplied with signals 100a and 100b. Once either of the input signals goes active, it responds to this with sending the request flag signal 201 to the DMA access arbitration circuit 210, and at the same time causing either one of the channel selection signals 800a and 800b to go active. The signals 800a and 800b are supplied to a DMA count control circuit 850 which further receives the bus cycle reference signal 150, the DMA execution acknowledge signal 202, and the activation control signal 205. Referring to Fig. 9, the circuit 850 includes registers 410a and 410b each storing information representing how many data are to be transferred in response to one DMA transfer request, a selector 910 selecting and outputting either one of the data stored in the registers 410a and 410b in response to the signals of 800a and 800b, an AND gate circuit 91 supplied with the bus cycle reference signal 150, the DMA acknowledge signal 202 and the activation signal 205 and outputting a count signal 901, a subtracter 920 subtracting the data of the selector 910 by one in response to each count signal 901 and outputting a zero detection signal 902 when the subtracted resultant becomes zero, and an AND gate 92 responding to the zero detection signal 902 and the DMA acknowledge signal 202 to output the equality detection signal 204. The operation of this DMAC will be described with reference also to Fig. 10. CPU 11 (Fig. 1) performs initialization of DMAC by the program before DMA transfer process. Initialization of the DMA control register 260, the address register 231 and the terminal count control circuit 240 is the same as that in the first embodiment and hence the description of it is omitted. In the DMA count control circuit 850, the registers 410a and 410b are set with different data. In this description, the register 410a is set with "3" and the register 410b to "4". When the peripheral unit 120 sends the DMA request signal 100a to DMAC 10, the DMA request control circuit 200a changes both the request flag 201 and the channel selection signal 800a to the active level. In response to the signal 800a, the selector 910 sends the data of the register 410a, "3", to the subtracter 920 (see bus cycle (A) in Fig. 10). On the other hand, the DMA access arbitration circuit 210 sends a bus control request signal 130 to CPU 11 to get the bus usage right. CPU 11 returns the acknowledge signal 140. In response thereto, the DMA access arbitration circuit 210 produces the active DMA execution signal 202 (see bus cycle (B) in Fig. 10) to initiate the DMA execution cycle. In the DMA execution cycle, in synchronism with the bus cycle reference signal 150, the read bus cycle is performed using the content of the address register 231 (Fig. 2) to read out the data from the memory 13. The read-out data is thus transferred to the peripheral unit 12 via the data bus 15. In the DMA count control circuit 850, the count signal 901 is produced every bus cycle, so that the subtracter 920 decrements the content from the register 410a (see bus cycles (C) and (D) in Fig. 10). When the DMA-transfer is repeated 4 times to transfer 4-word data to the unit 12, the subtracter circuit 920 produces the signal 920 (see bus cycle (E) in Fig. 10). The equality detection signal 204 is thereby generated. In response to the signal 204, the DMA request control circuit 200a resets the request flag signal 201, resulting in that the DMA access arbitration circuit 210 withdraws the bus-control request signal 130 to suspend the DMA-transfer. CPU 11 thereby resumes the suspended program operation. When the next DMA request signal 100a is generated again, the same DMA-transfer procedure as delineated above is repeated 4 times. When all the data prepared in the memory 13 are transferred to the unit 12, the terminal count control circuit 240 produces the DMA end detection signal 203. In response to the signal 203, the DMA response control circuit 220 sends the DMA end signal 120 to the unit 12 and CPU 11. In case where, another peripheral device, which needs 5-word data per one transfer request, produces the DMA request signal 100b, the register 410b is selected by the signal 800b. Thus, the data transfer is repeated to transfer 5-word data to the peripheral unit. DMA count control circuit 850, instead of generating the equality detection signal 204 by the subtracter 920, may be constructed in the same way as DMA count control circuit 250 shown in Fig. 4. On the contrary DMA count control circuit 250 shown in Fig. 4 may be constructed so as to decrement the value of DMA-transfer NPR register 410 by a subtracter circuit, in the same way as the construction of DMA count control circuit 850, and thus can use zero-detection signal as equality detection signal. Although the invention has been described with reference to specific embodiments, this description is not meant to be construed in a limiting sense. Various modifications of the disclosed embodiment, as well as other embodiments of the invention, will become apparent to persons skilled in the art upon reference to the description of the invention. It is therefore contemplated that the appended claims will cover any modifications or embodiments as fall within the scope of the invention as claimed.

Claims: A data transfer controller for performing a data transfer from a data source unit (13) to a data destination unit (12) in response to a transfer request from said data destination unit (12), comprising: first register means (231) for storing address information for accessing a source area (B1) of said data source unit (13), said source area (B1) storing a plurality of data to be transferred, said address information being updated each time data is transferred from said data source unit (13) to said data destination unit (12), and second register means (310) for storing information indicative of a first number of said data stored in said source area (B1), characterized by further comprising: third register means (410) for storing information indicative of a second number of data to be successively transferred from said source area (B1) to said data destination unit (12) each time said data destination unit (12) generates said transfer request (100), data transfer means (230,250) coupled to said first and third register means (231,410) for successively performing a data transfer a plurality of times each time said data destination unit (12) generates said transfer request (100) to thereby successively transfer the data stored in said source area (B1) to said data destination unit (12) by a number designated by the information in said third register means (410), and signaling means (240) coupled to said second register means (310) and said data transfer means (230,250) for generating a transfer completion signal (203) when a number in total of data transferred from said data source unit (13) to said data destination unit (12) by said data transfer reaches the number designated by the information in said second register means (310). Use of a data transfer controller in a data processing system which includes a CPU (11), a memory (13), a peripheral unit (12), said data transfer controller (10) transferring data between said memory (13) and said peripheral unit (12) in place of said CPU (11) and comprising: a first register (231) for storing address information for accessing an area (B1) of said memory (13) storing data to be transferred, first means (210) responsive to each transfer request (100) of said peripheral unit (12) for requiring a bus control right from said CPU (11), and a second register (310) for storing first information relative to a first number of data transfer times necessary for transferring all data prepared in the area (B1) of said memory (13), characterized in that said data transfer controller (10) further comprises: a third register (410) for storing second information representing a second number of data transfer times to be performed in response to one transfer request (100) of said peripheral unit (12), second means (230,250) coupled to said first and third registers (231,410) and said first means (210) for performing a data transfer for transferring data between said memory (13) and said peripheral unit (12) by said second number represented by said second information, third means (250) for returning said bus control right to said CPU (11) after said data transfer is performed by said second means (230,250) by said second number, and forth means (240) coupled to said second register (310) and said second means (230,250) for informing said CPU (11) of completion of a data transfer when the data transfer performed by said second means (230,250) reaches said first number represented by said first information.

Inventors: KATAYOSE TSUYOSHI, KOHZONO ICHIRO, KATAYOSE, TSUYOSHI, KOHZONO, ICHIRO, KATAYOSE, TSUYOSHI, C/O NEC CORPORATION, Kohzono, Ichiro, c/o NEC Corporation
Applicants: NIPPON ELECTRIC CO, NEC CORPORATION
Application year: 1991
Main classification: G06F13
IPC codes: G06F13