main.c

Go to the documentation of this file.
00001 
00002 #include <avr/io.h>
00003 #include <avr/interrupt.h>
00004 
00005 #include <dispatcher.h>
00006 
00007 #include "init.h"
00008 #include "arch/avr/rtl8019.h"
00009 #include "net/net_if.h"
00010 
00011 #include "net/tcp.h"
00012 #include "app/ports.h"
00013 #include "app/dns_sd.h"
00014 
00015 #include "telnet.h"
00016 #include "httpd.h"
00017 
00018 int main( void )
00019 {
00020         char x = 0;
00021 #if (NIP_DNSSD_ENABLE == 1)
00022 /*      nip_dnssd_id_t srv_id = NIP_DNSSD_NO_SERVICE;
00023         int  i = 0;
00024         uint8_t *instance_name = (uint8_t*)"\x03""avr";
00025         uint8_t *service_name  = (uint8_t*)"\x06""_nipev""\x04""_tcp";
00026         uint8_t *txt_records   = (uint8_t*)"\x08""you=suck";
00027         nip_mem_ptr_t  in_mem_ptr;
00028         nip_mem_ptr_t  srv_mem_ptr;
00029         nip_mem_ptr_t  txt_mem_ptr;*/
00030 #endif
00031 
00032         sei();
00033 
00034         init_networking();
00035         init_time();
00036 
00037 #if TELNET_ENABLE == 1
00038         telnet_start();
00039 #endif
00040 #if HTTPD_ENABLE == 1
00041         httpd_start();
00042 #endif
00043 
00044 //      Init_Realtek_Network_Card();
00045 
00046         DDRD =_BV( PD7 );
00047 
00048 
00049         while (1)
00050         {
00051 #if TELNET_ENABLE == 1
00052                 telnet_check();
00053 #endif
00054 #if HTTPD_ENABLE == 1
00055                 httpd_check();
00056 #endif
00057 
00058                 if ( x++ % 2 == 0 )
00059                         PORTD |= _BV( PD7 );
00060                 else
00061                         PORTD &= ~_BV( PD7 );
00062 
00063 //              for ( i=0; i<13000; i++);
00064 
00065 #if (NIP_DNSSD_ENABLE == 1)
00066 
00067 /*              if ( i == 0 )
00068                 {
00069 // Step here using the Debugger to register _nipev._tcp service
00070 // after mDNS is up and running.
00071 
00072                         in_mem_ptr.id  = NIP_MEM_NULL;
00073                         in_mem_ptr.ptr = instance_name;
00074 //                      instance_name[0] = 3;
00075                         srv_mem_ptr.id  = NIP_MEM_NULL;
00076                         srv_mem_ptr.ptr = service_name;
00077 //                      service_name[0] = 7;
00078 //                      service_name[8] = 4;
00079                         txt_mem_ptr.id  = NIP_MEM_NULL;
00080                         txt_mem_ptr.ptr = txt_records;
00081 //                      txt_records[0]  = 8;
00082                         srv_id = nip_dnssd_register( &in_mem_ptr, &srv_mem_ptr, &txt_mem_ptr,9, NIP_TCP_PORT_TELNET, 0, 0 );
00083                 }
00084                 */
00085 #endif
00086 
00087 #if (NIP_DISP_ENABLE == 1)
00088                 nip_disp_notify( NIP_DISP_TIMER );
00089                 nip_disp_notify_if( 0, NIP_DISP_IF_TIMER );
00090                 nip_dispatcher();
00091 
00092 #endif
00093         }
00094 
00095         return 0;
00096 }

Generated on Thu Jul 10 01:09:30 2008 for NIP by  doxygen 1.5.5