DIRECT MEMORY ACCESS SYSTEM AND METHOD USING THE SAME
This application is a continuation of U.S. application Ser. No. 12/247,019 filed on Oct. 7, 2008. 1. Field of the Invention The invention relates to a direct memory access (DMA) system and, more particularly, to a unified DMA system adapted to various networking protocol such as WLAN, Ethernet, WiMAX, UWB, USB, and so on. 2. Description of the Prior Art For any kind of high-performance network interface cards (NICs), a dedicated hardware for transferring TX/RX packets is widely used to improve the performance. Generally, this dedicated hardware utilizes the technology called direct memory access (DMA), which allows direct data transfer between certain interfaces and memories in a computer system without the intervention of central processing units (CPU). Please refer to When receiving an RX packet 22, CPU 12 allocates an available buffer space in memory 18 for the packet, stores a buffer address 240 into an RX descriptor 24, and then resets an associated owner bit 244. When the RX packet 22 is transferred from interface 20, DMA device 10 first checks the owner bit 244 of RX descriptor 24. Then, DMA device 10 transfers RX packet 22 from interface 20 to memory 18. After RX packet 22 is moved to memory 18, DMA device 10 writes a packet information 242 into the RX descriptor 24 and sets owner bit 244 as 1 and then informs CPU 12 of the completeness of receiving RX packet 22. In order to improve the performance and reduce the requirement of First-In-First-Out (FIFO) memory, most conventional DMA devices support multiple TX/RX descriptors by, for instance, arranging descriptors as descriptor chains or descriptor rings. A typical TX descriptor chain is shown in Although most DMA devices have similar operation rules, the designs of the DMA devices are not exactly the same. In particular, DMA devices will be different when the attached network media (e.g., Ethernet, WLAN, ADSL, WiMAX, and so on) changes. Therefore, when more and more interfaces are integrated into a system on chip (SoC), non-unified DMA descriptor architectures and semantic languages would increase hardware verification effort and software porting effort significantly. Moreover, different DMA engines for different interfaces are hard to maintain from the perspective of ASIC design. Therefore, the scope of the invention is to provide a unified DMA system to solve the aforesaid problems. An object of the present invention is to provide a unified DMA system which allows different interfaces to share the same DMA engine. According to an embodiment of the present invention, the DMA system is used for transmitting/receiving packets between an interface and a memory. The DMA system includes a DMA transmitter and a DMA receiver. The DMA transmitter transmits a TX packet based on a TX descriptor and appends a TX information to the head of the TX packet based on the TX descriptor. On the other hand, the DMA receiver receives an RX packet based on an RX descriptor and appends an RX information to the tail of the RX packet. In this embodiment, the TX descriptor and the RX descriptor can be selectively embedded the interface or the memory. The TX information is used for informing the interface about the TX path, so that the interface can perform the packet processing procedure. When the information to be transmitted is too large to be completely filled into the TX information, the DMA transmitter of the invention can selectively append a TX message between the TX packet and the TX information. The RX information is used for storing the receiving state of packets. If the RX information is too small for some applications, the DMA receiver can selectively append an RX message to the head of the RX packet, so as to transmit more necessary receiving statuses. From the perspective of DMA, since the TX message (or RX message) and TX packet (or RX packet) are transmitted as a TX payload (or an RX payload), the DMA device does not know the semantic program and data length of the TX message (or RX message), and designers can decide to fill what information into the TX message (or RX message). Thereby, the DMA system of the invention can be formatted based on different interfaces and adapted to various networking protocols such as WLAN, Ethernet, WiMAX, UWB, USB, and so on. The advantage and spirit of the invention may be understood by the following recitations together with the appended drawings. Please refer to As shown in Similarly, as shown in Please refer to From the perspective of DMA device 42, DMA transmitter 420 treats and processes both TX message 564 and TX packet 560 as TX payloads, and DMA receiver 422 treats and processes both RX message 584 and RX packet 580 as RX payloads. In other words, DMA device 42 does not have to know the semantic language and data length of TX message 564 or RX message 584. Thereby, DMA device 42 of the invention can be formatted based on various interface devices and adapted to various networking protocols such as WLAN, Ethernet, WIMAX, UWB, USB, and so on. Please refer to As shown in In order to support the scattered/gathered data segments, TX packet 560 can be divided into a plurality of data segments and respectively stored into different memory sections. These data segments of TX packet 560 are associated by one or more TX descriptors 60. Please refer to In addition, before using TX descriptor 60, DMA transmitter 420 will first check a DMA Done (DDONE) bit (as shown in In most networking applications, a plurality of TX descriptor rings are used to support the quality of service (QoS). Scheduler 54 in On the other hands, as shown in In this embodiment, the operation rules of RX descriptor 62 are similar to those of TX descriptor 60. The major difference is that unused data segment buffers are prepared and associated with the pointers (SDP0 and SDP1) and the data lengths (SDL0 and SDL1) of RX descriptors 62. When DMA receiver 422 wants to receive RX packet 580, it first checks if the data segments (SDL0 and SDL1) are large enough for storing RX packet 580. If the space is not enough, DMA receiver 422 uses other pointers to store the residual parts of RX packet 580. After the packet is completely transferred to memory 46, DMA receiver 422 will update the data length to indicate the length of the last data segment and set the associated LS bit as 1. In the present invention, in addition to utilizing the DDONE bit to manage the ownership of the TX descriptor, DMA system 40 can further provide two hardware indexes: a CTX_IDX and a DTX_IDX for indicating the ownership of the TX descriptor. Please refer to In the present invention, in addition to utilizing the DDONE bit to manage the ownership of the RX descriptor, DMA system 40 can further provide two hardware indexes: a CRX_IDX and a DRX_IDX for indicating the ownership of the RX descriptor. Please refer to One benefit of this DMA system 40 of the invention is that users are allowed to define their own information/messages to communicate with interface 50. There are two ways for carrying these information/messages. If the message is short, it can be carried by TX information 562 or RX information 582. If the message is too large to be filled into TX information 562 or RX information 582, TX message 564 or RX message 584 can be utilized. From the perspective of DMA, the DMA device is not aware of how much message is carried in TX/RX payloads. In other words, the DMA device will treat the carried messages as a portion of a packet. Please refer to Compared to the prior arts, the DMA system of the invention has the following advantages: can be adapted to various interfaces; can reduce the effort of porting software when various interfaces are integrated into a SoC; can be ported into different interfaces easily since a transparent networking protocol is provided; users can define the TX/RX information and the TX/RX message by themselves; and users can define the TX/RX information and the TX/RX message by themselves; and With the example and explanations above, the features and spirits of the invention will be hopefully well described. Those skilled in the art will readily observe that numerous modifications and alterations of the device may be made while retaining the teaching of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims. The invention discloses a DMA system capable of being adapted to various interfaces. The DMA system includes the following advantages: 1) the software porting effort can be reduced when different interfaces are integrated into a SoC; 2) a flexible DMA that could provide protocol transparency and could be ported into different interfaces easily; 3) a scalable DMA that can support unlimited TX/RX scattering/gathering data segments; 4) a reusable DMA that provides user defined TX information (or RX information) and TX message (or RX message) field; and 5) a high performance DMA that support unaligned segment data pointers and unlimited scattering/gathering data segments, so as to reduce extra memory copies by CPU. 1. A direct memory access (DMA) system for directly accessing a memory and couple to an interface, the memory stored a TX packet and a corresponding TX descriptor included a TX information, the DMA system comprising:
a DMA transmitter for transmitting the TX information and the TX packet to the interface according to the TX descriptor, wherein the TX information is predetermined to communicate with the interface; and a DMA receiver for receiving an RX packet and an RX information from the interface according to a RX descriptor, wherein the RX information is predetermined to communicate with the interface. 2. The DMA system of 3. The DMA system of 4. The DMA system of 5. The DMA system of 6. The DMA system of 7. The DMA system of 8. A method for transmitting/receiving a packet in a direct memory access (DMA) system, the DMA system being used for directly accessing a memory and couple to an interface, the memory stored a TX packet and a corresponding TX descriptor included a TX information, the method comprising the steps of:
transmitting the TX packet and the TX information to the interface according to a TX descriptor, wherein the TX information is predetermined to communicate with the interface; and receiving an RX packet and an RX information from the interface according to an RX descriptor, wherein the RX information is predetermined to communicate with the interface. 9. The method of 10. The method of selectively transmitting a TX message between the TX packet and the TX information; and selectively receiving an RX message between the RX packet and the RX information; wherein the TX message and the RX message are predetermined to communicate with the interface. 11. The method of 12. The method of indicating an ownership of the TX descriptor with at least two first hardware indexes; and indicating an ownership of the RX descriptor with at least two second hardware indexes. 13. The method of 14. The method of arranging the sequence of accessing the TX descriptor ring with a scheduler.CROSS REFERENCE TO RELATED APPLICATIONS
BACKGROUND OF THE INVENTION
SUMMARY OF THE INVENTION
BRIEF DESCRIPTION OF THE APPENDED DRAWINGS
DETAILED DESCRIPTION OF THE INVENTION