📄 readme.txt
字号:
Readme - Simple Socket Server Software ExampleDESCRIPTION: A Simple Socket Server that controls development board LEDs.Requirements: -Supported Example Hardware Platforms: Standard Full Featured -Supported Development Boards Nios Development Board, Stratix II Edition Nios Development Board, Stratix Professional Edition Nios Development Board, Stratix Edition Nios Development Board, Cyclone Edition Nios Development Board, Cyclone II Edition -System Library settings: RTOS Type - MicroC/OS-II Software Component - LWIP Period System Timer - SYS_CLK_TIMERPERIPHERALS USED:This example exercises the following peripherals:- Ethernet MAC (named "lan91c111" in SOPC Builder)- PIO, 8-bit output (named "led_pio" in SOPC Builder)- PIO, 16-bit output (named "seven_seg_pio" in SOPC Builder)- STDOUT device (UART or JTAG UART)- (optional) LCD Display (named "lcd_display" in SOPC Builder)SOFTWARE SOURCE FILES:This example includes the following software source files:- lwip_init.c: Contains main() and LWIP callback to install tasks once LWIP has beenproperly initialized.- simple_socket_server.c: Implementation of a simple_socket_server including all necessary socketscalls to handle a single socket connection & process received commands.- network_utilities.c: Contains MAC address, IP address, and DHCP routines tomanage addressing. These are used by LWIP during initialization, but areimplementation-specific (you set your MAC address to whatever you want.. or readit from your own special non-volatile memory.- led.c: Contains tasks to manage board LED commands and update LED displays.LEDManagementTask interprets commands, and toggles the row of 8 LEDS or signals the LED7SegLightshowTask in response to commands received from the host running telnet.The LEDManagementTask reads data from a MicroC/OS-II SSSLEDCommandQ Queue whichreceives its data from the SSSSimpleSocketServerTask. LED7SegLightshowTask controls the 7-segment display. - simple_socket_server.h: Definitions for the entire example application.- alt_error_handler.h: Definitions for 3 error handlers, one each for MicroC-OS/II, lwIP, and Simple Socket Server Application.- alt_error_handler.c: Implementation for 3 error handlers, one each for MicroC-OS/II, lwIP, and Simple Socket Server Application.BOARD/HOST REQUIREMENTS:This example requires an Ethernet cable connected to the development board's RJ-45 jack, and a JTAG connection with the development board. If the host communication settings are changed from JTAG UART (default) to use aconventional UART, a serial cable between board DB-9 connector and the host isrequired. If DHCP is available, the application will attempt to obtain an IPaddress from a DHCP server. Otherwise, a static IP address (defined in Simple Socket.h) will be assigned after a 120-second timeout. The DHCP timeout can be adjusted in simple_socket_server.h. ADDITIONAL INFORMATION:This is an example socket server using lwIP on MicroC/OS-II. The serverimplements simple commands to control board LEDs through a separate MicroC/OS-IItask. It is in no way a complete implementation of a telnet server.lwIP has two API's, a callback interface and "standard" sockets. This exampleuses the standard sockets interface. The sockets interface requires real-time operating system support, in this case provided by MicroC-OS/II. A good introduction to sockets programming is the book "Unix Network Programming" by Richard Stevens. Additionally, the text"Sockets in C", by Donahoo & Calvert, is a concise & inexpensive text forgetting started with sockets programming.This example will not run on the Instruction Set Simulator (ISS).Once the simple socket server example is running and has obtained an IP address (shown in the terminal window of Nios II IDE), you can connect to it over a network by typing the following command in a command shell on a development host: telnet <ip address> 30This command will try to connect to the Simple Socket Server using port 30.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -