run.c
Aller à la documentation de ce fichier.00001 #include "xtime_l.h"
00002 #include "global.h"
00003 #include "lwip/tcp.h"
00004
00005 #ifdef XPAR_XEMAC_NUM_INSTANCES
00006 #include "netif/xemacif.h"
00007 #else
00008 #include "netif/xemacliteif.h"
00009 #endif
00010
00011 void run(struct netif *netif)
00012 {
00013 XTime timer = 0;
00014 XTime timer_cycles = 0;
00015 long int ratio_etharp = 0;
00016
00017 timer_cycles = TCP_TMR_INTERVAL * (XPAR_CPU_PPC405_CORE_CLOCK_FREQ_HZ / 1000);
00018 ratio_etharp = ARP_TMR_INTERVAL / TCP_TMR_INTERVAL;
00019
00020 print("Systeme : ready !\n\r");
00021
00022 XTime_SetTime(0);
00023
00024 while(1) {
00025 XTime_GetTime(&timer);
00026
00027 if(timer < timer_cycles) {
00028 #ifdef EMAC
00029 xemacliteif_input(netif);
00030 #endif
00031 #ifdef SLIP
00032 netif->input(slipif_input(netif), netif);
00033 #endif
00034 } else {
00035 XTime_SetTime(0);
00036 timer = 0;
00037 tcp_tmr();
00038 #ifdef EMAC
00039 ratio_etharp = ratio_etharp - 1;
00040 if(0 == ratio_etharp) {
00041 ratio_etharp = ARP_TMR_INTERVAL / TCP_TMR_INTERVAL;
00042 etharp_tmr();
00043 }
00044 #endif
00045 }
00046 }
00047 }