RTL8187 driver update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3356 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
1b91975e30
commit
91f3674d8f
6 changed files with 180 additions and 90 deletions
|
|
@ -54,7 +54,7 @@
|
|||
# CONFIG_DRAM_SIZE - Describes the installed DRAM.
|
||||
# CONFIG_DRAM_START - The start address of DRAM (physical)
|
||||
# CONFIG_DRAM_END - Last address+1 of installed RAM
|
||||
# CONFIG_ARCH_IRQPRIO - The ST32F103Z supports interrupt prioritization
|
||||
# CONFIG_ARCH_IRQPRIO - The LPC17xx supports interrupt prioritization
|
||||
# CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
|
||||
# stack. If defined, this symbol is the size of the interrupt
|
||||
# stack in bytes. If not defined, the user task stacks will be
|
||||
|
|
@ -209,6 +209,7 @@ CONFIG_PHY_KS8721=y
|
|||
CONFIG_PHY_AUTONEG=y
|
||||
CONFIG_PHY_SPEED100=n
|
||||
CONFIG_PHY_FDUPLEX=y
|
||||
CONFIG_NET_REGDEBUG=n
|
||||
|
||||
#
|
||||
# General build options
|
||||
|
|
@ -241,6 +242,8 @@ CONFIG_HAVE_LIBM=n
|
|||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
# CONFIG_DEBUG_SYMBOLS - build without optimization and with
|
||||
# debug symbols (needed for use with a debugger).
|
||||
# CONFIG_DEBUG_NET - enable network debug output
|
||||
# CONFIG_DEBUG_USB - enable usb debug output
|
||||
# CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
# regions of memory to allocate from, this specifies the
|
||||
# number of memory regions that the memory manager must
|
||||
|
|
@ -328,15 +331,16 @@ CONFIG_APP_DIR=examples/nsh
|
|||
CONFIG_DEBUG=n
|
||||
CONFIG_DEBUG_VERBOSE=n
|
||||
CONFIG_DEBUG_SYMBOLS=n
|
||||
CONFIG_DEBUG_NET=n
|
||||
CONFIG_DEBUG_USB=n
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_INSTRUMENTATION=n
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_START_YEAR=2010
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_DAY=22
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_START_DAY=8
|
||||
CONFIG_GREGORIAN_TIME=n
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
|
|
@ -531,16 +535,17 @@ CONFIG_MMCSD_HAVECARDDETECT=n
|
|||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
# CONFIG_NET_WLAN - Enable or disable WLAN network interface
|
||||
#
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NSOCKET_DESCRIPTORS=2
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_TCP=n
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_ICMP=n
|
||||
|
|
@ -552,6 +557,7 @@ CONFIG_NET_STATISTICS=y
|
|||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
CONFIG_NET_WLAN=y
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
|
|
@ -898,3 +904,9 @@ CONFIG_PTHREAD_STACK_MIN=256
|
|||
CONFIG_PTHREAD_STACK_DEFAULT=2048
|
||||
CONFIG_HEAP_BASE=
|
||||
CONFIG_HEAP_SIZE=
|
||||
|
||||
#
|
||||
# USB WLAN device identification
|
||||
#
|
||||
CONFIG_USB_WLAN_VID=0x0bda
|
||||
CONFIG_USB_WLAN_PID=0x8189
|
||||
|
|
|
|||
|
|
@ -213,6 +213,13 @@ static int nsh_usbhostinitialize(void)
|
|||
message("nsh_usbhostinitialize: Failed to register the mass storage class\n");
|
||||
}
|
||||
|
||||
message("nsh_usbhostinitialize: Register device specific drivers\n");
|
||||
ret = usbhost_wlaninit();
|
||||
if (ret != OK)
|
||||
{
|
||||
message("nsh_usbhostinitialize: Failed to register the WLAN device\n");
|
||||
}
|
||||
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
message("nsh_usbhostinitialize: Initialize USB host\n");
|
||||
|
|
|
|||
|
|
@ -241,6 +241,8 @@ CONFIG_HAVE_LIBM=n
|
|||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
# CONFIG_DEBUG_SYMBOLS - build without optimization and with
|
||||
# debug symbols (needed for use with a debugger).
|
||||
# CONFIG_DEBUG_NET - enable network debug output
|
||||
# CONFIG_DEBUG_USB - enable usb debug output
|
||||
# CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
# regions of memory to allocate from, this specifies the
|
||||
# number of memory regions that the memory manager must
|
||||
|
|
@ -328,6 +330,7 @@ CONFIG_APP_DIR=examples/wlan
|
|||
CONFIG_DEBUG=n
|
||||
CONFIG_DEBUG_VERBOSE=n
|
||||
CONFIG_DEBUG_SYMBOLS=n
|
||||
CONFIG_DEBUG_NET=n
|
||||
CONFIG_DEBUG_USB=n
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
|
|
@ -336,7 +339,7 @@ CONFIG_SCHED_INSTRUMENTATION=n
|
|||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_DAY=8
|
||||
CONFIG_GREGORIAN_TIME=n
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
|
|
@ -900,3 +903,9 @@ CONFIG_PTHREAD_STACK_MIN=256
|
|||
CONFIG_PTHREAD_STACK_DEFAULT=2048
|
||||
CONFIG_HEAP_BASE=
|
||||
CONFIG_HEAP_SIZE=
|
||||
|
||||
#
|
||||
# USB WLAN device identification
|
||||
#
|
||||
CONFIG_USB_WLAN_VID=0x0bda
|
||||
CONFIG_USB_WLAN_PID=0x8189
|
||||
|
|
|
|||
|
|
@ -240,6 +240,8 @@ CONFIG_HAVE_LIBM=n
|
|||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
# CONFIG_DEBUG_SYMBOLS - build without optimization and with
|
||||
# debug symbols (needed for use with a debugger).
|
||||
# CONFIG_DEBUG_NET - enable network debug output
|
||||
# CONFIG_DEBUG_USB - enable usb debug output
|
||||
# CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
# regions of memory to allocate from, this specifies the
|
||||
# number of memory regions that the memory manager must
|
||||
|
|
@ -327,6 +329,7 @@ CONFIG_APP_DIR=examples/wlan
|
|||
CONFIG_DEBUG=n
|
||||
CONFIG_DEBUG_VERBOSE=n
|
||||
CONFIG_DEBUG_SYMBOLS=n
|
||||
CONFIG_DEBUG_NET=n
|
||||
CONFIG_DEBUG_USB=n
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
|
|
@ -335,7 +338,7 @@ CONFIG_SCHED_INSTRUMENTATION=n
|
|||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_DAY=8
|
||||
CONFIG_GREGORIAN_TIME=n
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
|
|
@ -894,3 +897,9 @@ CONFIG_PTHREAD_STACK_MIN=256
|
|||
CONFIG_PTHREAD_STACK_DEFAULT=2048
|
||||
CONFIG_HEAP_BASE=
|
||||
CONFIG_HEAP_SIZE=
|
||||
|
||||
#
|
||||
# USB WLAN device identification
|
||||
#
|
||||
CONFIG_USB_WLAN_VID=0x0bda
|
||||
CONFIG_USB_WLAN_PID=0x8189
|
||||
|
|
|
|||
|
|
@ -229,11 +229,6 @@ static inline int usbhost_classbind(FAR struct usbhost_driver_s *drvr,
|
|||
const struct usbhost_registry_s *reg;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (id->base == USB_CLASS_VENDOR_SPEC)
|
||||
{
|
||||
udbg("BUG: More logic needed to extract VID and PID\n");
|
||||
}
|
||||
|
||||
/* Is there is a class implementation registered to support this device. */
|
||||
|
||||
reg = usbhost_findclass(id);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* @TODO TEMPORARILY. REMOVE LATER!!! */
|
||||
/* @TODO REMOVE LATER!!! */
|
||||
#define CONFIG_WLAN_IRQ 1
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -265,6 +265,11 @@ static int wlan_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
|||
static int wlan_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
||||
#endif
|
||||
|
||||
/* Register and unregister network device */
|
||||
|
||||
static int wlan_initialize(int intf);
|
||||
static int wlan_uninitialize(int intf);
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NET_WLAN */
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -278,10 +283,10 @@ static int wlan_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac);
|
|||
static const const struct usbhost_id_s g_id =
|
||||
{
|
||||
USB_CLASS_VENDOR_SPEC, /* base */
|
||||
0xff, /* subclass */
|
||||
0xff, /* proto */
|
||||
0x0bda, /* vid */
|
||||
0x8189 /* pid */
|
||||
0xff, /* subclass */
|
||||
0xff, /* proto */
|
||||
CONFIG_USB_WLAN_VID, /* vid */
|
||||
CONFIG_USB_WLAN_PID /* pid */
|
||||
};
|
||||
|
||||
/* This is the USB host wireless LAN class's registry entry */
|
||||
|
|
@ -738,12 +743,13 @@ static inline int usbhost_devinit(FAR struct usbhost_state_s *priv)
|
|||
|
||||
uvdbg("Register block driver\n");
|
||||
usbhost_mkdevname(priv, devname);
|
||||
ret = wlan_initialize(0);
|
||||
// ret = register_blockdriver(devname, &g_bops, 0, priv);
|
||||
}
|
||||
|
||||
/* Check if we successfully initialized. We now have to be concerned
|
||||
* about asynchronous modification of crefs because the block
|
||||
* driver has been registerd.
|
||||
* driver has been registered.
|
||||
*/
|
||||
|
||||
if (ret == OK)
|
||||
|
|
@ -1131,6 +1137,10 @@ static int usbhost_disconnected(struct usbhost_class_s *class)
|
|||
}
|
||||
}
|
||||
|
||||
/* Unregister WLAN network interface */
|
||||
|
||||
wlan_uninitialize(0);
|
||||
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
}
|
||||
|
|
@ -1617,6 +1627,117 @@ static int wlan_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
|||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Function: wlan_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the WLAN controller and driver
|
||||
*
|
||||
* Parameters:
|
||||
* intf - In the case where there are multiple EMACs, this value
|
||||
* identifies which EMAC is to be initialized.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int wlan_initialize(int intf)
|
||||
{
|
||||
struct wlan_driver_s *priv;
|
||||
|
||||
/* Get the interface structure associated with this interface number. */
|
||||
|
||||
DEBUGASSERT(intf < CONFIG_WLAN_NINTERFACES);
|
||||
priv = &g_wlan1[intf];
|
||||
|
||||
/* Check if a WLAN chip is recognized at its I/O base */
|
||||
|
||||
/* Attach the IRQ to the driver */
|
||||
|
||||
#if 0 /* @TODO resolve this */
|
||||
if (irq_attach(CONFIG_WLAN_IRQ, wlan_interrupt))
|
||||
{
|
||||
/* We could not attach the ISR to the the interrupt */
|
||||
|
||||
return -EAGAIN;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the driver structure */
|
||||
|
||||
memset(priv, 0, sizeof(struct wlan_driver_s));
|
||||
priv->wl_dev.d_ifup = wlan_ifup; /* I/F down callback */
|
||||
priv->wl_dev.d_ifdown = wlan_ifdown; /* I/F up (new IP address) callback */
|
||||
priv->wl_dev.d_txavail = wlan_txavail; /* New TX data callback */
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
priv->wl_dev.d_addmac = wlan_addmac; /* Add multicast MAC address */
|
||||
priv->wl_dev.d_rmmac = wlan_rmmac; /* Remove multicast MAC address */
|
||||
#endif
|
||||
priv->wl_dev.d_private = (void*)g_wlan1; /* Used to recover private state from dev */
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||
|
||||
priv->wl_txpoll = wd_create(); /* Create periodic poll timer */
|
||||
priv->wl_txtimeout = wd_create(); /* Create TX timeout timer */
|
||||
|
||||
/* Put the interface in the down state. This usually amounts to resetting
|
||||
* the device and/or calling wlan_ifdown().
|
||||
*/
|
||||
|
||||
/* Read the MAC address from the hardware into priv->wl_dev.d_mac.ether_addr_octet */
|
||||
|
||||
/* Register the device with the OS so that socket IOCTLs can be performed */
|
||||
|
||||
(void)netdev_register(&priv->wl_dev);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: wlan_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the WLAN controller and driver
|
||||
*
|
||||
* Parameters:
|
||||
* intf - In the case where there are multiple EMACs, this value
|
||||
* identifies which EMAC is to be initialized.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int wlan_uninitialize(int intf)
|
||||
{
|
||||
struct wlan_driver_s *priv;
|
||||
|
||||
/* Get the interface structure associated with this interface number. */
|
||||
|
||||
DEBUGASSERT(intf < CONFIG_WLAN_NINTERFACES);
|
||||
priv = &g_wlan1[intf];
|
||||
|
||||
/* Check if a WLAN chip is recognized at its I/O base */
|
||||
|
||||
/* Detach the IRQ from the driver */
|
||||
|
||||
// irq_detach(CONFIG_WLAN_IRQ); /* @TODO enable this code */
|
||||
|
||||
/* Unregister the device */
|
||||
|
||||
// (void)netdev_unregister(&priv->wl_dev); /* @TODO implement this */
|
||||
|
||||
/* Uninitialize the driver structure */
|
||||
|
||||
memset(priv, 0, sizeof(struct wlan_driver_s));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NET_WLAN */
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -1651,86 +1772,23 @@ int usbhost_wlaninit(void)
|
|||
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_NET_WLAN)
|
||||
|
||||
/****************************************************************************
|
||||
* Function: wlan_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the WLAN controller and driver
|
||||
*
|
||||
* Parameters:
|
||||
* intf - In the case where there are multiple EMACs, this value
|
||||
* identifies which EMAC is to be initialized.
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int wlan_initialize(int intf)
|
||||
{
|
||||
struct wlan_driver_s *priv;
|
||||
|
||||
/* Get the interface structure associated with this interface number. */
|
||||
|
||||
DEBUGASSERT(inf < CONFIG_WLAN_NINTERFACES);
|
||||
priv = &g_wlan1[intf];
|
||||
|
||||
/* Check if a WLAN chip is recognized at its I/O base */
|
||||
|
||||
/* Attach the IRQ to the driver */
|
||||
|
||||
if (irq_attach(CONFIG_WLAN_IRQ, wlan_interrupt))
|
||||
{
|
||||
/* We could not attach the ISR to the the interrupt */
|
||||
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
/* Initialize the driver structure */
|
||||
|
||||
memset(priv, 0, sizeof(struct wlan_driver_s));
|
||||
priv->wl_dev.d_ifup = wlan_ifup; /* I/F down callback */
|
||||
priv->wl_dev.d_ifdown = wlan_ifdown; /* I/F up (new IP address) callback */
|
||||
priv->wl_dev.d_txavail = wlan_txavail; /* New TX data callback */
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
priv->wl_dev.d_addmac = wlan_addmac; /* Add multicast MAC address */
|
||||
priv->wl_dev.d_rmmac = wlan_rmmac; /* Remove multicast MAC address */
|
||||
#endif
|
||||
priv->wl_dev.d_private = (void*)g_wlan1; /* Used to recover private state from dev */
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||
|
||||
priv->wl_txpoll = wd_create(); /* Create periodic poll timer */
|
||||
priv->wl_txtimeout = wd_create(); /* Create TX timeout timer */
|
||||
|
||||
/* Put the interface in the down state. This usually amounts to resetting
|
||||
* the device and/or calling wlan_ifdown().
|
||||
*/
|
||||
|
||||
/* Read the MAC address from the hardware into priv->wl_dev.d_mac.ether_addr_octet */
|
||||
|
||||
/* Register the device with the OS so that socket IOCTLs can be performed */
|
||||
|
||||
(void)netdev_register(&priv->wl_dev);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_netinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the first network interface. If there are more than one
|
||||
* interface in the device, then device-specific logic will have to provide
|
||||
* this function to determine which, if any, WLAN controllers should
|
||||
* interface in the chip, then board-specific logic will have to provide
|
||||
* this function to determine which, if any, Ethernet controllers should
|
||||
* be initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LPC17_ETHERNET
|
||||
void up_netinitialize(void)
|
||||
{
|
||||
(void)wlan_initialize(0);
|
||||
/* stub */
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NET_WLAN */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue