The technical field of the present application relates to a direct memory access controller.
Direct memory access controller (DMA) are typically used in microprocessor systems, integrated microcontrollers, etc. DMA controllers are used to perform a data transfer from and to memory to and from a peripheral independently from the central processing unit of the computer system. To this end, a DMA controller can be seen as a second programmable processing unit with limited capabilities. Generally, a DMA controller is instructed to transfer a specific amount of data from a source location to a destination location. The source can be within a memory, for example, a data memory of a microcontroller, memory of a peripheral, or data generated by or accessible within a peripheral, such as an analog to digital converter, a port, a capture compare unit, etc. The destination can also be within a memory, thus, allowing high speed transfers within a memory device of a computer system or microcontroller. However, the destination can also be a peripheral, such as a digital to analog converter, a port, etc. To transfer data from a source to a destination the DMA controller must receive the respective source and destination addresses. In addition, each transfer length needs to be specified. To this end, the DMA controller needs to receive either the length of the data transfer or the start and end address of the data to be transferred.
Moreover, DMA controllers are used to support the central processing unit (CPU) in a system, in particular for lengthy data transfers. The CPU is then free to perform other functions. However, any type of transfer can be subject to interference and distortion. Tests to perform a redundancy checks are usually performed by the CPU and, thus, lengthen the transfer process.
According to an embodiment, a direct memory access (DMA) controller may comprise a DMA bus, a memory coupled to the DMA bus, a DMA engine coupled with the DMA bus, a cyclic redundancy check (CRC) module coupled with the DMA engine, and a bus interface coupled to the DMA engine and the CRC module.
According to another embodiment, a direct memory access (DMA) controller may comprise a bus matrix, a memory coupled to the bus matrix, a DMA engine coupled with the bus matrix, a programmable cyclic redundancy check (CRC) module coupled between the DMA engine and the bus matrix, and a bus interface coupled to the DMA engine and the CRC module.
According to another embodiment, a method of performing a direct memory access (DMA) transfer comprising the steps of a) initializing a DMA channel in a DMA controller; b) initializing a cyclic redundancy check (CRC) module coupled with the DMA controller; c) loading source data from a source address into the CRC module and starting a cyclic redundancy check algorithm on the loaded source data; d) incrementing the source address; and e) repeating steps c) and d) until a source end address has been reached.
Other technical advantages of the present disclosure will be readily apparent to one skilled in the art from the following figures, descriptions, and claims. Various embodiments of the present application may obtain only a subset of the advantages set forth. No one advantage is critical to the embodiments.
A more complete understanding of the present disclosure and advantages thereof may be acquired by referring to the following description taken in conjunction with the accompanying drawings, in which like reference numbers indicate like features, and wherein:
While embodiments of this disclosure have been depicted, described, and are defined by reference to example embodiments of the disclosure, such references do not imply a limitation on the disclosure, and no such limitation is to be inferred. The subject matter disclosed is capable of considerable modification, alteration, and equivalents in form and function, as will occur to those ordinarily skilled in the pertinent art and having the benefit of this disclosure. The depicted and described embodiments of this disclosure are examples only, and are not exhaustive of the scope of the disclosure.
Conventional technologies do not provide for cyclic redundancy check (CRC) calculations within a DMA controller. Rather separate hardware or software-based operations are provided within the various peripheral modules. According to various embodiments, a programmable CRC generator is integrated as a single engine attached to multiple DMA channels which allows programmable CRC types as opposed to fixed CRC calculations.
According to further enhancements the CRC module in a DMA controller may be coupled between the DMA engine and the DMA bus. According to yet another enhancement, the DMA bus can be a bus matrix and the CRC module may be programmable. According to yet another enhancement, the CRC module may comprise a shift register having a plurality of shift cells and associated taps coupled with a tap multiplexer providing an output signal that is fed back to the shift register. According to yet another enhancement, the DMA controller may further comprise a plurality of XOR gates coupled with the plurality of taps and receiving the output signals of the tap multiplexer. According to yet another enhancement, the DMA controller may further comprise a plurality of select multiplexers each selecting an output of one of the plurality of XOR gates or the tap of a shift cell. According to yet another enhancement, the DMA controller may further comprise a control register for controlling the plurality of select multiplexers. According to yet another enhancement, the DMA controller may further comprise a register for controlling the tap multiplexer.
With respect to the various embodiments of methods of performing a DMA transfer, the step of loading source data may comprise the step of directly loading the source data into the CRC module. According to yet another enhancement, the step of loading source data may comprise the step of loading the source data into the DMA controller and subsequently from the DMA controller into the CRC module. According to yet another enhancement, the CRC module may comprise a shift register having a plurality of shift cells and associated taps coupled with a tap multiplexer providing an output signal that is fed back to the shift register. According to yet another enhancement, the CRC module may further comprises a plurality of XOR gates coupled with the plurality of taps and receiving the output signals of the tap multiplexer. According to yet another enhancement, the CRC module may further comprises a plurality of select multiplexers each selecting an output of one of the plurality of XOR gates or the tap of a shift cell. According to yet another enhancement, the step of initializing the CRC module may comprise the step of loading a feedback point into a control register for controlling the tap multiplexer. According to yet another enhancement, the step of initializing the CRC module may comprises the step of loading a polynomial length into a register for controlling the plurality of select multiplexers. According to yet another enhancement, the method may further comprise the step of writing a result of a CRC to a pre-determined memory location.
According to an embodiment, a cyclic redundancy check (CRC) module 140 is integrated within the DMA controller 100 and is coupled between the DMA engine 130 and the bus matrix 150 for performing a cyclic redundancy check. The CRC module is programmable and to this end coupled with the bus interface 120. Thus, the CPU 170 can access the CRC module 140 and program it according to a CRC specification as will be explained in more detail below. When activated for a channel, data can be routed directly through the CRC module 140 into the DMA engine 130 as opposed to directly loading them into the DMA engine through data lines 185. However, alternatively in another embodiment, the CRC module can be only coupled with the DMA engine 130. In such an embodiment, data is always first fed through the data lines 185 into the DMA engine 30 and then can be further loaded into the CRC module 140 through the respective coupling between the CRC module 140 and the DMA engine 130.
The DMA engine 130 may utilize an N-channel DMA controller which is capable of memory to memory, memory to peripheral, or peripheral to memory operations. Each channel is programmable individually and may comprise associated control, address and size registers. The CRC module 140 can be used under program control with any of the channels of the DMA controller. The CRC module 140 resources can be shared with each DMA channel. To this end, respective registers can be written and saved to control the CRC module 140. Thus, only a single CRC module is implemented. The CRC module 140 allows for the ability to perform cyclic redundancy check generation of memory regions or FLASH memory contents utilizing a hardware-based DMA operation. This provides faster throughput than programmed software methods. By implementing this as a programmable CRC tap of, for example, N to 16 bits as will be explained in more detail below, a user can implement any particular CRC algorithm required for communication protocols.
A DMA transfer may be performed with or without the inclusion of the CRC module. DMA transfers that do not require a CRC calculation will not be assigned the CRC module during transfer. For example moving data from one memory location to another would not require a CRC. A data transfer using a serial interface could be specified to transmit a CRC at the end of the transmission. In this example the CRC would be calculated as the data is sent or received, and the result compared. The DMA module has an additional mode which is a CRC only mode where data is NOT transferred, but is read and a CRC calculated on the data read. This can be used to verify the integrity of a block of data in memory. In another embodiment the CRC result data can be automatically written to some pre-determined location on completion of the calculation. For example, the result for each CRC can be written to consecutive addresses in a pre-determined memory location or a final result of a data transaction can be written to a predefined location.
Thus, a DMA transfer may be performed with or without the inclusion of the CRC module. For example, a data transfer using a serial interface provides for enough time between two consecutive data elements to perform a CRC algorithm on each transferred data element. Many other data transfers allow for the execution of a CRC algorithm between consecutive data elements. However, if a high speed transfer does not allow the execution of the respective CRC algorithm between consecutive data elements, the CRC algorithm can be run after a completed transfer. Thus, the CRC module can be used without performing an actual DMA transfer of data. For example, the CRC module can be used to check the integrity of any type of memory, such as Flash memory that has been programmed, by defining an address range.
The CRC generator may utilize a TAP register for programming the CRC algorithm, a read/write CRC register which may contain the initial preload of the CRC value and the final result after a CRC operation. The CRC/DMA engine side may utilize the DMA SRC/SIZE registers of the memory or FLASH region and length of the “read-only operation” to generate the CRC. A user-defined option allows use of the DMA DST register as a pointer to the address for which the CRC result could be written.
The multiplexer 210 is used to select the feedback point and effective length of the CRC generator through register PLEN. PLEN register 215 controls the length of the CRC generator 200 and is user selectable. The feedback data which is provided by the output of multiplexer 210 is XORed with the data currently in the CRC shift register 230a, 240a, 250a, 270 by means of the XOR gates 230b . . . 260c. Select multiplexers 230c, 240c, 250c and 260c are used to select whether the XOR data or the previous data in the shift register 230a, 240a, 250a, 270 is shifted on the next clock. CTRL CRC register 235 is used to configure which bits are shifted through and which bits take the feedback data XOR'ed with the previous data in the CRC generator which contains the X1 input of multiplexers 230c, 240c, 250c and 260c. CRC Write bus 290 can be used to pre-load the CRC 230a, 240a, 250a, 270 by means of preload register 295. CRC Read bus 280 can be used to read the value of the CRC generator. Data to be fed into the CRC is shifted into the CRC through XOR gate 220.
According to an embodiment as for example shown in
In case of an integrity check of a memory area following line 390 in
The advantages of a DMA controller with a hardware assisted CRC generator are shown in
The invention, therefore, is well adapted to carry out the objects and attain the ends and advantages mentioned, as well as others inherent therein. While the invention has been depicted, described, and is defined by reference to particular preferred embodiments of the invention, such references do not imply a limitation on the invention, and no such limitation is to be inferred. The invention is capable of considerable modification, alteration, and equivalents in form and function, as will occur to those ordinarily skilled in the pertinent arts. The depicted and described preferred embodiments of the invention are exemplary only, and are not exhaustive of the scope of the invention. Consequently, the invention is intended to be limited only by the spirit and scope of the appended claims, giving full cognizance to equivalents in all respects.
This application claims the benefit of U.S. Provisional Application No. 60/869,816 filed on Dec. 13, 2006, entitled “PROGRAMMABLE N-BIT CRC GENERATOR UTILIZING DMA”, which is incorporated herein in its entirety.
Number | Date | Country | |
---|---|---|---|
60869816 | Dec 2006 | US |