summaryrefslogtreecommitdiff
path: root/nuttx/net/net_initialize.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-02-14 06:36:53 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-02-14 06:36:53 -0600
commit45cd51e3fccab3239bfe7693d3b8ac5c85bf794a (patch)
tree4843b2a77f8a5d15f6fb192201cdd44d17a7db85 /nuttx/net/net_initialize.c
parent0faee4135ba8bec677d0bcab8d5f86682df45aa2 (diff)
downloadpx4-nuttx-45cd51e3fccab3239bfe7693d3b8ac5c85bf794a.tar.gz
px4-nuttx-45cd51e3fccab3239bfe7693d3b8ac5c85bf794a.tar.bz2
px4-nuttx-45cd51e3fccab3239bfe7693d3b8ac5c85bf794a.zip
Networking: Divide net_intiialize() into net_setup() and net_initialize() to solve a chicken-and-egg problem. net_setup() must be caleld before up_initialize() is called so that networking data structures are ready to register new network devices.
net_initialize() now does only timer related operations and is called AFTER up_initialize() where the timers are configured. This is really.
Diffstat (limited to 'nuttx/net/net_initialize.c')
-rw-r--r--nuttx/net/net_initialize.c46
1 files changed, 40 insertions, 6 deletions
diff --git a/nuttx/net/net_initialize.c b/nuttx/net/net_initialize.c
index 3fee0f4a1..af0e8651f 100644
--- a/nuttx/net/net_initialize.c
+++ b/nuttx/net/net_initialize.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/net_sockets.c
*
- * Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -83,11 +83,19 @@
****************************************************************************/
/****************************************************************************
- * Name: net_initialize
+ * Name: net_setup
*
* Description:
* This is called from the OS initialization logic at power-up reset in
- * order to configure the networking subsystem.
+ * order to configure networking data structures. This is called prior
+ * to platform-specific driver initialization so that the networking
+ * subsystem is prepared to deal with network driver initialization
+ * actions.
+ *
+ * Actions performed in this initialization phase assume that base OS
+ * facilities such as semaphores are available but this logic cannot
+ * depend upon OS resources such as interrupts or timers which are not
+ * yet available.
*
* Input Parameters:
* None
@@ -97,7 +105,7 @@
*
****************************************************************************/
-void net_initialize(void)
+void net_setup(void)
{
/* Initialize the locking facility */
@@ -108,9 +116,9 @@ void net_initialize(void)
arp_reset();
#ifdef CONFIG_NET_IPv6
- /* Initialize the Neighbor Table */
+ /* Initialize the Neighbor Table data structures */
- neighbor_initialize();
+ neighbor_setup();
#endif
#ifdef CONFIG_NET_IOB
@@ -174,6 +182,32 @@ void net_initialize(void)
netdev_seminit();
#endif
+}
+
+/****************************************************************************
+ * Name: net_initialize
+ *
+ * Description:
+ * This function is called from the OS initialization logic at power-up
+ * reset AFTER initialization of hardware facilities such as timers and
+ * interrupts. This logic completes the initialization started by
+ * net_setup().
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void net_initialize(void)
+{
+#ifdef CONFIG_NET_IPv6
+ /* Configure Neighbor Table ageing */
+
+ neighbor_initialize();
+#endif
/* Initialize the periodic ARP timer */