Minor RTL/WLAN update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3531 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
a4ff160e5a
commit
383fa8a445
@ -122,14 +122,14 @@ static struct usbhost_driver_s *g_drvr;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: wlan_waiter
|
* Name: wlan_bringup
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Wait for USB devices to be connected.
|
* Wait for USB devices to be connected.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int wlan_waiter(int argc, char *argv[])
|
static inline void wlan_bringup(void)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_EXAMPLE_WLAN_DHCPC) || defined(CONFIG_EXAMPLE_WLAN_NOMAC)
|
#if defined(CONFIG_EXAMPLE_WLAN_DHCPC) || defined(CONFIG_EXAMPLE_WLAN_NOMAC)
|
||||||
uint8_t mac[IFHWADDRLEN];
|
uint8_t mac[IFHWADDRLEN];
|
||||||
@ -138,29 +138,6 @@ static int wlan_waiter(int argc, char *argv[])
|
|||||||
#ifdef CONFIG_EXAMPLE_WLAN_DHCPC
|
#ifdef CONFIG_EXAMPLE_WLAN_DHCPC
|
||||||
void *handle;
|
void *handle;
|
||||||
#endif
|
#endif
|
||||||
bool connected = false;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
printf("wlan_waiter: Running\n");
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
/* Wait for the device to change state */
|
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
|
||||||
DEBUGASSERT(ret == OK);
|
|
||||||
|
|
||||||
connected = !connected;
|
|
||||||
printf("wlan_waiter: %s\n", connected ? "connected" : "disconnected");
|
|
||||||
|
|
||||||
/* Did we just become connected? */
|
|
||||||
|
|
||||||
if (connected)
|
|
||||||
{
|
|
||||||
/* Yes.. enumerate the newly connected device */
|
|
||||||
|
|
||||||
ret = DRVR_ENUMERATE(g_drvr);
|
|
||||||
|
|
||||||
/* If the enumeration was successful, then bring up the interface */
|
|
||||||
|
|
||||||
/* Many embedded network interfaces must have a software assigned
|
/* Many embedded network interfaces must have a software assigned
|
||||||
* MAC
|
* MAC
|
||||||
@ -176,15 +153,6 @@ static int wlan_waiter(int argc, char *argv[])
|
|||||||
uip_setmacaddr("eth0", mac);
|
uip_setmacaddr("eth0", mac);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set up our host address */
|
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLE_WLAN_DHCPC
|
|
||||||
addr.s_addr = 0;
|
|
||||||
#else
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_IPADDR);
|
|
||||||
#endif
|
|
||||||
uip_sethostaddr("eth0", &addr);
|
|
||||||
|
|
||||||
/* Set up the default router address */
|
/* Set up the default router address */
|
||||||
|
|
||||||
addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_DRIPADDR);
|
addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_DRIPADDR);
|
||||||
@ -195,6 +163,15 @@ static int wlan_waiter(int argc, char *argv[])
|
|||||||
addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_NETMASK);
|
addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_NETMASK);
|
||||||
uip_setnetmask("eth0", &addr);
|
uip_setnetmask("eth0", &addr);
|
||||||
|
|
||||||
|
/* Set up our host address */
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLE_WLAN_DHCPC
|
||||||
|
addr.s_addr = 0;
|
||||||
|
#else
|
||||||
|
addr.s_addr = HTONL(CONFIG_EXAMPLE_WLAN_IPADDR);
|
||||||
|
#endif
|
||||||
|
uip_sethostaddr("eth0", &addr);
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLE_WLAN_DHCPC
|
#ifdef CONFIG_EXAMPLE_WLAN_DHCPC
|
||||||
/* Set up the resolver */
|
/* Set up the resolver */
|
||||||
|
|
||||||
@ -236,6 +213,43 @@ static int wlan_waiter(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: wlan_waiter
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Wait for USB devices to be connected.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int wlan_waiter(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
bool connected = false;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
printf("wlan_waiter: Running\n");
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
|
ret = DRVR_WAIT(g_drvr, connected);
|
||||||
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
|
connected = !connected;
|
||||||
|
printf("wlan_waiter: %s\n", connected ? "connected" : "disconnected");
|
||||||
|
|
||||||
|
/* Did we just become connected? */
|
||||||
|
|
||||||
|
if (connected)
|
||||||
|
{
|
||||||
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
|
ret = DRVR_ENUMERATE(g_drvr);
|
||||||
|
|
||||||
|
/* If the enumeration was successful, then bring up the interface */
|
||||||
|
|
||||||
|
wlan_bringup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep the compiler from complaining */
|
/* Keep the compiler from complaining */
|
||||||
|
Loading…
Reference in New Issue
Block a user