projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update the tcp_server example to use the correct ip input callback.
[bertos.git]
/
boards
/
at91sam7x-ek
/
examples
/
tcp_server
/
main.c
diff --git
a/boards/at91sam7x-ek/examples/tcp_server/main.c
b/boards/at91sam7x-ek/examples/tcp_server/main.c
index c99a995dea13ae6f6b1e8a6f610eda7f2f2590f1..71e678826a1902c6a3703405185b46d4f138f72b 100644
(file)
--- a/
boards/at91sam7x-ek/examples/tcp_server/main.c
+++ b/
boards/at91sam7x-ek/examples/tcp_server/main.c
@@
-88,7
+88,7
@@
static void init(void)
tcpip_init(NULL, NULL);
/* Bring up the network interface */
tcpip_init(NULL, NULL);
/* Bring up the network interface */
- netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, ip_input);
+ netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init,
tcp
ip_input);
netif_set_default(&netif);
netif_set_up(&netif);
}
netif_set_default(&netif);
netif_set_up(&netif);
}
@@
-118,13
+118,16
@@
int main(void)
proc_new(monitor_process, NULL, KERN_MINSTACKSIZE * 2, NULL);
dhcp_start(&netif);
proc_new(monitor_process, NULL, KERN_MINSTACKSIZE * 2, NULL);
dhcp_start(&netif);
+ /*
+ * Here we wait for an ip address, but it's not strictly
+ * necessary. The address is obtained in background and
+ * as long as we don't use network functions, we could go
+ * on with initialization
+ */
while (!netif.ip_addr.addr)
while (!netif.ip_addr.addr)
- {
- dhcp_fine_tmr();
- timer_delay(DHCP_FINE_TIMER_MSECS);
- }
- kprintf(">>> dhcp ok: ip = %#x (kernel %s)\n",
- (unsigned int)netif.ip_addr.addr,
+ timer_delay(200);
+ kprintf(">>> dhcp ok: ip = ip = %s (kernel %s)\n",
+ ip_ntoa(&netif.ip_addr.addr),
CONFIG_KERN_PREEMPT ? "preempt" : "coop");
server = netconn_new(NETCONN_TCP);
CONFIG_KERN_PREEMPT ? "preempt" : "coop");
server = netconn_new(NETCONN_TCP);