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
+9 -9
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/common/up_etherstub.c * 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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -66,18 +66,18 @@
* *
* Description: * Description:
* This is a stub version os up_netinitialize. Normally, up_netinitialize * This is a stub version os up_netinitialize. Normally, up_netinitialize
* is defined in board/up_network.c for board-specific ethernet * is defined in board/xyz_network.c for board-specific Ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific ethernet * implementations, or chip/xyx_ethernet.c for chip-specific Ethernet
* implementations. The stub version here is used in the cornercase where * 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. * 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() * 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 * only a USB network interface is being used or perhaps if a SLIP is
* being used). * being used).
* *
* In the long run, it might be better to have some kind of CONFIG_NO_ETHERNET * Use of this stub is deprecated. The preferred mechanism is to use
* to suppress the call to up_netinitialize() in up_initialize(). Then * CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* this stub would not be needed. * up_initialize(). Then this stub would not be needed.
* *
****************************************************************************/ ****************************************************************************/
+2
View File
@@ -248,9 +248,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB -- device and/or host */ /* Initialize USB -- device and/or host */
+6 -2
View File
@@ -478,10 +478,14 @@ void up_wdtinit(void);
/* Networking ***************************************************************/ /* 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 * 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. * 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 #ifdef CONFIG_NET
+5 -1
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# arch/arm/src/kinetis/Make.defs # 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> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -67,6 +67,10 @@ CMN_UASRCS += up_signal_handler.S
endif endif
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) ifeq ($(CONFIG_NET),y)
ifneq ($(CONFIG_KINETIS_ENET),y) ifneq ($(CONFIG_KINETIS_ENET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+5 -1
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# arch/arm/src/lpc17xx/Make.defs # 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> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -82,6 +82,10 @@ CMN_UASRCS += up_signal_handler.S
endif endif
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) ifeq ($(CONFIG_NET),y)
ifneq ($(CONFIG_LPC17_ETHERNET),y) ifneq ($(CONFIG_LPC17_ETHERNET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+3 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/avr/src/common/up_initialize.c * 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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -262,9 +262,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB */ /* Initialize USB */
+2
View File
@@ -186,9 +186,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB */ /* Initialize USB */
+10 -10
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/mips/src/common/up_etherstub.c * 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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -66,18 +66,18 @@
* *
* Description: * Description:
* This is a stub version os up_netinitialize. Normally, up_netinitialize * This is a stub version os up_netinitialize. Normally, up_netinitialize
* is defined in board/up_network.c for board-specific ethernet * is defined in board/xyz_network.c for board-specific Ethernet
* implementations, or chip/xyx_ethernet.c for chip-specific ethernet * implementations, or chip/xyx_ethernet.c for chip-specific Ethernet
* implementations. The stub version here is used in the cornercase where * 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. * 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() * 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 * 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 * Use of this stub is deprecated. The preferred mechanism is to use
* to suppress the call to up_netinitialize() in up_initialize(). Then * CONFIG_NETDEV_LATEINIT=y to suppress the call to up_netinitialize() in
* this stub would not be needed. * up_initialize(). Then this stub would not be needed.
* *
****************************************************************************/ ****************************************************************************/
+2
View File
@@ -188,9 +188,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB -- device and/or host */ /* Initialize USB -- device and/or host */
+5 -1
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# arch/mips/src/pic32mx/Make.defs # 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> # Author: Gregory Nutt <gnutt@nuttx.org>
# #
# Redistribution and use in source and binary forms, with or without # 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 # 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) ifneq ($(CONFIG_PIC32MX_ETHERNET),y)
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+4
View File
@@ -51,6 +51,10 @@ CMN_CSRCS += up_usestack.c up_vfork.c
# Configuration dependent common files # 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) ifneq ($(CONFIG_PIC32MZ_ETHERNET),y)
ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET),y)
CMN_CSRCS += up_etherstub.c CMN_CSRCS += up_etherstub.c
+3 -1
View File
@@ -176,9 +176,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
/* Initialize the netwok */ #ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB */ /* Initialize USB */
+2
View File
@@ -188,9 +188,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
/* Initialize USB -- device and/or host */ /* Initialize USB -- device and/or host */
+3
View File
@@ -192,8 +192,11 @@ void up_initialize(void)
ramlog_sysloginit(); ramlog_sysloginit();
#endif #endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */ /* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
board_led_on(LED_IRQSENABLED); board_led_on(LED_IRQSENABLED);
} }
+4 -1
View File
@@ -175,8 +175,11 @@ void up_initialize(void)
ramlog_consoleinit(); ramlog_consoleinit();
#endif #endif
/* Initialize the netwok */ #ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */
up_netinitialize(); up_netinitialize();
#endif
board_led_on(LED_IRQSENABLED); board_led_on(LED_IRQSENABLED);
} }