Add CONFIG_NETDEV_LATEINIT that can be used to suppress calls to up_netinitialize() from early initialization

This commit is contained in:
Gregory Nutt 2015-07-17 07:20:16 -06:00
parent a7a7ec8850
commit 8e4f3bddb6
15 changed files with 65 additions and 27 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/common/up_etherstub.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -66,18 +66,18 @@
*
* Description:
* This is a stub version os up_netinitialize. Normally, up_netinitialize
* is defined in board/up_network.c for board-specific ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific ethernet
* implementations. The stub version here is used in the cornercase where
* the network is enable yet there is no ethernet driver to be initialized.
* is defined in board/xyz_network.c for board-specific Ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific Ethernet
* implementations. The stub version here is used in the corner case where
* the network is enable yet there is no Ethernet driver to be initialized.
* In this case, up_initialize will still try to call up_netinitialize()
* when one does not exist. This cornercase would occur if, for example,
* when one does not exist. This corner case would occur if, for example,
* only a USB network interface is being used or perhaps if a SLIP is
* being used).
*
* In the long run, it might be better to have some kind of CONFIG_NO_ETHERNET
* to suppress the call to up_netinitialize() in up_initialize(). Then
* this stub would not be needed.
* Use of this stub is deprecated. The preferred mechanism is to use
* CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* up_initialize(). Then this stub would not be needed.
*
****************************************************************************/

View File

@ -248,9 +248,11 @@ void up_initialize(void)
ramlog_sysloginit();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
/* Initialize USB -- device and/or host */

View File

@ -478,10 +478,14 @@ void up_wdtinit(void);
/* Networking ***************************************************************/
/* Defined in board/up_network.c for board-specific Ethernet implementations,
/* Defined in board/xyz_network.c for board-specific Ethernet implementations,
* or chip/xyx_ethernet.c for chip-specific Ethernet implementations, or
* common/up_etherstub.c for a cornercase where the network is enabled yet
* common/up_etherstub.c for a corner case where the network is enabled yet
* there is no Ethernet driver to be initialized.
*
* Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
* use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* up_initialize(). Then this stub would not be needed.
*/
#ifdef CONFIG_NET

View File

@ -1,7 +1,7 @@
############################################################################
# arch/arm/src/kinetis/Make.defs
#
# Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -67,6 +67,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifeq ($(CONFIG_NET),y)
ifneq ($(CONFIG_KINETIS_ENET),y)
CMN_CSRCS += up_etherstub.c

View File

@ -1,7 +1,7 @@
############################################################################
# arch/arm/src/lpc17xx/Make.defs
#
# Copyright (C) 2010-2011, 2013-2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2010-2011, 2013-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -82,6 +82,10 @@ CMN_UASRCS += up_signal_handler.S
endif
endif
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifeq ($(CONFIG_NET),y)
ifneq ($(CONFIG_LPC17_ETHERNET),y)
CMN_CSRCS += up_etherstub.c

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/avr/src/common/up_initialize.c
*
* Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2010, 2012-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -262,9 +262,11 @@ void up_initialize(void)
ramlog_sysloginit();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
/* Initialize USB */

View File

@ -186,9 +186,11 @@ void up_initialize(void)
ramlog_sysloginit();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
/* Initialize USB */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/mips/src/common/up_etherstub.c
*
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -66,18 +66,18 @@
*
* Description:
* This is a stub version os up_netinitialize. Normally, up_netinitialize
* is defined in board/up_network.c for board-specific ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific ethernet
* implementations. The stub version here is used in the cornercase where
* the network is enable yet there is no ethernet driver to be initialized.
* is defined in board/xyz_network.c for board-specific Ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific Ethernet
* implementations. The stub version here is used in the corner case where
* the network is enable yet there is no Ethernet driver to be initialized.
* In this case, up_initialize will still try to call up_netinitialize()
* when one does not exist. This cornercase would occur if, for example,
* when one does not exist. This corner case would occur if, for example,
* only a USB network interface is being used or perhaps if a SLIP is
* being used). In those cases, the initialization path is very different.
* being used).
*
* In the long run, it might be better to have some kind of CONFIG_NO_ETHERNET
* to suppress the call to up_netinitialize() in up_initialize(). Then
* this stub would not be needed.
* Use of this stub is deprecated. The preferred mechanism is to use
* CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* up_initialize(). Then this stub would not be needed.
*
****************************************************************************/

View File

@ -188,9 +188,11 @@ void up_initialize(void)
ramlog_sysloginit();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
/* Initialize USB -- device and/or host */

View File

@ -1,7 +1,7 @@
############################################################################
# arch/mips/src/pic32mx/Make.defs
#
# Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
# Copyright (C) 2011-2012, 2014-2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -51,6 +51,10 @@ CMN_CSRCS += up_usestack.c up_vfork.c
# Configuration dependent common files
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifneq ($(CONFIG_PIC32MX_ETHERNET),y)
ifeq ($(CONFIG_NET),y)
CMN_CSRCS += up_etherstub.c

View File

@ -51,6 +51,10 @@ CMN_CSRCS += up_usestack.c up_vfork.c
# Configuration dependent common files
# Use of common/up_etherstub.c is deprecated. The preferred mechanism is to
# use CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
# up_initialize(). Then this stub would not be needed.
ifneq ($(CONFIG_PIC32MZ_ETHERNET),y)
ifeq ($(CONFIG_NET),y)
CMN_CSRCS += up_etherstub.c

View File

@ -176,9 +176,11 @@ void up_initialize(void)
ramlog_sysloginit();
#endif
/* Initialize the netwok */
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
/* Initialize USB */

View File

@ -188,9 +188,11 @@ void up_initialize(void)
ramlog_sysloginit();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
/* Initialize USB -- device and/or host */

View File

@ -192,8 +192,11 @@ void up_initialize(void)
ramlog_sysloginit();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
board_led_on(LED_IRQSENABLED);
}

View File

@ -175,8 +175,11 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
/* Initialize the netwok */
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize();
#endif
board_led_on(LED_IRQSENABLED);
}