Updates for usb development. Still not working yet just wanted to get

the current code into CVS.
This commit is contained in:
mark 2001-10-08 17:51:56 +00:00
parent e8292f2819
commit 7302836655
7 changed files with 651 additions and 43 deletions

View File

@ -108,7 +108,7 @@ PCI_OBJ= $(PCI_OBJ_DIR)/prism2sta.o \
USB_OBJ= $(USB_OBJ_DIR)/prism2sta.o \
$(USB_OBJ_DIR)/prism2mgmt.o \
$(USB_OBJ_DIR)/prism2mib.o \
$(USB_OBJ_DIR)/hfa384x.o
$(USB_OBJ_DIR)/hfa384x_usb.o
# List of modules to build
MODULES=

View File

@ -139,6 +139,9 @@
#include <wlan/p80211conv.h>
#include <wlan/p80211msg.h>
#include <wlan/p80211netdev.h>
#include <wlan/p80211req.h>
#include <wlan/p80211metadef.h>
#include <wlan/p80211metastruct.h>
#include <prism2/hfa384x.h>
#include <prism2/prism2mgmt.h>
@ -2657,7 +2660,7 @@ int hfa384x_drvr_initialize(hfa384x_t *hw)
}
/* Now, the info frame fid */
result = hfa384x_cmd_allocate(hw, HFA384x_DRVR_INFOBUF_MAX);
result = hfa384x_cmd_allocate(hw, HFA384x_INFOFRM_MAXLEN);
if (result != 0) {
goto failed;
WLAN_LOG_ERROR0("Allocate(tx) command failed.\n");
@ -3301,8 +3304,6 @@ printk("\n");
break;
case 7:
/* Disable monitor reception for now */
#if 0
if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) {
/* Copy to wlansnif skb */
hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc);
@ -3310,7 +3311,6 @@ printk("\n");
WLAN_LOG_DEBUG0(3,"Received monitor frame: FCSerr set\n"
);
}
#endif
break;
default:
@ -3328,7 +3328,7 @@ printk("\n");
return;
}
#if 0
/*----------------------------------------------------------------
* hfa384x_int_rxmonitor
*
@ -3497,7 +3497,7 @@ void hfa384x_int_rxmonitor( wlandevice_t *wlandev, UINT16 rxfid, hfa384x_rx_fram
DBFEXIT;
return;
}
#endif
/*----------------------------------------------------------------
* hfa384x_int_rx_typedrop

View File

@ -89,6 +89,15 @@
#include <pcmcia/driver_ops.h>
#endif
#if ((WLAN_HOSTIF == WLAN_PLX) || (WLAN_HOSTIF == WLAN_PCI))
#include <linux/ioport.h>
#include <linux/pci.h>
#endif
#if (WLAN_HOSTIF == WLAN_USB)
#include <linux/usb.h>
#endif
/*================================================================*/
/* Project Includes */
@ -529,7 +538,7 @@ int prism2mgmt_associate(wlandevice_t *wlandev, void *msgp)
port_type = 1; /* ess port */
hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, &port_type);
#if (WLAN_HOSTIF != USB)
#if (WLAN_HOSTIF != WLAN_USB)
/* Enable the interrupts */
reg = HFA384x_INTEN_INFDROP_SET(1) |
HFA384x_INTEN_INFO_SET(1) |
@ -711,7 +720,7 @@ int prism2mgmt_reset(wlandevice_t *wlandev, void *msgp)
"setdefaultmib arguments are currently unsupported.\n");
}
#if (WLAN_HOSTIF != USB)
#if (WLAN_HOSTIF != WLAN_USB)
/* disable system interrupts ?? */
/* disable MAC interrupts */
hfa384x_setreg(hw, 0, HFA384x_INTEN);
@ -726,9 +735,12 @@ int prism2mgmt_reset(wlandevice_t *wlandev, void *msgp)
return 0;
}
#if (WLAN_HOSTIF != WLAN_USB)
/* Save a few vars, zero the hw structure and call initmac */
hfa384x_create( hw, hw->irq, hw->iobase, hw->membase);
#else
hfa384x_create( hw, hw->usb, wlandev);
#endif
/* Save a few vars, zero the priv structure and call initmac */
#if (WLAN_HOSTIF==WLAN_PCMCIA)
node = priv->node;
@ -893,7 +905,7 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp)
goto failed;
}
#if (WLAN_HOSTIF != USB)
#if (WLAN_HOSTIF != WLAN_USB)
/* Enable the interrupts */
word = HFA384x_INTEN_INFDROP_SET(1) |
HFA384x_INTEN_INFO_SET(1) |
@ -1104,7 +1116,7 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp)
}
pcf_skip:
#if (WLAN_HOSTIF != USB)
#if (WLAN_HOSTIF != WLAN_USB)
/* Enable the interrupts */
word = HFA384x_INTEN_INFDROP_SET(1) |
HFA384x_INTEN_INFO_SET(1) |
@ -1202,7 +1214,7 @@ int prism2mgmt_enable(wlandevice_t *wlandev, void *msgp)
goto failed;
}
#if (WLAN_HOSTIF != USB)
#if (WLAN_HOSTIF != WLAN_USB)
/* Enable the interrupts */
word = HFA384x_INTEN_INFDROP_SET(1) |
HFA384x_INTEN_INFO_SET(1) |
@ -1397,6 +1409,7 @@ int prism2mgmt_auxport_state(wlandevice_t *wlandev, void *msgp)
----------------------------------------------------------------*/
int prism2mgmt_auxport_read(wlandevice_t *wlandev, void *msgp)
{
#if (WLAN_HOSTIF != WLAN_USB)
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
hfa384x_t *hw = priv->hw;
p80211msg_p2req_auxport_read_t *msg = msgp;
@ -1426,6 +1439,10 @@ int prism2mgmt_auxport_read(wlandevice_t *wlandev, void *msgp)
DBFEXIT;
return 0;
#else
WLAN_LOG_ERROR0("prism2mgmt_auxport_read: Not supported on USB.\n");
return 0;
#endif
}
@ -1451,6 +1468,7 @@ int prism2mgmt_auxport_read(wlandevice_t *wlandev, void *msgp)
----------------------------------------------------------------*/
int prism2mgmt_auxport_write(wlandevice_t *wlandev, void *msgp)
{
#if (WLAN_HOSTIF != WLAN_USB)
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
hfa384x_t *hw = priv->hw;
p80211msg_p2req_auxport_write_t *msg = msgp;
@ -1479,6 +1497,10 @@ int prism2mgmt_auxport_write(wlandevice_t *wlandev, void *msgp)
DBFEXIT;
return 0;
#else
WLAN_LOG_ERROR0("prism2mgmt_auxport_read: Not supported on USB.\n");
return 0;
#endif
}
/*----------------------------------------------------------------
@ -1904,7 +1926,7 @@ int prism2mgmt_dump_state(wlandevice_t *wlandev, void *msgp)
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
msg->resultcode.data = P80211ENUM_resultcode_success;
#if (WLAN_HOSTIF != WLAN_USB)
WLAN_LOG_NOTICE0("prism2 driver and hardware state:\n");
if ( (result = hfa384x_cmd_aux_enable(hw)) ) {
WLAN_LOG_ERROR1("aux_enable failed, result=%d\n", result);
@ -1923,7 +1945,7 @@ int prism2mgmt_dump_state(wlandevice_t *wlandev, void *msgp)
WLAN_LOG_NOTICE3(" drvr: txfid_head=%d txfid_tail=%d txfid_N=%d\n",
hw->txfid_head, hw->txfid_tail, hw->txfid_N);
#endif
#endif /* (WLAN_HOSTIF != WLAN_USB) */
failed:
DBFEXIT;
return 0;
@ -2141,7 +2163,19 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
}
/*** STATION ***/
#if (WLAN_HOSTIF == WLAN_USB)
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.\n");
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
/* usb_dec_dev_use(dev); */
wlandev = NULL;
/* goto failed; */
}
#endif /* (WLAN_HOSTIF == WLAN_USB) */
#if (WLAN_HOSTIF != WLAN_USB)
/* Set the TxRates */
reg = 0x000f;
hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, &reg);
@ -2166,7 +2200,7 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
port_type = 1; /* ess port */
hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, &port_type);
#if (WLAN_HOSTIF != USB)
#if (WLAN_HOSTIF != WLAN_USB)
/* Enable the interrupts */
reg = HFA384x_INTEN_INFDROP_SET(1) |
HFA384x_INTEN_INFO_SET(1) |
@ -2183,6 +2217,7 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
/* Set the resultcode */
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
msg->resultcode.data = P80211ENUM_resultcode_success;
#endif
done:
DBFEXIT;

View File

@ -82,6 +82,15 @@
#include <pcmcia/driver_ops.h>
#endif
#if ((WLAN_HOSTIF == WLAN_PLX) || (WLAN_HOSTIF == WLAN_PCI))
#include <linux/ioport.h>
#include <linux/pci.h>
#endif
#if (WLAN_HOSTIF == WLAN_USB)
#include <linux/usb.h>
#endif
/*================================================================*/
/* Project Includes */

View File

@ -3083,6 +3083,239 @@ static int prism2sta_probe_plx(struct pci_dev *pdev,
#endif /* WLAN_PLX */
#if (WLAN_HOSTIF == WLAN_USB)
/*=======================================================================
* The following code was copied from
* linux-2.2.19/drivers/usb/[hub.h|hub.c|usb.c] due to our need for a
* reset function that won't try to set the interface after setconfiguration().
* Our CTRL0 endpoint goes inactive after the setconfiguration.
* This isn't the cleanest solution to this problem, but it will work for
* now.
* The end of the copied code is marked below.
*/
#define USB_PORT_FEAT_CONNECTION 0
#define USB_PORT_FEAT_ENABLE 1
#define USB_PORT_FEAT_SUSPEND 2
#define USB_PORT_FEAT_OVER_CURRENT 3
#define USB_PORT_FEAT_RESET 4
#define USB_PORT_FEAT_POWER 8
#define USB_PORT_FEAT_LOWSPEED 9
#define USB_PORT_FEAT_C_CONNECTION 16
#define USB_PORT_FEAT_C_ENABLE 17
#define USB_PORT_FEAT_C_SUSPEND 18
#define USB_PORT_FEAT_C_OVER_CURRENT 19
#define USB_PORT_FEAT_C_RESET 20
#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
static void prism2sta_usb_set_maxpacket(struct usb_device *dev)
{
int i, b;
for (i=0; i<dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *ifp = dev->actconfig->interface + i;
struct usb_interface_descriptor *as = ifp->altsetting + ifp->act_altsetting;
struct usb_endpoint_descriptor *ep = as->endpoint;
int e;
for (e=0; e<as->bNumEndpoints; e++) {
b = ep[e].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
if ((ep[e].bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_CONTROL) { /* Control => bidirectional */
dev->epmaxpacketout[b] = ep[e].wMaxPacketSize;
dev->epmaxpacketin [b] = ep[e].wMaxPacketSize;
}
else if (usb_endpoint_out(ep[e].bEndpointAddress)) {
if (ep[e].wMaxPacketSize > dev->epmaxpacketout[b])
dev->epmaxpacketout[b] = ep[e].wMaxPacketSize;
}
else {
if (ep[e].wMaxPacketSize > dev->epmaxpacketin [b])
dev->epmaxpacketin [b] = ep[e].wMaxPacketSize;
}
}
}
}
static void prism2sta_usb_destroy_configuration(struct usb_device *dev)
{
int c, i, j, k;
if (!dev->config)
return;
if (dev->rawdescriptors) {
for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
kfree(dev->rawdescriptors[i]);
kfree(dev->rawdescriptors);
}
for (c = 0; c < dev->descriptor.bNumConfigurations; c++) {
struct usb_config_descriptor *cf = &dev->config[c];
if (!cf->interface)
break;
for (i = 0; i < cf->bNumInterfaces; i++) {
struct usb_interface *ifp =
&cf->interface[i];
if (!ifp->altsetting)
break;
for (j = 0; j < ifp->num_altsetting; j++) {
struct usb_interface_descriptor *as =
&ifp->altsetting[j];
if(as->extra) {
kfree(as->extra);
}
if (!as->endpoint)
break;
for(k = 0; k < as->bNumEndpoints; k++) {
if(as->endpoint[k].extra) {
kfree(as->endpoint[k].extra);
}
}
kfree(as->endpoint);
}
kfree(ifp->altsetting);
}
kfree(cf->interface);
}
kfree(dev->config);
}
static int prism2sta_usb_clear_port_feature(struct usb_device *dev, int port, int feature)
{
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ);
}
static int prism2sta_usb_set_port_feature(struct usb_device *dev, int port, int feature)
{
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port, NULL, 0, HZ);
}
static int prism2sta_usb_reset_device(struct usb_device *dev)
{
struct usb_device *parent = dev->parent;
struct usb_device_descriptor descriptor;
int i, ret, port = -1;
for (i = 0; i < parent->maxchild; i++) {
if (parent->children[i] == dev) {
port = i;
break;
}
}
if (port < 0)
return -ENOENT;
/* Send a reset to the device */
prism2sta_usb_set_port_feature(parent, port + 1, USB_PORT_FEAT_RESET);
wait_ms(700);
prism2sta_usb_clear_port_feature(parent, port + 1, USB_PORT_FEAT_C_RESET);
/* Reprogram the Address */
ret = usb_set_address(dev);
if (ret < 0) {
WLAN_LOG_ERROR1("USB device not accepting new address (error=%d)", ret);
clear_bit(dev->devnum, &dev->bus->devmap.devicemap);
dev->devnum = -1;
return ret;
}
wait_ms(200); /* Let the SET_ADDRESS settle */
ret = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &descriptor,
sizeof(descriptor));
if (ret < 0)
return ret;
le16_to_cpus(&descriptor.bcdUSB);
le16_to_cpus(&descriptor.idVendor);
le16_to_cpus(&descriptor.idProduct);
le16_to_cpus(&descriptor.bcdDevice);
if (memcmp(&dev->descriptor, &descriptor, sizeof(descriptor))) {
WLAN_LOG_DEBUG0(3,"Rereading config.\n");
prism2sta_usb_destroy_configuration(dev);
ret = usb_get_device_descriptor(dev);
if (ret < sizeof(dev->descriptor)) {
if (ret < 0) {
WLAN_LOG_ERROR1(
"unable to get device descriptor "
"(error=%d)", ret);
} else {
WLAN_LOG_ERROR2(
"USB device descriptor short read "
"(expected %i, got %i)",
sizeof(dev->descriptor), ret);
}
clear_bit(dev->devnum, &dev->bus->devmap.devicemap);
dev->devnum = -1;
return -EIO;
}
ret = usb_get_configuration(dev);
if (ret < 0) {
WLAN_LOG_ERROR1("unable to get configuration (error=%d)", ret);
prism2sta_usb_destroy_configuration(dev);
clear_bit(dev->devnum, &dev->bus->devmap.devicemap);
dev->devnum = -1;
return 1;
}
dev->actconfig = dev->config;
prism2sta_usb_set_maxpacket(dev);
return 1;
} else {
WLAN_LOG_DEBUG0(3,"Using old config.\n");
#if 0
ret = usb_set_configuration(dev,
dev->actconfig->bConfigurationValue);
if (ret < 0) {
WLAN_LOG_ERROR1(
"failed to set active configuration (error=%d)",
ret);
return ret;
}
for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
struct usb_interface *intf =
&dev->actconfig->interface[i];
struct usb_interface_descriptor *as =
&intf->altsetting[intf->act_altsetting];
ret = usb_set_interface(dev, as->bInterfaceNumber,
as->bAlternateSetting);
if (ret < 0) {
WLAN_LOG_ERROR2(
"failed to set active alternate "
"setting for interface %d (error=%d)",
i, ret);
return ret;
}
}
#endif
return 0;
}
return 0;
}
/*=======================================================================
* End of copied USB code.
*/
/*----------------------------------------------------------------
* prism2sta_probe_usb
*
@ -3109,8 +3342,17 @@ prism2sta_probe_usb(struct usb_device *dev, unsigned int ifnum)
{
int i;
wlandevice_t *wlandev = NULL;
hfa384x_t *hw;
prism2sta_priv_t *priv;
int result;
DBFENTER;
WLAN_LOG_DEBUG1(3,"We're offered ifnum=%d\n", ifnum);
if (dev->actconfig) {
WLAN_LOG_DEBUG1(3,"actconfig->bConfigurationValue=%d\n",
dev->actconfig->bConfigurationValue);
}
/* Check to see if we should claim this device */
for ( i = 0; usb_id_tbl[i].name != NULL; i++) {
if (
@ -3119,24 +3361,122 @@ prism2sta_probe_usb(struct usb_device *dev, unsigned int ifnum)
break;
}
if ( usb_id_tbl[i].name == NULL ) return NULL;
/* Ok, we're going to claim the device. */
WLAN_LOG_INFO1("prism2_usb: Claiming device %s\n", usb_id_tbl[i].name);
/* First, set the configuration. */
/* First, reset the device */
WLAN_LOG_DEBUG0(3, "Resetting Device.\n");
if ((result = prism2sta_usb_reset_device(dev))) {
WLAN_LOG_ERROR1("usb_reset_device() failed, result=%d.\n",
result);
wlandev = NULL;
goto failed;
}
#ifdef DEBUG
/* Print out the max packet sizes */
for ( i=0;i<16;i++) {
WLAN_LOG_DEBUG2(3,"dev->epmaxpacketout[%d]=%d\n",
i, dev->epmaxpacketout[i]);
WLAN_LOG_DEBUG2(3,"dev->epmaxpacketin[%d]=%d\n",
i, dev->epmaxpacketin[i]);
}
#endif
/* If we don't do a reset, it would appear that the configuration
* has already been set.
* the wierd thing is that the CTL endpoint won't accept anything
* else, but set_configuration returns without error.
*/
/* Set the configuration. */
WLAN_LOG_DEBUG1(3, "Setting Configuration %d\n",
dev->config[0].bConfigurationValue);
if (usb_set_configuration(dev, dev->config[0].bConfigurationValue)) {
WLAN_LOG_ERROR0("usb_set_configuration() failed.\n");
wlandev = NULL;
goto failed;
}
#if 0
/* DEBUG end of function!!! */
DBFEXIT;
return NULL;
#endif
/* Allocate the wlandev */
wlandev = kmalloc(sizeof(wlandevice_t), GFP_KERNEL);
if (wlandev == NULL ) {
WLAN_LOG_ERROR0("Failed to allocate wlandev.\n");
wlandev = NULL;
goto failed;
}
}
memset(wlandev, 0, sizeof(wlandevice_t));
/* Make up a device private data structure. */
wlandev->priv = kmalloc(sizeof(prism2sta_priv_t), GFP_KERNEL);
if ( wlandev->priv == NULL ) {
kfree_s(wlandev, sizeof(wlandevice_t));
wlandev = NULL;
goto failed;
}
memset(wlandev->priv, 0, sizeof(prism2sta_priv_t));
/* Make up a hw data structure. */
priv = (prism2sta_priv_t*)wlandev->priv;
hw = priv->hw = kmalloc(sizeof(hfa384x_t), GFP_KERNEL);
if ( priv->hw == NULL ) {
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
wlandev= NULL;
goto failed;
}
memset(priv->hw, 0, sizeof(hfa384x_t));
/* Set our entries in the wlandev */
wlandev->open = &prism2sta_open;
wlandev->close = &prism2sta_close;
wlandev->reset = &prism2sta_reset;
wlandev->txframe = &prism2sta_txframe;
wlandev->mlmerequest = &prism2sta_mlmerequest;
/* Set up the remaining entries in the wlan common way */
wlandev->name = ((prism2sta_priv_t*)wlandev->priv)->name;
if ( wlan_setup(wlandev) != 0 ) {
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
WLAN_LOG_ERROR0("wlan_setup() failed!\n");
wlandev = NULL;
goto failed;
}
if ( register_wlandev(wlandev) != 0 ) {
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
WLAN_LOG_ERROR0("register_wlandev() failed!\n");
wlandev = NULL;
goto failed;
}
hfa384x_create(hw, dev, wlandev);
usb_inc_dev_use(dev);
#if 0
if ( prism2sta_initmac(wlandev) != 0) {
WLAN_LOG_ERROR0("MAC Initialization failed.\n");
kfree_s(priv->hw, sizeof(hfa384x_t));
kfree_s(wlandev->priv, sizeof(prism2sta_priv_t));
kfree_s(wlandev, sizeof(wlandevice_t));
usb_dec_dev_use(dev);
wlandev = NULL;
goto failed;
}
#endif
failed:
DBFEXIT;
return wlandev;
@ -3169,10 +3509,14 @@ failed:
static void
prism2sta_disconnect_usb(struct usb_device *dev, void *ptr)
{
wlandevice_t *wlandev = (wlandevice_t*)ptr;
wlandevice_t *wlandev = (wlandevice_t*)ptr;
prism2sta_priv_t *priv = wlandev->priv;
hfa384x_t *hw = priv->hw;
DBFENTER;
kfree(wlandev);
unregister_wlandev(wlandev);
/* kfree(wlandev); */
usb_dec_dev_use(hw->usb);
DBFEXIT;
return;
}

View File

@ -68,16 +68,20 @@
#define HFA384x_PDR_LEN_MAX ((UINT16)260) /* in bytes, from EK */
#define HFA384x_PDA_RECS_MAX ((UINT16)200) /* a guess */
#define HFA384x_PDA_LEN_MAX ((UINT16)1024) /* in bytes, from EK */
#define HFA384x_SCANRESULT_MAX ((UINT16)35)
#define HFA384x_SCANRESULT_MAX ((UINT16)31)
#define HFA384x_HSCANRESULT_MAX ((UINT16)31)
#define HFA384x_CHINFORESULT_MAX ((UINT16)16)
#define HFA384x_DRVR_FIDSTACKLEN_MAX (10)
#define HFA384x_DRVR_INFOBUF_MAX (sizeof(hfa384x_HandoverAddr_t))
#define HFA384x_DRVR_TXBUF_MAX (sizeof(hfa384x_tx_frame_t) + \
WLAN_DATA_MAXLEN - \
WLAN_WEP_IV_LEN - \
WLAN_WEP_ICV_LEN + 2)
#define HFA384x_DRVR_MAGIC (0x4a2d)
#define HFA384x_DRVR_INFOFRM_LEN_MAX sizeof(hfa384x_ScanResults_t)
#define HFA384x_INFODATA_MAXLEN (sizeof(hfa384x_infodata_t))
#define HFA384x_INFOFRM_MAXLEN (sizeof(hfa384x_InfFrame_t))
#define HFA384x_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */
#define HFA384x_RIDDATA_MAXLEN HFA384x_RID_GUESSING_MAXLEN
#define HFA384x_USB_RWMEM_MAXLEN 2048
/*--- Support Constants -----------------------------*/
#define HFA384x_BAP_PROC ((UINT16)0)
@ -1656,6 +1660,29 @@ typedef struct hfa384x_ChInfoResult
result[HFA384x_CHINFORESULT_MAX] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_ChInfoResult_t;
/*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
typedef struct hfa384x_HScanResultSub
{
UINT16 chid __WLAN_ATTRIB_PACK__;
UINT16 anl __WLAN_ATTRIB_PACK__;
UINT16 sl __WLAN_ATTRIB_PACK__;
UINT8 bssid[WLAN_BSSID_LEN] __WLAN_ATTRIB_PACK__;
UINT16 bcnint __WLAN_ATTRIB_PACK__;
UINT16 capinfo __WLAN_ATTRIB_PACK__;
hfa384x_bytestr32_t ssid __WLAN_ATTRIB_PACK__;
UINT8 supprates[10] __WLAN_ATTRIB_PACK__; /* 802.11 info element */
UINT16 proberesp_rate __WLAN_ATTRIB_PACK__;
UINT16 atim __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_HScanResultSub_t;
typedef struct hfa384x_HScanResult
{
UINT16 nresult __WLAN_ATTRIB_PACK__;
UINT16 rsvd __WLAN_ATTRIB_PACK__;
hfa384x_HScanResultSub_t
result[HFA384x_HSCANRESULT_MAX] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_HScanResult_t;
/*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/
#define HFA384x_LINK_NOTCONNECTED ((UINT16)0)
@ -1706,22 +1733,185 @@ typedef struct hfa384x_PSUserCount
} __WLAN_ATTRIB_PACK__ hfa384x_PSUserCount_t;
/*-- Collection of all Inf frames ---------------*/
typedef struct hfa384x_InfFrame
{
UINT16 framelen __WLAN_ATTRIB_PACK__;
UINT16 infotype __WLAN_ATTRIB_PACK__;
union {
typedef union hfa384x_infodata {
hfa384x_CommTallies16_t commtallies16 __WLAN_ATTRIB_PACK__;
hfa384x_CommTallies32_t commtallies32 __WLAN_ATTRIB_PACK__;
hfa384x_ScanResult_t scanresult __WLAN_ATTRIB_PACK__;
hfa384x_ChInfoResult_t chinforesult __WLAN_ATTRIB_PACK__;
hfa384x_HScanResult_t hscanresult __WLAN_ATTRIB_PACK__;
hfa384x_LinkStatus_t linkstatus __WLAN_ATTRIB_PACK__;
hfa384x_AssocStatus_t assocstatus __WLAN_ATTRIB_PACK__;
hfa384x_AuthReq_t authreq __WLAN_ATTRIB_PACK__;
hfa384x_PSUserCount_t psusercnt __WLAN_ATTRIB_PACK__;
} info __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_infodata_t;
typedef struct hfa384x_InfFrame
{
UINT16 framelen __WLAN_ATTRIB_PACK__;
UINT16 infotype __WLAN_ATTRIB_PACK__;
hfa384x_infodata_t info __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_InfFrame_t;
#if (WLAN_HOSTIF == WLAN_USB)
/*--------------------------------------------------------------------
USB Packet structures and constants.
--------------------------------------------------------------------*/
/* Should be sent to the ctrlout endpoint */
#define HFA384x_USB_ENBULKIN 6
/* Should be sent to the bulkout endpoint */
#define HFA384x_USB_TXFRM 0
#define HFA384x_USB_CMDREQ 1
#define HFA384x_USB_WRIDREQ 2
#define HFA384x_USB_RRIDREQ 3
#define HFA384x_USB_WMEMREQ 4
#define HFA384x_USB_RMEMREQ 5
/* Received from the bulkin endpoint */
#define HFA384x_USB_ISFRM(a) ((a) < 0x7fff)
#define HFA384x_USB_ISTXFRM(a) (HFA384x_USB_ISFRM((a)) && ((a) & 0x1000))
#define HFA384x_USB_ISRXFRM(a) (HFA384x_USB_ISFRM((a)) && !((a) & 0x1000))
#define HFA384x_USB_INFOFRM 0x8000
#define HFA384x_USB_CMDRESP 0x8001
#define HFA384x_USB_WRIDRESP 0x8002
#define HFA384x_USB_RRIDRESP 0x8003
#define HFA384x_USB_WMEMRESP 0x8004
#define HFA384x_USB_RMEMRESP 0x8005
#define HFA384x_USB_BUFAVAIL 0x8006
#define HFA384x_USB_ERROR 0x8007
/*------------------------------------*/
/* Request (bulk OUT) packet contents */
typedef struct hfa384x_usb_txfrm {
hfa384x_tx_frame_t desc __WLAN_ATTRIB_PACK__;
UINT8 data[WLAN_DATA_MAXLEN] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_txfrm_t;
typedef struct hfa384x_usb_cmdreq {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 cmd __WLAN_ATTRIB_PACK__;
UINT16 parm0 __WLAN_ATTRIB_PACK__;
UINT16 parm1 __WLAN_ATTRIB_PACK__;
UINT16 parm2 __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdreq_t;
typedef struct hfa384x_usb_wridreq {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 rid __WLAN_ATTRIB_PACK__;
UINT8 data[HFA384x_RIDDATA_MAXLEN] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_wridreq_t;
typedef struct hfa384x_usb_rridreq {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 rid __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rridreq_t;
typedef struct hfa384x_usb_wmemreq {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 offset __WLAN_ATTRIB_PACK__;
UINT16 page __WLAN_ATTRIB_PACK__;
UINT8 data[HFA384x_USB_RWMEM_MAXLEN] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_wmemreq_t;
typedef struct hfa384x_usb_rmemreq {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 offset __WLAN_ATTRIB_PACK__;
UINT16 page __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemreq_t;
/*------------------------------------*/
/* Response (bulk IN) packet contents */
typedef struct hfa384x_usb_rxfrm {
hfa384x_rx_frame_t desc __WLAN_ATTRIB_PACK__;
UINT8 data[WLAN_DATA_MAXLEN] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rxfrm_t;
typedef struct hfa384x_usb_infofrm {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 inftype __WLAN_ATTRIB_PACK__;
UINT8 data[HFA384x_INFODATA_MAXLEN] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_infofrm_t;
typedef struct hfa384x_usb_cmdresp {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 status __WLAN_ATTRIB_PACK__;
UINT16 resp0 __WLAN_ATTRIB_PACK__;
UINT16 resp1 __WLAN_ATTRIB_PACK__;
UINT16 resp2 __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdresp_t;
typedef struct hfa384x_usb_wridresp {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 status __WLAN_ATTRIB_PACK__;
UINT16 resp0 __WLAN_ATTRIB_PACK__;
UINT16 resp1 __WLAN_ATTRIB_PACK__;
UINT16 resp2 __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_wridresp_t;
typedef struct hfa384x_usb_rridresp {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT16 rid __WLAN_ATTRIB_PACK__;
UINT8 data[HFA384x_RIDDATA_MAXLEN] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rridresp_t;
typedef struct hfa384x_usb_wmemresp {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 status __WLAN_ATTRIB_PACK__;
UINT16 resp0 __WLAN_ATTRIB_PACK__;
UINT16 resp1 __WLAN_ATTRIB_PACK__;
UINT16 resp2 __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_wmemresp_t;
typedef struct hfa384x_usb_rmemresp {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
UINT8 data[HFA384x_USB_RWMEM_MAXLEN] __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemresp_t;
typedef struct hfa384x_usb_bufavail {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 frmlen __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_bufavail_t;
typedef struct hfa384x_usb_error {
UINT16 type __WLAN_ATTRIB_PACK__;
UINT16 errortype __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usb_error_t;
/*----------------------------------------------------------*/
/* Unions for packaging all the known packet types together */
typedef union hfa384x_usbout {
UINT16 type __WLAN_ATTRIB_PACK__;
hfa384x_usb_txfrm_t txfrm __WLAN_ATTRIB_PACK__;
hfa384x_usb_cmdreq_t cmdreq __WLAN_ATTRIB_PACK__;
hfa384x_usb_wridreq_t wridreq __WLAN_ATTRIB_PACK__;
hfa384x_usb_rridreq_t rridreq __WLAN_ATTRIB_PACK__;
hfa384x_usb_wmemreq_t wmemreq __WLAN_ATTRIB_PACK__;
hfa384x_usb_rmemreq_t rmemreq __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usbout_t;
typedef union hfa384x_usbin {
UINT16 type __WLAN_ATTRIB_PACK__;
hfa384x_usb_rxfrm_t rxfrm __WLAN_ATTRIB_PACK__;
hfa384x_usb_infofrm_t infofrm __WLAN_ATTRIB_PACK__;
hfa384x_usb_cmdresp_t cmdresp __WLAN_ATTRIB_PACK__;
hfa384x_usb_wridresp_t wridresp __WLAN_ATTRIB_PACK__;
hfa384x_usb_rridresp_t rridresp __WLAN_ATTRIB_PACK__;
hfa384x_usb_wmemresp_t wmemresp __WLAN_ATTRIB_PACK__;
hfa384x_usb_rmemresp_t rmemresp __WLAN_ATTRIB_PACK__;
hfa384x_usb_bufavail_t bufavail __WLAN_ATTRIB_PACK__;
hfa384x_usb_error_t usberror __WLAN_ATTRIB_PACK__;
} __WLAN_ATTRIB_PACK__ hfa384x_usbin_t;
#endif /* WLAN_USB */
/*--------------------------------------------------------------------
PD record structures.
@ -1963,23 +2153,43 @@ typedef struct hfa384x_pdrec
/*--------------------------------------------------------------------
--- MAC state structure, argument to all functions --
--------------------------------------------------------------------*/
typedef struct hfa384x
{
#if (WLAN_HOSTIF != WLAN_USB)
/* Resource config */
UINT32 iobase; /* base address */
UINT32 membase; /* base address */
UINT32 irq; /* irq number */
UINT32 iobase;
UINT32 membase;
UINT32 irq;
#else
struct usb_device *usb;
void *usbcontext; /* actually a wlandev */
struct urb tx_urb;
struct urb rx_urb;
struct urb int_urb;
hfa384x_usbin_t usbin;
hfa384x_usbout_t usbout;
UINT16 usbint[4];
#define HFA384x_USBFLAG_RXURB_BUSY 0x01
#define HFA384x_USBFLAG_TXURB_BUSY 0x02
#define HFA384x_USBFLAG_CMDPENDING 0x04
#define HFA384x_USBFLAG_CMDPENDINGRX 0x08
UINT usbflags;
wait_queue_head_t cmdq;
#endif /* !USB */
/* Controller state */
UINT32 state;
UINT auxen; /* Aux port enabled? */
UINT32 isap;
UINT8 port_enabled[HFA384x_NUMPORTS_MAX];
UINT32 bap; /* BAP context. Defines which bap */
/* should be used by functions that */
/* may be called in int or non-int */
/* context, should be set and cleared */
/* in int handler */
#if (WLAN_HOSTIF != WLAN_USB)
UINT auxen;
UINT32 bap;
#endif /* !USB */
/* Download support */
UINT dlstate;
@ -1994,6 +2204,7 @@ typedef struct hfa384x
UINT16 resp1; /* in host order */
UINT16 resp2; /* in host order */
#if (WLAN_HOSTIF != WLAN_USB)
/* BAP support */
spinlock_t baplock[2];
@ -2007,16 +2218,21 @@ typedef struct hfa384x
UINT16 txfid_tail;
UINT txfid_N;
UINT16 txfid_queue[HFA384x_DRVR_FIDSTACKLEN_MAX];
#endif
#endif /* USE_FID_STACK */
UINT16 infofid;
#endif /* !USB */
} hfa384x_t;
/*=============================================================*/
/*--- Function Declarations -----------------------------------*/
/*=============================================================*/
#if (WLAN_HOSTIF == WLAN_USB)
void hfa384x_create( hfa384x_t *hw, struct usb_device *usb, void *usbcontext);
#else
void hfa384x_create( hfa384x_t *hw, UINT irq, UINT32 iobase, UINT32 membase);
#endif
void hfa384x_interrupt(int irq, void *dev_id, struct pt_regs *regs);
int hfa384x_corereset( hfa384x_t *hw);
int hfa384x_cmd_initialize(hfa384x_t *hw);
int hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport);
@ -2074,12 +2290,14 @@ int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, U
int hfa384x_dl_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, UINT16 parm2);
static inline int hfa384x_isgood_pdrcode(UINT16 pdrcode);
#if (WLAN_HOSTIF != WLAN_USB)
static inline UINT16 hfa384x_getreg(hfa384x_t *hw, UINT reg);
static inline void hfa384x_setreg(hfa384x_t *hw, UINT16 val, UINT reg);
static inline UINT16 hfa384x_getreg_noswap(hfa384x_t *hw, UINT reg);
static inline void hfa384x_setreg_noswap(hfa384x_t *hw, UINT16 val, UINT reg);
#endif /* (WLAN_HOSTIF != WLAN_USB) */
int hfa384x_corereset( hfa384x_t *hw);
#endif /* __KERNEL__ */
@ -2139,6 +2357,7 @@ static inline int hfa384x_isgood_pdrcode(UINT16 pdrcode)
return 0; /* avoid compiler warnings */
}
#if (WLAN_HOSTIF != WLAN_USB)
#ifdef __KERNEL__
/*----------------------------------------------------------------
* hfa384x_getreg
@ -2240,5 +2459,6 @@ static inline void hfa384x_setreg_noswap(hfa384x_t *hw, UINT16 val, UINT reg)
}
#endif /* __KERNEL__ */
#endif /* WLAN_HOSTIF != WLAN_USB */
#endif /* _HFA384x_H */

View File

@ -115,7 +115,7 @@ typedef struct prism2sta_priv
{
#if (WLAN_HOSTIF == WLAN_PCMCIA)
dev_node_t node;
#elif (WLAN_HOSTIF==WLAN_PLX || WLAN_HOSTIF==WLAN_PCI)
#elif (WLAN_HOSTIF==WLAN_PLX || WLAN_HOSTIF==WLAN_PCI || WLAN_HOSTIF==WLAN_USB)
char name[WLAN_DEVNAMELEN_MAX];
#endif