Tutorials to .com

Tutorials to .com » Mechine » Dsp » DSP-based hardware and software online program design and implementation of

DSP-based hardware and software online program design and implementation of

Print View , by: iSee ,Total views: 20 ,Word Count: 3083 ,Date: Sat, 22 Aug 2009 Time: 4:00 AM

With the development of modern network technologies, embedded systems, such as single-chip release, dsp system to the access network, such as increasing demand, for example, functions with a remote meter reading meter system for remote control treng information power systems. In this paper, the use of TI's TMS320VC33 DSP chip design with Realtek's RTL8019 network card hardware interface circuit and software in the DSP using TCP / IP protocol, so that the Internet functions with DSP chips, which can use the computer through the card with the DSP board to carry out a large number of data exchange and control.

1 hardware design

DSP and the hardware interface circuit card as shown in Figure 1.

DSP-based hardware and software online program design and implementation of

DSP-low 16-bit data bus ISA card access 16-bit data lines, ISA card high IOCS16 Line, set up the network card for 16-bit mode.

Card a total of 20 address lines. To A7 ~ A8, A10 ~ A19 grounding, A0 ~ A6 and A9, respectively, then DSP-A0 ~ A7, used the card address is 0240H ~ 025FH, is mapped to the DSP's Page3 space, address mapping for C000C0H ~ C000DFH.

Reset signal for the DSP card reset, the Reset signal due to DSP low effective, the Reset signal and the high card effective, it should be among the non-door access.

DSP's Page3 and R / W signal to the network card for the election of the read and write signals IOR, IOW, the realization of the logic of relations as shown in Figure 2.

Is the interruption of IORQ card 9, through the door followed by the INT1 pin DSP.

There are three RTL8019 NIC work:

The first way for the jumper, the card I / O and interrupt the decision by the jumper;

The second way for plug-and-play, automatic configuration by software plug and play;

The third jumper in order to avoid the way the card I / O and interrupt from an external content in the 93C46.

First, computer plug-and-play manner, in order to reduce the complexity of software programming, the network card is set to jumper mode.

All of the above in the decoding logic to achieve EPM7129.

74ALVC16425 is a bus driver chips can be 3.3V to 5V level conversion. TMS320VC33 and as a result of the EPM7128 devices is 3.3V, while the ISA bus is 5V, so can not directly connect the signal line, through the conversion level for 74ALVC164245 and isolation.

2 Software design

DSP-based hardware and software online program design and implementation of

2.1 network card driver hardware design

NIC drivers include the following main parts:

(1) NIC initialization

NIC is the network interface control chip, which is responsible for the network to receive and send data. In order to enable the NIC is up and ready to receive or send data to prepare the state, must be related to initialize the register. These registers include the CR, DCR, RBCR, PSTART, PSTOP, ISR, IMR, PAR0 ~ PAR5, MAR0 ~ MAR7, CURR, TCP, RCR and so on.

(2) interrupt service routine

General interrupt service routine to complete two tasks: First, set the interrupt signs, so that procedures can be found to interrupt occurred; Second Interrupt Status Register to obtain the value, and will cause disruption to the specific reasons for the procedure, the the process is interrupted by setting the reasons for the completed sign. need to pay attention, interrupt service routine beginning of the interruption to protect the scene until after the completion of procedures at the scene to restore the interrupted; interrupt service routine should be short, as far as possible, so in the shortest possible time the implementation of complete, so some people need to work to be done to the other programs.

(3) the frame sent procedures

In the network, the frame transmission process: the sender of the data will be sent by request frame format framing package, and then through the card will be sent to the network frame transmission lines; receiver received frame in accordance with the destination address to see if submitted to the upper frame of the application. frame refers to the sending of data to be sent in the form of frames sent to the network transmission line, therefore, frame the sending process should include the following steps:

① binding;

② will send the frame buffer into the NIC;

③ send control register initialization;

④ NIC to start sending the frame to the network transmission lines.

(4) frame to receive the procedure

Frame refers to the network to receive the data frame to receive and cache buffer in the receiving network adapter ring, and then by the host program will receive a buffer cache in the Central time frame and go into the memory for program use. Which can be seen , frame reception process is divided into two cards;

① first by the NIC to DMA through local frame buffer into the receiver ring;

② The second card is through remote DMA and the host will receive the cooperation of the frame ring buffer is read into memory.

2.2 TCP / IP protocol to achieve

DSP-based hardware and software online program design and implementation of

2.2.1 DSP with PC-to achieve TCP / IP protocol different

TCP / IP protocol in the Unix system was first achieved, and later in LINUX, DOS and WINDOWS system also achieved a TCP / IP. However, in the realization of UNIX on TCP / IP protocol and the source code can not be transplanted directly onto the DSP This is because the PC and DSP there were significant differences.

PC-computational speed is very fast, there is a general multi-tasking operating system, you can multi-task parallel execution through hardware interrupt with the interrupt, message queues and sockets to achieve ATCP / IP between the protocol layer and the network communication communication. The relatively slow speed DSP, the lack of multi-tasking operating system platform, only through the implementation of additional hardware interrupt the order of the way to achieve, and also at the same time the implementation of its data collection tasks such as serial interruption, the interruption processes should be short, only to set up the flag state, and will be relatively slow processing of network packets to perform on the main program in order to reduce the conflict between a variety of tasks.

PC-memory is very large, is now generally can be reached 32 ~ 128M of storage capacity, you can dynamically allocate and release memory, it is easy to achieve the memory cache mbuf, such as network control block ncb chain structure, and additions and deletions can be arbitrary; At the same time to the maintenance of a number of network connections, as a result of computer processing speed, almost do not have to consider the issue of buffer overflow. and the DSP internal RAM to only a dozen or so K, together with the external expansion of the RAM can only reach the capacity of dozens of K, one of the largest Ethernet packets have 1.5K or so, if it according to PC-memory management and data structure, use the mbuf chain, RAM sure enough, it can only be a fixed allocation of RAM in bytes of the section 1514 to store the received Ethernet packets, receiving a packet of a packet processing.

PC-in TCP / IP protocol are achieved at different levels, with each other through the contact parameter, this procedure will help improve the modularity and independence. And in DSP, because the parameters of the transfer will take up too much program space, and reduce the speed of DSP implementation, the transmission parameters should be minimized and instead the use of global variables and external variables, such as to achieve the value of the transfer, so that the dependence between procedures, and often share some variables and data .

PC, a complete TCP / IP protocol. In DSP, because of computational speed and memory limitations, it is impossible to support all of the agreement, the general realization of the need for only part of the agreement do not need to all do not support; and even if agreement is not required as in the realization of PC, less complex, based on the specific hardware needs and to achieve the necessary simplification.

2.2.2 TCP / IP protocol to achieve the specific

TCP / IP protocol agreement is a cluster that contains a lot of agreement, in the DSP to achieve all the agreements as shown in Figure 3, usually can be divided into four (not including the physical layer).

According to the structural characteristics of DSP and the need to achieve the functions realized in the DSP in the ARP (Address Resolution Protocol), IP (Internet Protocol), ICMP (Internet Control Message Protocol), UDP (User Datagram Protocol) and TCP (Transmission Control Protocol), and to simplify them.

2.2.2 TCP / IP protocol to achieve the specific

TCP / IP protocol agreement is a cluster that contains a lot of agreement, in the DSP to achieve all the agreements as shown in Figure 3, usually can be divided into four (not including the physical layer).

According to the structural characteristics of DSP and the need to achieve the functions realized in the DSP in the ARP (Address Resolution Protocol), IP (Internet Protocol), ICMP (Internet Control Message Protocol), UDP (User Datagram Protocol) and TCP (Transmission Control Protocol), and to simplify them.

In the link layer to achieve the ARP. Each network has its own addressing mechanism, Ethernet through the Ethernet address of the card known as the hardware address for addressing MAX, each card has a factory mac address only. IP address is only for the TCP / IP address of a meaningful cluster is a virtual address. When given IP address of IP packets spread in Ethernet, the IP address must be translated into a Ethernet address in order to correct transmission. ARP protocol is 32-bit IP address dynamically mapped to the Ethernet address of 48, thus ensuring the correct transmission network. ARP agreement by the two documents arpin.c and arpout.c to achieve. arpin.c network is responsible for receiving the arp broadcast packet to determine the type of arp packets on the other machine is a network packet or a request to return the machine to respond to the package, to determine its legitimacy and the appropriate handling; arpout.c responsible for host send data to the network time to send arp request packets as well as in response to arpin.c call arp request packets received.

In the network layer to achieve the IP and ICMP.IP agreement is TCP / IP protocol in the core cluster of the agreement, which provides connectionless datagram delivery service, all upper-layer protocols must be transmitted IP packet format. IP protocol by the two ipout.c documents ipin.c and achieve. Ipin.c responsible for receiving IP packets, IP packets received after the, first of all determine the version number,

Data length, destination address, test and is correct, the first based on IP protocol type field value corresponding to the upper protocol processing; ipout.c responsible for sending IP data packets, received from the upper data transfer agreement, together with 20 the first byte of the IP, the correct setting and purpose of the source IP address IP address, protocol type, testing and calculation, to send the following link layer. PC machine on the IP packet, and when it is longer than the network MTU, the permit it subparagraph; of the DSP does not support sub-IP data packets, do not support IP options field. ICMP protocol message is responsible for transmission errors, as well as other information need to pay attention to, and from the first ICMP type 8-bit word paragraph 8 of the code and decided to field the type of information. in the DSP to achieve only the echo request (type code 80) packet processing, from the IP layer after receipt of ICMP packets to determine whether the type of code segment 80. If so, these two fields is set to 00 (Echo Reply), calculated tests and then sent to the IP layer; If not, then be discarded. in order to achieve the support of the ping function.

DSP-based hardware and software online program design and implementation of

Achieved in the transport layer UDP and TCP.

UDP protocol is a connectionless-oriented non-reliable protocol, with the two documents udpin.c and udpout.c to achieve. Udpin.c input to achieve the handling of udp packets to determine the port number, examination and is correct, will correct its data port to the corresponding application is not disposed of correctly; udpout.c achieve udp packet output processing, receiving data from the application, set the appropriate port number source and destination port number, and then to the IP layer to send. It should be noted that UDP packet calculation and calculation of the testing and inspection IP packet and is not the same as, IP packet inspection and covers only the first IP packet, and UDP packet inspection and is covered by the UDP packet the first and all the data. UDP packets when calculating the test and the introduction of a 12-byte pseudo-first, including the 4 bytes of the source IP address, the purpose of 4-byte IP address, paragraph 1, the zero-byte, 1 word section of the agreement and the two bytes of testing and that its purpose is to check two UDP data correctly arrived at the destination. TCP and UDP agreement although the agreement with the transport layer protocol, but it provides a connection-oriented reliable byte stream service. TCP protocol is the most complex of all the agreements, but also a piece of the most difficult to achieve, mainly by tcpin.c, tcpout.c, tcptimer.c and tcpstatem.c block the realization of four documents, and in accordance with specific applications need to be simplified. TCP control block tcb to achieve with the structure, each of a TCP connection tcb contains all control and status information, all of the tcb form a two-way linked list, in favor of TCP connections in all search . tcptimer.c agreement responsible for the management of a variety of TCP state information, which includes the former back to the pointer to form a timer timeout, PC machine speed TCP protocol contains two timers, where only the realization of a 500ms slow timer, since there are no quick timer, so do not support the ACK packet delay that is received immediately send an ACK; tcpstatem.c is the TCP state machine functions, according to TCP connection which occurred in different states, as well as events to determine the TCP connection state changes; tcpout.c is responsible for sending tcp packet, the sending process is typical when the received data from the upper application, the first to send SYN frame with the target node three-way handshake to establish a connection, after TCP first, sent to the lower IP module, and ARQ retransmission timeout timer to achieve sustained detection timer sending window frames and other functions, all data sent to be completed and confirmation sent FIN frame through to shake hands with the closure of four connection, tcpout.c in different states and the incident was to call other programs to send ACK frame, RST frame, and other TCP packets; tcpin.c is responsible for receiving the lower IP module from the received TCP packets, and TCP connection TCP state information, as well as all the first flag for a branch to deal with the data corresponding to the upper port applications, and call the other function of the TCP packet and respond to changes in the state. In the PC, often at the same time to maintain a number of TCP connections; However, in DSP, the DSP speed and RAM as a result of capacity constraints, only one TCP connection; This greatly simplifies the complexity of procedures, but also to meet the actual needs, if there is a need in future can also be used for expansion. To sum up , TCP / IP protocol processing of the concrete shown in Figure 4.

In this paper, with the network adapter hardware DSP design and programming interfaces to enable the realization of a DSP Ethernet-based TCP / IP communications, so that the DSP can be cable networking, and real-time communication with the computer, the exchange of a large number of data and control information. The technology described in this article the author has participated in the national "973" project, "the complexity of the natural space-time quantitative information access and integration of theory and should be dealt with? quot; be the hardware design applications, and running good

Digital Signal Processing Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.