📄 intprismhw.c
字号:
/* intPrismHw.c - utility functions for WLAN driver *//* Copyright 2001-2003 Wind River Systems, Inc. *//*modification history--------------------03k,18jul03,rb Added ARMARCH4 back to #ifdef for ARM integrator stability enhancements03j,09jul03,rb Implemented moderated Rx buffer chaining03i,12jun03,rb Made stability improvements for wrSbcPxa25003h,09may03,rb Removed warnings caused by IPv6 integration03g,26feb03,ss Fixed diab compiler warnings03f,23jul02,rb Fixed endian bug in intPrismDisassocSend() - SPR 7999803e,23may02,ss removed intMask manipulation in intPrismCommandAsync03d,21may02,ss Add COMMAND events to intMask when using intPrismCommandAsync03c,13may02,dxb Removed static values for taskDelay().03b,06may02,rb More comment changes03a,06may02,ss no longer set antenna diversity rid for Symbol card02z,03may02,rb Fixed bug in IBSS initialization02y,24apr02,rb Modified intPrismBSSJoin() to send a disassociation packet to old SSID02x,24apr02,rb Check for NULL pointer in intPrismCommand()02w,23apr02,ss change intPrismSymMacAddrGet from import to an equivalent func. ptr02v,10apr02,rb Updated comments, fixed intLocks in BAPWrite02u,08apr02,ss Update to use WLAN_BASE_ADDR macro02t,08apr02,rb In command routines, must get status before acknowledging command02s,05apr02,rb Removed debugging code02r,05apr02,rb Added missing intLocks in intPrismEtherWrite(), removed spurious iSR call in command routines02q,04apr02,dxb Added Prism 3 support.02p,01apr02,rb Improved stability of intPrismReset() routine02o,01apr02,rb Modified intPrismCommand to use intPrismCommandAsync if card is up - this should enahance stability by reducing intLock()02n,28mar02,rb Comment revisions and placed intLock() around BAP transfers02m,22mar02,rb Fixed bug joining BSS in AP mode (should just set OWNSSID02l,18mar02,ss Modified to distinguish between Prism 2 and 2.5 card types02k,07mar02,rb Improved stability of TX data path, removed bap1 sem 02j,15feb02,rb Use new firmware table in intPrismHw.h02i,14feb02,dxb Updated for component ID table in intPrismHw.h.02h,14feb02,ss return ERROR if timeout in intPrismCommand02g,07feb02,rb Fixed WEP and IBSS enabling02f,06feb02,dxb More changes for wlanEnd.h.02e,05feb02,dxb Updated to include changes to wlanEnd.h.02d,15jan02,rb Speed enhancements in WriteData, etc. readData now uses BAP1 since ISR is hardcoded for BAP 0 02c,08jan02,ss Reconfigured levels for debug messages in intPrismCommand02b,21dec01,rb Fix for SPR 71834 - 3Com association problems02b,20dec01,ss Added support for Symbol card02a,20dec01,rb Modified intPrismReadData() so that OFFSET register does not check ERR until BUSY clear, as per PDPv2.1001z,11dec01,ss Added routines for interfacing with Aux port01y,10dec01,rb Removed redundant code in intPrismWriteData(), made intPrismBAP1Open() check both BUSY and ERR bits01x,14nov01,rb Added support for WLAN_DEFAULT_IBSS_MODE in intPrismInit01w,14nov01,rb Fix for SPR 71666 - MIPs SSID and BSSID on BSS scan01v,12nov01,rb Fixed bug booting 3com w/ security01u,09nov01,rb Removed IBSS_AUTO_START from 3COM01t,08nov01,rb Fixed endianness bug in intPrismStringRead (again)01s,05nov01,rb Changed APIs to reflect name change wlan->intPrism01r,02nov01,dxb Updated with new file name.01q,25oct01,rb Modified wlanBSSJoin to eliminate scans for Intersil cards.01p,17oct01,rb Fixed big endian bug in wlanRIDStringRead01o,16oct01,rb Changed IOCTL call in wlanInit to use new IOCTL names01n,01oct01,rb Changed default security settings to account for dynamic key sizing01m,19sep01,rb Added support for big-endian architectures - MIPs01l,16sep01,rb Added utility to check firmware versions01k,05sep01,rb Documentation Update01j,29aug01,rb Created polled and asynchronous versions of wlanCommand01i,21aug01,rb Added card presence check; removed warnings01h,20aug01,rb Removed reference to config.h01g,16aug01,rb Added complete path to wlanEnd.h01f,15aug01,rb Changed reference to wlanEnd.h; Added support for 3com01e,19jul01,rb Added IBSS support for Intersil cards01d,12jul01,rb Changes from Code Review01c,20jun01,rb Implemented card differentiation01b,11jun01,rb Removed semaphores on BAP001a,29may01,rb Created*//*DESCRIPTIONThis file contains support routines for the WLAN driver by Wind River Networks.CARD ACCESSData (both configuration records and packets) is mantained on the card inbuffers. When you want to access some of this data (reading a received packet,sending a packet, writing a config record) you have to use a Buffer Access Path (BAP). Each BAP (there are two on the card) consists of a <select>register, an <offset> register, and a <data> register. To point the BAP at a structure on the card (usually a Frame ID (FID) for packets or a Record ID (RID) for configuration structures) the FID or RID is written to the <select>register. The offset from the start of the structure (in 8-bit BYTES) iswritten to the <offset> register, and then data may be transferred 16 bits ata time to/from the <data> register for that BAP.SEE ALSOintPrismEnd.c*/#include <vxWorks.h>#include <string.h>#include <ioLib.h>#include <stdio.h>#include <logLib.h>#include <taskLib.h>#include <sysLib.h>#include <intLib.h>#include "wrn/wlan/wlanEnd.h"#include "wrn/wlan/intPrismHw.h"#ifdef WLNDBG#undef LOCAL#define LOCAL#endif/* Given a particular component ID, this table determines the specific * manufacturer and earliest firmware version supported. The component * variant value is not used at this time. Not all component ID's have * been tested. USB variants are listed for completeness but are not * supported at this time. */ LOCAL SUPPORTED_CARDS supportedCards[] = { {0x0001, 0x0001, WLAN_CARDTYPE_WAVELAN, 7, 52, 1, "Intersil Prism PCMCIA - WaveLAN"}, {0x8000, 0x0001, WLAN_CARDTYPE_3COM, 2, 1, 2, "Intersil Prism PCMCIA/CF - 3Com/Symbol"}, {0x8001, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA"}, {0x8002, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA - LinkSys/SMC"}, {0x8003, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA"}, {0x8004, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA"}, {0x8005, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA"}, {0x8006, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA"}, {0x8007, 0x0000, WLAN_CARDTYPE_3COM, 2, 1, 2, "Intersil Prism PCMCIA - 3Com"}, {0x8008, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA"}, {0x8009, 0x0000, WLAN_CARDTYPE_INTERSIL_2, 0, 8, 3, "Intersil Prism2 PCMCIA"}, {0x800A, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCMCIA"}, {0x800B, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCMCIA"}, {0x800C, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCMCIA"}, {0x800D, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCMCIA"}, {0x800E, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCMCIA"}, {0x800F, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 USB"}, {0x8010, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 USB"}, {0x8011, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 USB"}, {0x8012, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 miniPCI"}, {0x8013, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 miniPCI"}, {0x8014, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 miniPCI"}, {0x8015, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 miniPCI"}, {0x8016, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCI"}, {0x8017, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCI"}, {0x8018, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCI"}, {0x8019, 0x0000, WLAN_CARDTYPE_INTERSIL_2_5, 1, 0, 3, "Intersil Prism2.5 PCI"}, {0x801A, 0x0000, WLAN_CARDTYPE_INTERSIL_3, 1, 3, 5, "Intersil Prism3 PCMCIA"}, {0x801B, 0x0000, WLAN_CARDTYPE_INTERSIL_3, 1, 3, 5, "Intersil Prism3 PCMCIA"}, {0x801C, 0x0000, WLAN_CARDTYPE_INTERSIL_3, 1, 3, 5, "Intersil Prism3 PCMCIA"}, {0x801D, 0x0000, WLAN_CARDTYPE_INTERSIL_3, 1, 3, 5, "Intersil Prism3 PCMCIA"}, {0x801E, 0x0000, WLAN_CARDTYPE_INTERSIL_3, 1, 3, 5, "Intersil Prism3 USB"}, {0x801F, 0x0000, WLAN_CARDTYPE_INTERSIL_3, 1, 3, 5, "Intersil Prism3 USB"}, {0x8020, 0x0000, WLAN_CARDTYPE_INTERSIL_3, 1, 3, 5, "Intersil Prism3 USB"} };#define CARDS_TABLE_LENGTH NELEMENTS (supportedCards)/* Used in the diagnostics routine - this is the bit pattern sent to the NIC.The two patterns must be 1's complement. */#define DIAG_PAT_0 ((UINT16)0xaaaa)#define DIAG_PAT_1 ((UINT16)0x5555)/* function ptr's to Symbol CF card init routines, these will be set at the BSP level if Symbol CF support was included */STATUS (* pIntPrismSymDownload) (WLAN_DEV *) = NULL;UINT16 * (* pIntPrismSymMacAddrGet) (void) = NULL;IMPORT STATUS sysWlanCfgParamGet (UINT32 cmd, INT32 data);LOCAL STATUS intPrismDisassocSend (WLAN_DEV * pWlanDev,UINT8 * bssid );LOCAL STATUS intPrismKickstart(WLAN_DEV * pWlanDev);/****************************************************************************** NOMANUAL* intPrismInit - Initializes the NIC into a known state. ** Initializes the card, and then runs diagnostics. If the card fails * diagnostics, error is returned.* * RETURNS : OK or ERROR if unable to correctly reset the card ** ERRNO : N/A** SEE ALSO:* PRISM Driver Programmer's Manual*/STATUS intPrismInit ( WLAN_DEV *pWlanDev /* Pointer to the device handle for this card */ ) { LTV_RECORD ltvRecord; int i, j; UINT16 wepAvail; int status; BOOL symbolCFCard = FALSE; /* indicates if the card is a Symbol CF Card */ INT16 wepEnable; INT16 wepType; UINT8 wepKey [WLAN_WEP_MAX_KEYSIZE]; INT16 wepKeyNumber; INT16 opMode; INT16 brateEnable; INT16 brates; INT16 txRate; INT16 channel; INT16 authType; INT16 pwrMan; if (pWlanDev == NULL) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismInit: NULL pWlanDev\n")); return ERROR; } /* Write a magic number to the Software Support register, which we can check at later dates to ensure card presence */ WLAN_OUT_16(WLAN_BASE_ADDR + WLAN_SW0, WLAN_SW_MAGIC); /* Check right now. If we can't read the number back, then the card must be absent */ if (WLAN_IN_16(WLAN_BASE_ADDR + WLAN_SW0) != WLAN_SW_MAGIC) { WLAN_DEBUG(DEBUG_FATAL, ("intPrismInit: Card not found!")); return ERROR; } /* Initialize card. If the card is already enabled, then this will reset all configuration settings to the power-on default and return the card to the communications disabled state. If the INIT command fails, an attempt will be made to treat the card as a FLASHless Symbol CF card (requiring a F/W download before initialization) */ if ( intPrismCommand(pWlanDev, WLAN_CMD_INI, 0, 0, 0) == ERROR) { /* Perhaps it's a Symbol Wireless NetWorker, try a F/W download */ if (pIntPrismSymDownload == NULL) { WLAN_DEBUG(DEBUG_INFO, ("intPrismInit: Error Symbol Wireless Networker objects" "not included\n")); return ERROR; } else { if (pIntPrismSymDownload(pWlanDev) == ERROR) { WLAN_DEBUG(DEBUG_FATAL, ("intPrismInit: Error issuing INIT command\n")); return ERROR; } else { symbolCFCard = TRUE; } } } if (symbolCFCard) { /* now that the F/W is loaded to the card, try the INIT command again */ if ( intPrismCommand(pWlanDev, WLAN_CMD_INI, 0, 0, 0) == ERROR) { WLAN_DEBUG(DEBUG_FATAL, ("intPrismInit: Error issuing INIT command\n")); return ERROR; } } WLAN_OUT_16(WLAN_BASE_ADDR + WLAN_SW0, WLAN_SW_MAGIC); /* Determine the exact card type, since some of the card's behaviour is slightly different */ if (intPrismNICIdentify(pWlanDev) == ERROR) { return ERROR; } /* Acknowledge all events, to get a clean start */ WLAN_OUT_16(WLAN_BASE_ADDR + WLAN_EVENT_ACK, 0xffff); /* Run diagnostics to ensure card is up properly. For some strange reason the 3COM card does not support this feature, or supports it differently*/ if (pWlanDev->cardType != WLAN_CARDTYPE_3COM) { if (intPrismDiagnose(pWlanDev) == ERROR) { WLAN_DEBUG(DEBUG_ERROR, ("intPrismInit: Card Diagnostics " "FAILED!\n")); return ERROR; } } if (symbolCFCard) { UINT16 * pMacAddr = NULL; /* Set the MAC address */ if (pIntPrismSymMacAddrGet == NULL)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -