开发工具:
文件大小: 1mb
下载次数: 0
上传时间: 2017-09-02
详细说明: w5100驱动程序。 /* * (c)COPYRIGHT * ALL RIGHT RESERVED * * FileName : main.c * Brief : source codes for W5100E01-AVR * This code is optimized at AVR-GCC 4.3.2(20081118). * Revision History : * ---------- ------- ------------------------------------------- ----- * Date version Description * ---------- ------- ------------------------------------------------ * 03/28/2007 1.0.0.0 Release version * ---------- ------- ------------------------------------------------ * 01/08/2008 1.1.0.0 Check if W5100 register and EEPROM are the same value * before displaying network information. Changed W5100 Driver(v1.2). Removed WinAVR-20050214 codes(UART). Changed check_leaseIP() function in DHCP.C. * ---------- ------- ------------------------------------------------ * 11/21/2008 1.2.0.0 optimized at Compiler WinAVR 20081118rc2 version Changed wait_1us() function delay.c Changed lcd_ready() function in lcd.c * ---------- ------- ------------------------------------------------ */ #include #include "../util/myprintf.h" #include "../mcu/types.h" #include "../mcu/timer.h" #include "../mcu/delay.h" #include "../mcu/serial.h" #include "../iinchip/socket.h" #include "../iinchip/w5100.h" //for debug 2008.02.20 #include "../evb/lcd.h" #include "../evb/evb.h" #include "../evb/manage.h" #include "../evb/channel.h" #include "../evb/config.h" #include "../inet/dhcp.h" #include "../app/webserver.h" #include "../app/loopback.h" #include "../app/ping_app.h" extern CHANNELHANDLER ChannelHandler[MAX_SOCK_NUM]; extern NETCONF NetConf; extern CHCONF ChConf; extern u_char SRC_MAC_ADDR[6]; /**< Source MAC Address */ extern u_char GET_SN_MASK[4]; /**< Subnet mask received from the DHCP server */ extern u_char GET_GW_IP[4]; /**< Gateway IP address received from the DHCP server */ extern u_char GET_DNS_IP[4]; /**< DNS server IP address received from the DHCP server */ extern u_char GET_SIP[4]; /**< Leased source IP address received from the DHCP server */ extern char uart0_getchar(FILE *f); /** @mainpage W5100 Firmware Source @section intro Introduction - Introduction : @section CREATEINFO Author - author : wiznet co. - Released date : 2006.12.20 - Last Updated date : 2008. 11. 21 */ int main(void) { u_char key; SOCKET i; evb_init(); check_manage(); /* administration mode check */ init_timer(); for (i = 0; i < MAX_SOCK_NUM; i++) { switch(ChConf.ch[i].type) { case NOTUSE: unregister_channel_handler(i); break; case DHCP_CLIENT: PRINTLN1("%d : DHCP Client Start.",i); evb_set_lcd_text(0,(u_char*)"< DHCP CLIENT >"); evb_set_lcd_text(1,(u_char*)" Wait a minute "); get_netconf(&NetConf); memcpy(SRC_MAC_ADDR,NetConf.mac,6); init_dhcp_client(i, evb_soft_reset,evb_soft_reset); if(!getIP_DHCPS()) { evb_set_lcd_text(1,(u_char*)" Fail to get IP "); PRINTLN("Fail to get a IP adress from DHCP server"); PRINTLN("Apply the default network information!!!"); ChConf.ch[i].type = NOTUSE; // Disable DHCPC; unregister_channel_handler(i); wait_10ms(100); } else { NetConf.sip = *((u_long*)GET_SIP); NetConf.gwip = *((u_long*)GET_GW_IP); NetConf.sn = *((u_long*)GET_SN_MASK); NetConf.dns = *((u_long*)GET_DNS_IP); PRINTLN("Get network information from DHCP Server..."); register_channel_handler(i,check_DHCP_state); } set_netconf(&NetConf); break; case LB_TCPS: register_channel_handler(i,loopback_tcps); break; case LB_TCPC: register_channel_handler(i,loopback_tcpc); break; case LB_UDP: register_channel_handler(i,loopback_udp); break; case WEB_SERVER: register_channel_handler(i,web_server); break; } } net_init(); evb_logo(); while (1) { for (i = 0 ; i < MAX_SOCK_NUM ; i++ ) if(ChannelHandler[i].Handler) (*ChannelHandler[i].Handler)(i); //for ISR test if(uart_keyhit(0)) { key = uart0_getchar(NULL); if(key == 'c') { for(i=0;i<4;i++) IINCHIP_WRITE(Sn_IR(i), 0xFF); IINCHIP_WRITE(IR, 0xFF); PRINTLN("all interrupt register cleared!!!!"); } } } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.