Abstract: This article gives the intelligent family gateway’s solution which Motorola the VZ328 chip realizes. In this plan gives the intelligent family gateway’s e architecture and the software architecture. This plan may realize through the Internet net and in the intelligent family gateway’s carries on the control to family interior network electrical appliances equipment, and realizes the long-distance auto-alarm function. Also to the intelligent family net in the system, realizes the network function TCP/IP agreement development to make the explanation.
Key word: Intelligent family gateway e architecture software architecture PPSM TCP/IP
Introduction
The intelligent family network is the information age takes to people’s another high tech product. It with the aid of the existing computer network technology, family interior’s each kind of electrical appliances and the equipment net, provides each kind continually through the network for the people rich, diverse, the individuality, convenient, comfortable, safe and the highly effective service. The family network is also an entire social informationization important part. Intelligent family network system’s basic structure as shown in Figure 1.
The family realizes the family insider information and the family extraneous information exchange, without doubt is the family Lian Wang goal is, it realizes needs to design an ideal family gateway.
1 family gateway
The family gateway takes the family network and the Internet connection, as shown in Figure 2. The family gateway should have the following basic function:
①Connects in the family as all exterior access network, simultaneously family interior network connections exterior one physical interface;
②Enables the housing user to be possible to obtain each kind of domestic services (service which will possibly appear including existing and the future) platform;
③For the family interior network’s in facility assignment IP address, in each family network’s equipment must have the only IP address (only to be restricted in family network interior use), is only restricted in the family interior use regarding this kind IP only to be able to dispose by the family gateway;
④The routing function, the family network’s complexity enables the interior possibly to have many to have the different physical agreement sub-agreement, the family gateway must have route’s function, will come from Internet the band width message routing for the corresponding equipment, simultaneously may also realize between the equipment the correspondence and the division of labor and cooperation;
⑤The sharing wide band connection, causes the family interior many PC and other information equipment shares the broadband access effectively.
2 intelligent family gateway’s realization
2.1 intelligent family gateway’s e architecture
Intelligent family gateway’s e architecture as shown in Figure 3.
The intelligent family gateway hardware system selects Motorola Corporation’s 68VZ328 processor chip, coordinates 4MB Flash and the 2MB SDRAM memory, provides RS232/RS485, USB, I/O and the ethernet connection outward, and may expand many kinds of intelligent family network physical interface conveniently.
2.2 intelligent family gateway’s software architecture
Software architecture as shown in Figure 4.
In the family gateway’s software system, selects the PPSM system which Motorola provides. Because the PPSM system has not provided the window system, therefore makes the suitable revision after the family gateway system’s in actual need, designs a set of window operating system; Also because in the PPSM system has not realized the network function, therefore when made the revision to the PPSM system increased the TCP/IP agreement stack, like this might realize the network function in this operating system.
3 embedded TCP/IP agreement stack development
In the embedded system realizes the way to the TCP/IP agreement stack to have the hardware solidification and the software realizes two kinds. The hardware way is refers to the TCP/IP agreement stack to realize with hardware’s way, in the embedded system with the TCP/IP agreement stack hardware chip connection, realizes the agreement transformation directly by it, thus causes it to connect with the Internet. But this increased the hardware cost without doubt, to some function sole embedded equipment, connects a complete TCP/IP hardware to discuss the stack, is an enormous waste, moreover increases the cost expense discusses the stack with difficulty, is an enormous waste, moreover increases the cost expense is accepts with difficulty. Therefore in this system, selects the software way to realize the embedded TCP/IP agreement to have a bigger superiority.
The high-level operating system may support the TCP/IP agreement race, but we select the PPSM system does not support, must therefore increase according to this system’s actual need to the TCP/IP agreement race’s support function. When increases the TCP/IP agreement race, according to system’s characteristic and the functional design unique TCP/IP agreement race, realizes with the part which needs to concern, to the agreement which does not need does not prepay holds; Next, has made the essential revision regarding the use agreement basis concrete application.
In this system, the embedded TCP/IP agreement stack realizes agreements and so on ARP, IP, ICMP, TCP, UDP, HTTP. The basic protocol processing procedure like strength shows.
The knot shoulds system’s actual situation, to construct embedded TCP to use in the control action limited machine model as shown in Figure 6. Has made the revision, the simplification in some regarding the embedded system nonessential place, but still maintained with the standard TCP agreement uniformity.
In designs the embedded Web server, when in the system in TCP on only supports the HTTP agreement, the embedded system the data acquisition, the operational factor and so on current real-time data stores in the memory the homepage relevant position. To any TC connection, each time is only supports the HTTP agreement to send the blast page service, and limits each homepage size in a data packet, but will not present a IP package of partition. As the embedded Web server, when TCP connection is only at the passive service the condition, therefore may standard TCP the limited state machine initiative foundation connection SYN-ENT condition, initiative closure connection FIN-AIT1, FIN-AIT2, CLOSING, the TIME-AIT condition omit. In design, but also has removed the CLOSED condition, lets it be at the LISTEN condition from the very beginning, monitors the client side the connection to request, has avoided the operation which initiative or opens passively, regarding the embedded situation, is more highly effective.
In three handshake establishment connection’s process, the embedded system takes the monitor condition the server end, is the passive side throughout, is equal after passive open the LISTEN condition, and so on opposite parties initiate the connection. When it receives the SYN data piece, it sends out the SYN ACK data piece and confirmed that it has received opposite party SYN, this time becomes the SYN RECIVED condition. Receives one which opposite party returns only to contain the ACK spatial data piece again, then three handshakes complete, enters the ESTABLISHED condition, afterward may carry on the TCP data communication.
In the operating system, to prevent the old redundant connection request to cause the confusion, may use to reposition the RESET control to absorb Wen Duizhei to plant the situation to carry on processing. After receiving repositions the RESET signal, if is at the non-in-step condition (SYNRECIVED, SYN-SEND), then returns to the LISTEN condition; If is at the random one kind in-step condition, it connected and informs its user to cancel the CLOSE condition in this system on the abnormal end, when received repositioned the RESET control text, returns to the LISTEN condition. When actual processing has not remembered the current condition, therefore does not need to make any operation, and, because is at the passive condition throughout, but ever does not send repositions the RESET text.
In the operating system, the port number, the IP address, the series number, the window size and so on and the response transmission control block TCB structure expressed that the different connection, for the different customer requested establishes many connections, 11 correspondences, concurrent execution. But realizes the so complex operation in the embedded TC palace not to be realistic, therefore designs has not recorded the current condition which the TCP connection locates, also has not separated establishes many TCP connections. Analyzes as follows: Every time transmits a text after the lower level agreement, cannot compare in the text section in the information and the TCP information carries on processing, because had not remembered that in the past constructed the connection the related information, therefore did not know that this connected whether to exist and locates the condition and so on, (whether there is merely according to the receive package in related information control position and data), to judge locates the connection condition to carry on the response. The connection outline to a certain extent, was only to client side PC, maintained a connection existence for it the false appearance. But embedded telegraphic duties end, because does not save the connection the information, is equal in the connection existence, responds to all connections, only then might realize the multi-connections under the limited system resources condition.
In TCP connection, one because only then collapses and so on reasons to create the abnormal end or to close a connection, will have the ajar connection question, because an unusual side lost the memory information, if any side will send the data to go, opposite party will reply the reset signal, the connection replacement. To the embedded system, when client and exceptionally the embedded system sends time the data, will be replied the reset signal; After embedded system exceptionally, when makes a fresh start, as a result of it originally on non-canned data, therefore does not have what influence.
When the network presents the overtime, the loss package, generally reissues with the overtime re-transmit mechanism, but after embedded system contract award, has not preserved this package, this does not consider the reproduction question. After the drop, reels off silk the side not to be able to receive confirms the package, for package loss which own sends, overtime reproduction, but the embedded system this time again responds and awardes, still might guarantee the reliability.
The embedded system did not remember TCP connection series number, besides first establishment connection when the initialization series number, is awardes the value according to opposite party to determine the series number, therefore it cannot distinguish the duplicate message, but responds as usual. Gives opposite party this duplicate message’s handle work to process, still might satisfy the key job request. To depended upon TCP the connection the HTTP service, the embedded server requested merely in the server end response client side, received a text data newspaper then transmitted completes, therefore did not need to consider that lost the foreword question.
Realizes the TCP limited condition machine-hour in the design, the use process actuation plan starts a process for each input state. When some event occurs, TCP uses the current condition to select a suitable process. This process processing input event and renews the current condition variable value, namely each condition corresponds a process, when an input text section arrives, TCP transfers the current condition correspondence the process, carries on processing. Procedure main as follows:
…
if (SYN_IN && port_right) tcp_send_SYN_ACK 0;
else if (SYN_IN && port_num_wrong) tcp_send_RST_ACK 0;
else if (ACK_IN && port_num_right && have_data) http_process (tcp_ACK);
else if (FIN_IN && port_num_right && have_data) http_process (tcp_FIN);
else if (FIN_IN && port_num_right && no_data) tcp_send_FIN 0;
else
…
4 summaries
In this solution has only realized the family gateway’s network control function, in next in step will join gradually uses the telephone to the family gateway’s control function. This causes the people, in cannot access the net in the situation only needs to use the telephone, can realize the people through the intelligent family gateway only then in the function which on-line can realize.