sim: Add logic to initialize the local loopback device is so configured

This commit is contained in:
Gregory Nutt 2015-08-24 13:46:05 -06:00
parent f986d08515
commit c9603b27c0
3 changed files with 22 additions and 5 deletions

View File

@ -38,7 +38,11 @@
***************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/net/loopback.h>
/***************************************************************************
* Public Functions
@ -57,6 +61,19 @@
#ifdef CONFIG_LIB_BOARDCTL
int board_app_initialize(void)
{
#ifdef CONFIG_NETDEV_LOOPBACK
int ret;
/* Initialize the local loopback device */
ret = localhost_initialize();
if (ret < 0)
{
ndbg("ERROR: localhost_initialize() failed: %d\n", ret);
}
#endif /* CONFIG_NETDEV_LOOPBACK */
return 0;
}
#endif /* CONFIG_LIB_BOARDCTL */

View File

@ -280,7 +280,7 @@ int sim_ajoy_initialize(void);
/* up_tapdev.c ************************************************************/
#if defined(CONFIG_NET) && !defined(__CYGWIN__)
#if defined(CONFIG_NET_ETHERNET) && !defined(__CYGWIN__)
void tapdev_init(void);
unsigned int tapdev_read(unsigned char *buf, unsigned int buflen);
void tapdev_send(unsigned char *buf, unsigned int buflen);
@ -292,7 +292,7 @@ void tapdev_send(unsigned char *buf, unsigned int buflen);
/* up_wpcap.c *************************************************************/
#if defined(CONFIG_NET) && defined(__CYGWIN__)
#if defined(CONFIG_NET_ETHERNET) && defined(__CYGWIN__)
void wpcap_init(void);
unsigned int wpcap_read(unsigned char *buf, unsigned int buflen);
void wpcap_send(unsigned char *buf, unsigned int buflen);
@ -304,7 +304,7 @@ void wpcap_send(unsigned char *buf, unsigned int buflen);
/* up_netdriver.c *********************************************************/
#ifdef CONFIG_NET
#ifdef CONFIG_NET_ETHERNET
int netdriver_init(void);
int netdriver_setmacaddr(unsigned char *macaddr);
void netdriver_loop(void);

View File

@ -44,7 +44,7 @@
#include <nuttx/config.h>
#ifdef CONFIG_NET
#ifdef CONFIG_NET_ETHERNET
#include <stdint.h>
#include <stdbool.h>
@ -325,5 +325,5 @@ int netdriver_setmacaddr(unsigned char *macaddr)
return 0;
}
#endif /* CONFIG_NET */
#endif /* CONFIG_NET_ETHERNET */