SEARCH
TOOLBOX
LANGUAGES
modified on 20 June 2010 at 01:09 ••• 7,296 views

Eagle enet io Example

From Manuals

Jump to: navigation, search

Ethernet-based I/O Control (enet_io)

Compatibility Eagle 50E, 100

This example application demonstrates web-based I/O control using the Stellaris Ethernet controller and the lwIP TCP/IP Stack. DHCP is used to obtain an Ethernet address. If DHCP times out without obtaining an address, a static IP address will be chosen using AutoIP. The address that is selected will be shown on the OLED display allowing you to access the internal web pages served by the application via your normal web browser.

Two different methods of controlling board peripherals via web pages are illustrated via pages labeled "IO Control Demo 1" and "IO Control Demo 2" in the navigation menu on the left of the application’s home page.

"IO Control Demo 1" uses JavaScript running in the web browser to send HTTP requests for particular special URLs. These special URLs are intercepted in the file system support layer (lmi_fs.c) and used to control the LED and speaker PWM. Responses generated by the board are returned to the browser and inserted into the page HTML dynamically by more JavaScript code.

"IO Control Demo 2" uses standard HTML forms to pass parameters to CGI (Common Gateway Interface) handlers running on the board. These handlers process the form data and control the PWM and LED as requested before sending a response page (in this case, the original form) back to the browser. The application registers the names and handlers for each of its CGIs with the HTTPD server during initialization and the server calls these handlers after parsing URL parameters each time one of the CGI URLs is requested.

Information on the state of the various controls in the second demo is inserted into the served HTML using SSI (Server Side Include) tags which are parsed by the HTTPD server in the application. As with the CGI handlers, the application registers its list of SSI tags and a handler function with the web server during initialization and this handler is called whenever any registered tag is found in a .shtml, .ssi or .shtm file being served to the browser.

Note that the web server used by this example has been modified from the example shipped with the basic lwIP package. Additions include SSI and CGI support along with the ability to have the server automatically insert the HTTP headers rather than having these built in to the files in the file system image.


References:

For additional details on lwIP, refer to the lwIP web page at:


http://savannah.nongnu.org/projects/lwip/

http://www.sics.se/~adam/lwip/