The present application is based upon and claims the benefit of priority from the prior Japanese Patent Application No. 2005-064358 filed on Mar. 8, 2005, with the Japanese Patent Office, the entire contents of which are incorporated herein by reference.
1. Field of the Invention
The present invention generally relates to data transfer systems and data transfer methods, and particularly relates to a DMA transfer system and DMA transfer method.
2. Description of the Related Art
A DMA (direct memory access) transfer system achieves high-speed data transfer by transferring data directly from a source to a destination without having an intervening CPU.
A DMA transfer system 10 shown in
The CPU 11 specifies a transfer source address, a transfer destination address, transfer data size, an increment/decrement of the transfer source address, an increment/decrement of the transfer destination address, etc., for DMA, thereby determining the settings of DMA transfer with respect to the DMA controller 13. In response, the DMA controller 13 performs the specified DMA transfer.
A description will be given below with respect to an example in which register data is transferred through DMA from the event counters 15-1 through 15-4 to the memory 14. Although the event counters are used as an example here, the operation of the DMA transfer remains the same even if macros having other functions are used.
The event counters 15-1 through 15-4 serve to count the pulses of data signals D0 through D4 during a period indicated by trigger signals TRG0 through TRG4, respectively. Namely, the event counter 15-1 starts counting the pulses of the data signal D0 when the trigger signal TRG0 becomes HIGH, and continues counting until the trigger signal TRG0 becomes LOW. When the counting comes to an end upon the change to LOW of the trigger signal TRG0, the count value is stored in an internal register of the event counter 15-1.
Upon completion of counting, the event counters 15-1 through 15-4 generate interruption signals INT0 through INT3. These interruption signals INT0 through INT3 are supplied to the interruption controller 12. In response to the interruption signals INT0 through INT3, the interruption controller 12 instructs the DMA controller 13 to start DMA transfer. In response, the DMA controller 13 performs DMA transfer.
The register set 20-1 of the event counter 15-1 includes registers RA0, RB0, and RC0. The register set 20-2 of the event counter 15-2 includes registers RA1, RB1, and RC1. The register set 20-3 of the event counter 15-3 includes registers RA2, RB2, and RC2. The register set 20-4 of the event counter 15-4 includes registers RA3, RB3, and RC3. Each register is configured to store 8-bit data.
The bus 17 includes 32-bit address bus A[31:0], 2-bit control bus RW[1:0] for specifying write/read operation, and 32-bit data bus D[31:0]. As shown in the event counter 15-1, the data of the register RA0 corresponds to D[31:24] that represents bit 31 through bit 24 of the data bus. The data of the register RB0 corresponds to D[23:16] that represents bit 23 through bit 16 of the data bus. Further, the data of the register RC0 corresponds to D[15:8] that represents bit 15 through bit 8 of the data bus. Although illustration is omitted with respect to the event counters 15-2 through 15-4 due to the lack of space, the relationship between each of the register sets 20-2 through 20-4 and the data bus D[31:0] is the same as that of the register set 20-1.
With this configuration that assigns the registers RA0, RB0, and RC0 to the respective portions of the data bus D[31:0], it is possible to transfer all the data of the register set 20-1 at once by transferring 32-bit data on the D[31:0]. Accordingly, not only a DMA transfer that transfers 8-bit data three times, but also a DMA transfer that transfers 32-bit data only once, can be used for the purpose of transferring the data of the register set 20-1.
As shown in the event counter 15-1 and the bus interface 16-1, the registers RA0, RB0, and RC0 are allocated to addresses 0x1000, 0x1001, and 0x1002, respectively. Selecting a desired register by use of these addresses makes it possible to perform read access or write access to the selected register. By the same token, addresses 0x1004 through 0x1006 are allocated to the register set 20-2, addresses 0x1008 through 0x100A to the register set 20-3, and addresses 0x100C through 0x100E to the register set 20-4.
It is assumed that the count values as previously described are stored as the data indicative of the results of counting in the RA0, RA1, RA2, and RA3 of the event counters 15-1 through 15-4. A case will then be examined below in which these count values are read out and transferred to addresses 0x2000 through 0x2003 in the memory 14 (
In this case, the size of transfer data is 32 bits in total. Despite the fact that the data bus D[31:0] provides a 32-bit data width, however, a single 32-bit-width DMA transfer cannot be utilized in this case. This is because the addresses of the registers RA0, RA1, RA2, and RA3 are not arranged as consecutive addresses. Even if these addresses are arranged consecutively, these registers are all allocated to the same portion D[31:24] of the data bus, so that it is impossible to perform a 32-bit-width DMA transfer.
As another example, it is assumed that the count values as described above are stored as the data indicative of the results of counting in the registers RB0, RA1, RC2, and RA3 of the event counters 15-1 through 15-4. Address increments between the registers are +3, +6, and +2 in this case. Since the address increments are not constant, the DMA transfer that transfers 8-bit data four times cannot be performed. Further, because of the same reasons as in the previous case, the DMA transfer that transfers 32-bit data once cannot be performed. That is, no DMA transfer is possible in this case.
When there is a need to transfer the data of registers that are allocated to nonconsecutive or unequal-interval addresses, conventionally, data transfer is performed by CPU-based software operations. In the case of such software-based data transfer, all the four operation steps, i.e., setting of a read address, reading of data, setting of a write address, and writing of the data, need to be performed for each transfer action. Such transfer operation is thus extremely inefficient compared with DMA transfer, failing to achieve high-speed data transfer.
As a reference, Japanese Patent Application Publication No. 2001-256104 discloses a configuration for performing efficient access to nonconsecutive addresses.
Accordingly, there is a need for a DMA transfer system which can perform efficient DMA transfer with respect to data stored in the registers that are allocated to nonconsecutive or unequal-interval addresses.
It is a general object of the present invention to provide a DMA transfer system that substantially obviates one or more problems caused by the limitations and disadvantages of the related art.
Features and advantages of the present invention will be presented in the description which follows, and in part will become apparent from the description and the accompanying drawings, or may be learned by practice of the invention according to the teachings provided in the description. Objects as well as other features and advantages of the present invention will be realized and attained by a DMA transfer system particularly pointed out in the specification in such full, clear, concise, and exact terms as to enable a person having ordinary skill in the art to practice the invention.
To achieve these and other advantages in accordance with the purpose of the invention, the invention provides a system for DMA transfer which includes a DMA controller, a bus connected to the DMA controller, a bus interface connected to the bus, and a plurality of registers coupled to the bus via the bus interface, wherein the bus interface is configured to allocate the plurality of registers doubly to nonconsecutive addresses and consecutive addresses to allow the DMA controller to access the plurality of registers through the consecutive addresses.
Further, a DMA transfer method according to the present invention includes allocating to consecutive addresses a plurality of registers allocated to nonconsecutive addresses, and performing DMA transfer to transfer data of the plurality of registers to a destination from the consecutive addresses serving as source addresses.
According to at least one embodiment of the present invention, even if the resisters serving as sources of DMA transfer are not allocated to consecutive addresses, the data can be accessed as a single contiguous chunk in the address space by assigning these registers to consecutive addresses by use of mirror registers. With this provision, it is possible to perform a single DMA transfer for a single contiguous data chunk even when the registers serving as the sources of DMA transfer are not allocated to consecutive addresses.
Further, registers that have uneven address increments therebetween and thus cannot be subjected to DMA transfer may also be assigned as mirror registers to consecutive addresses. This makes it possible to set constant address increments so as to achieve DMA transfer.
Other objects and further features of the present invention will be apparent from the following detailed description when read in conjunction with the accompanying drawings, in which:
In the following, embodiments of the present invention will be described with reference to the accompanying drawings.
A DMA transfer system 30 shown in
A description will be given below with respect to an example in which register data is transferred through DMA from the event counters 15-1 through 15-4 to the memory 14. Although the event counters are used as an example here, the operation of the DMA transfer remains the same even if macros having other functions are used.
The event counters 15-1 through 15-4 serve to count the pulses of data signals D0 through D4 during the period indicated by trigger signals TRG0 through TRG4, respectively. When the counting comes to an end, the count values are stored in the internal registers of the event counters 15-1 through 15-4, and the interruption signals INT0 through INT3 are generated. These interruption signals INT0 through INT3 are supplied to the interruption controller 12. In response to the interruption signals INT0 through INT3, the interruption controller 12 instructs the DMA controller 13 to start DMA transfer. In response, the DMA controller 13 performs DMA transfer.
As shown in
The register set 20-1 of the event counter 15-1 includes registers RA0, RB0, and RC0. The register set 20-2 of the event counter 15-2 includes registers RA1, RB1, and RC1. The register set 20-3 of the event counter 15-3 includes registers RA2, RB2, and RC2. The register set 20-4 of the event counter 15-4 includes registers RA3, RB3, and RC3. Each register is configured to store 8-bit data.
The bus 17 includes the 32-bit address bus A[31:0], the 2-bit control bus RW[1:0] for specifying write/read operation, and the 32-bit data bus D[31:0]. As shown in the event counter 15-1, the data of the register RA0 corresponds to D[31:24] that represents bit 31 through bit 24 of the data bus. The data of the register RB0 corresponds to D[23:16] that represents bit 23 through bit 16 of the data bus. Further, the data of the register RC0 corresponds to D[15:8] that represents bit 15 through bit 8 of the data bus. Although illustration is omitted with respect to the event counters 15-2 through 15-4 due to the lack of space, the relationship between each of the register sets 20-2 through 20-4 and the data bus D[31:0] is the same as that of the register set 20-1.
As shown in the event counter 15-1 and the bus interface 31, the registers RA0, RB0, and RC0 are allocated to addresses 0x1000, 0x1001, and 0x1002, respectively. When the decoder-&-selector 32 decodes the address on the address bus A[31:0] to assert a decode signal corresponding to address 0x1000, access to the register RA0 becomes possible in response to the assertion of this decode signal.
Namely, in the case of a read operation as in this DMA transfer example, the content of the register RA0 is read to the data bus D[31:24] in response to the assertion of the decode signal. If a decode signal corresponding to address 0x1001 is asserted, the content of the register RB0 is read to the data bus D[23:16] in response to this assertion. If a decode signal corresponding to address 0x1002 is asserted, the content of the register RC0 is read to the data bus D[15:8] in response to this assertion.
Further, the OR gate 33-1 provided in the bus interface 31 is configured to perform an OR operation between the decode signal corresponding to address 0x1000 output from the decoder-&-selector 32 and the decode signal corresponding to address 0x1010. A signal resulting from this OR operation is supplied to the register RA0. Accordingly, the register RA0 is allocated to address 0x1000 and also to address 0x1010. When the decoder-&-selector 32 decodes an address on the address bus A[31:0] to assert the decode signal corresponding to address 0x1010, thus, the content of the register RA0 is read out to the portion D0[31:24] of the data bus D0[31:0] between the event counter 15-1 and the bus interface 31.
The same applies in the case of the event counter 15-2. That is, the register RA1, RB1, and RC1 are allocated to addresses 0x1004, 0x1005, and 0x1006, respectively, and the OR gate 33-2 performs an OR operation between the decode signal corresponding to address 0x1004 and the decode signal corresponding to address 0x1011. A signal resulting from this OR operation is supplied to the register RA1. Accordingly, the register RA1 is allocated to address 0x1004 and also to address 0x1011. When the decoder-&-selector 32 decodes an address on the address bus A[31:0] to assert the decode signal corresponding to address 0x1011, thus, the content of the register RA1 is read out to the portion D1[31:24] of the data bus D1[31:0] between the event counter 15-2 and the bus interface 31.
The same applies in the case of the event counter 15-3. That is, the register RA2, RB2, and RC2 are allocated to addresses 0x1008, 0x1009, and 0x100A, respectively, and the OR gate 33-3 performs an OR operation between the decode signal corresponding to address 0x1008 and the decode signal corresponding to address 0x1012. A signal resulting from this OR operation is supplied to the register RA2. Accordingly, the register RA2 is allocated to address 0x1008 and also to address 0x1012. When the decoder-&-selector 32 decodes an address on the address bus A[31:0] to assert the decode signal corresponding to address 0x1012, thus, the content of the register RA2 is read out to the portion D2[31:24] of the data bus D2[31:0] between the event counter 15-3 and the bus interface 31.
The same applies in the case of the event counter 15-4. That is, the register RA3, RB3, and RC3 are allocated to addresses 0x100C, 0x100D, and 0x100E, respectively, and the OR gate 33-4 performs an OR operation between the decode signal corresponding to address 0x100C and the decode signal corresponding to address 0x1013. A signal resulting from this OR operation is supplied to the register RA3. Accordingly, the register RA3 is allocated to address 0x100C and also to address 0x1013. When the decoder-&-selector 32 decodes an address on the address bus A[31:0] to assert the decode signal corresponding to address 0x1013, thus, the content of the register RA3 is read out to the portion D3[31:24] of the data bus D3[31:0] between the event counter 15-4 and the bus interface 31.
Based on the functions of the OR gates 33-1 through 33-4 of the bus interface 31, further, the registers RA0, RA1, RA2, and RA3 are allocated as mirror registers to addresses 0x1010, 0x1011, 0x1012, and 0x1013, respectively.
In this case, the mirror registers are allocated consecutive addresses 0x1010 through 0x1013, so that the data of these registers can be treated as 32-bit data starting at address 0x1010 in the address space. However, the registers RA0, RA1, RA2, and RA3 are all assigned to the same portion D[31:24] of the data bus, i.e., not arranged as 32-bit-width data on the data bus D[31:0]. Without any change, thus, it is not possible to perform 32-bit-width DMA transfer.
In the present invention, when the registers RA0, RA1, RA2, and RA3 are accessed as mirror registers located at addresses 0x1010 through 0x1013, the decoder-&-selector 32 shown in
As described above, data read from the mirror registers are rearranged by the decoder-&-selector 32 as to their positions on the data bus. As a result, the mirror registers corresponding to the registers RA0, RA1, RA2, and RA3 (shown in brackets) are assigned to every 8 bits successively from the highest-order bit as shown in
In this manner, even if the resisters serving as sources of DMA transfer are not allocated to consecutive addresses, the present invention provides for data to be accessed as a single contiguous chunk in the address space by assigning these registers to consecutive addresses by use of mirror registers. Further, the data read by accessing the mirror registers are rearranged such that the data can be transferred as a single data chunk on the data bus. With this provision, it is possible to perform a single DMA transfer for a single contiguous data chunk even when the registers serving as the sources of DMA transfer are not allocated to consecutive addresses.
As another example, it is assumed that the count values as previously described are stored as the data indicative of the results of counting in the registers RB0, RA1, RC2, and RA3 of the event counters 15-1 through 15-4. Address increments between the registers are +3, +6, and +2 in this case. Since the address increments are not constant, the DMA transfer that transfers 8-bit data four times cannot be performed.
Even in such a case, the OR gates 33-1 through 33-4 of the bus interface 31 shown in
At step S3, the bus interface 31 supplies a register-read request to the event counters 15-1 through 15-4. Namely, in response to a request from the DMA controller 13 to read 32-bit data from a predetermined address (i.e., 0x1010 in the example of
At step S8, the decoder-&-selector 32 of the bus interface 31 rearranges the data read from the register RA0, the register RA1, the register RA2, and the register RA3 into 32-bit data. At step S9, the decoder-&-selector 32 outputs the 32-bit data to the data bus D[31:0] of the bus 17. Thereafter, the DMA controller 13 performs a process that writes the data on the data bus D[31:0] to a specified address in the memory 14. At step S9, the interruption is cleared. That is, the state in which an interruption process is performed by the interruption controller 12 is brought to an end.
Further, the present invention is not limited to these embodiments, but various variations and modifications may be made without departing from the scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
2005-064358 | Mar 2005 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
4847750 | Daniel | Jul 1989 | A |
5255374 | Aldereguia et al. | Oct 1993 | A |
5553307 | Fujii et al. | Sep 1996 | A |
5659797 | Zandveld et al. | Aug 1997 | A |
6349355 | Draves et al. | Feb 2002 | B1 |
6615292 | Sota | Sep 2003 | B1 |
6779085 | Chauvel | Aug 2004 | B2 |
7287101 | Futral et al. | Oct 2007 | B2 |
7330914 | Inogai | Feb 2008 | B2 |
7334107 | Schoinas et al. | Feb 2008 | B2 |
Number | Date | Country |
---|---|---|
2001-256104 | Sep 2001 | JP |
Number | Date | Country | |
---|---|---|---|
20060206633 A1 | Sep 2006 | US |