⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syswlanendpxa250.c

📁 vworks 下wlan的实现代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* sysWlanEndPxa250.c - system configuration module for Wlan END device *//* Copyright 2001-2003 Wind River Systems, Inc. *//*modification history--------------------01x,23may03,ss  modified sysCfgParamGet to not use strlen for WEP key sizes01w,13may03,dxb  Added comments for intConnect routines.01v,21feb03,j_b  enclose entire file with INCLUDE_WLAN_END define check01u,17jun02,cjl  Fix for SPR 78730 to correct screen flicker during network                 traffic.01t,24apr02,dxb  Updated INCLUDE_WLAN_END wrapper.01s,23apr02,ss  set pIntSymMacAddrGet if Symbol CF card is included01r,18apr02,ss  Added wlanIoctl routine01q,16apr02,ss  changed usage of pBSP in sysWlanEndLoad01p,09apr02,ss  Added sysAironetEndLoad routine and defined sysWlanIO and                 sysWlanMem routines now required01o,27feb02,rb  Fixed bug with WLAN_WEP_ENABLE01n,20feb02,rb  Added international support01m,14feb02,ss  Added required extern for reference to Symbol CF Card init                 routine01l,07feb02,dxb  Removed references to DEV.01k,06feb02,dxb  Updated to include changes to wlanEnd.h01j,04feb02,eja  Added api sysWlanCfgParamGet () get bsp defined default                 parameters to be used by the driver.01i,07jan02,ss  Setup Symbol card init function ptr if INCLUDE_SYM_CFCARD                 defined01h,22nov01,eja  Added dummy routine to include show routines.01g,15nov01,eja  Bug fix.01f,15nov01,eja  Got rid of global bsp routine table.01e,05nov01,rb  Implemented API change wlan->intPrism01d,05nov01,rb  Fixed compile bug w/ new file names01c,25sep01,dxb  Removed further references to EJA test code.01b,25sep01,dxb  Removed references to EJA test code.01a,20aug01,rb  Created from sysWlanEndMips.c*//*DESCRIPTIONThis is the WRS-supplied configuration module for the VxWorksWlan (wln) END driver for the wrSbcPxa250 BSP.It performs the dynamic parameterization of the wlan driver.This technique of 'just-in-time' parameterization allows driverparameter values to be declared as any other defined constants ratherthan as static strings.*/#ifdef INCLUDE_WLAN_END/* INCLUDES  *//* SYSTEM INCLUDES */#include "vxWorks.h"#include "stdio.h"#include "stdlib.h"#include "string.h"#include "logLib.h"#include "end.h"#if 0#include "intLib.h"#include "iv.h"#include "sysLib.h"#ifdef INCLUDE_MMU_BASIC#include <vmLib.h>#endif#endif/* END - SYSTEM INCLUDES *//* LOCAL INCLUDES */#include "pcmciaLib.h"#include "pccardLib.h"#include "config.h"#include "configWlan.h"#include "sysPcmciaBspSpec.h"#include "wrn/wlan/wlanEnd.h"#include "wrn/wlan/intPrismHw.h"/* END - LOCAL INCLUDES *//* END INCLUDES *//* DEFINES */#define BYTE_ALIGN               sizeof (UINT8)#define WORD_ALIGN               sizeof (UINT16)#define LONG_ALIGN               sizeof (UINT32)#undef SYSWLAN_DEBUG#ifdef SYSWLAN_DEBUG#define SYSWLANLOGMSG(x)    logMsg x#else#define SYSWLANLOGMSG(x)#endif/* END - DEFINES *//* External variables */IMPORT CARD_ENTRY       socketTbl [2];IMPORT WLAN_RESOURCE    wlanResources[];char * wlanStaVersion = WLAN_STA_VERSION;/* EXTERNAL METHODS */#ifdef INCLUDE_PRISM_ENDIMPORT END_OBJ *intPrismLoad    (    char * initString,   /* Initial parameters to initialize device with */    void * pBSP          /* BSP specific pointer - unused in this driver */    );#endif#ifdef INCLUDE_SYM_CFCARD/* Symbol CF Card init routines */IMPORT STATUS intPrismSymDownload(WLAN_DEV *);IMPORT UINT16 * intPrismSymMacAddrGet(void);/* function ptr's to Symbol CF card routines that are required by intPrismHw.c   in order to initialize a Symbol CF Card.  These function ptr's are set in   this manner to allow the intPrism driver to build without any unnecessary   dependencies on Symbol only modules*/IMPORT STATUS   (* pIntPrismSymDownload)   (WLAN_DEV *);IMPORT UINT16 * (* pIntPrismSymMacAddrGet) (void);#endif#ifdef INCLUDE_AIRONET_ENDIMPORT END_OBJ * cisAironetEndLoad    (    char * initString,   /* Initial parameters to initialize device with */    void * pBSP    );#endif/* END - EXTERNAL METHODS *//* LOCAL METHODS */LOCAL void sysWlanBcopy           (const UINT8 *, UINT8 *, UINT16);/* This is required for the wlan driver to work */#define SYS_END_HW_ENABLE(sock,name,manfID,ioBase,iVec,iLevel) \        sysWlanPccardEnable (sock,name,manfID,ioBase,iVec,iLevel)/* END - LOCAL METHODS *//* PUBLIC METHODS */#ifdef INCLUDE_PRISM_ENDEND_OBJ * sysWlanEndPrismLoad    (char *, void *);#endif#ifdef INCLUDE_AIRONET_ENDEND_OBJ * sysWlanEndAironetLoad    (char *, void *);#endifUINT8  sysWlanMemInByte        (UINT32);void   sysWlanMemOutByte       (UINT32, UINT8);UINT16 sysWlanMemInWord        (UINT32);void   sysWlanMemOutWord       (UINT32, UINT16);UINT32 sysWlanMemInLong        (UINT32);void   sysWlanMemOutLong       (UINT32, UINT32);UINT8  sysWlanIOInByte        (UINT32);void   sysWlanIOOutByte       (UINT32, UINT8);UINT16 sysWlanIOInWord        (UINT32);void   sysWlanIOOutWord       (UINT32, UINT16);UINT32 sysWlanIOInLong        (UINT32);void   sysWlanIOOutLong       (UINT32, UINT32);void   sysWlanIntConnect    (INT32, INT32, INT32, STATUS *);void   sysWlanIntDisconnect (INT32, INT32, INT32, STATUS *);void   sysWlanIntEnable     (INT32, STATUS *);void   sysWlanIntDisable    (INT32, STATUS *);STATUS sysWlanCfgParamGet   (UINT32, INT32);/* END - PUBLIC METHODS */#ifdef INCLUDE_PRISM_END/******************************************************************************** sysWlanEndPrismLoad - load an instance of the wlan END  driver** This routine loads the sysWlanEndPrismLoad driver with the parameters* specified by the resource table for the device, and some default values.** The END device load string formed by this routine is in the following* following format.* <devIoAddr>:<vecnum>:<intLvl>** .IP <devIoAddr>* Device register base IO address* .IP <vecNum>* Interrupt vector number.* .IP <intLvl>* Interrupt level.** This routine only loads and initializes instance zero of the device.* If the user wishes to use more than one wlan devices, this routine* should be changed.** RETURNS: pointer to END object or ERROR.** SEE ALSO: intPrismEndLoad()*/END_OBJ * sysWlanEndPrismLoad    (    char * initString,   /* Initial parameters to initialize device with */    void * pBSP          /* BSP specific pointer - unused in this driver */    )    {    /*     * The End driver END_LOAD_STRING should be:     * "<ioBase>:<intVec>:<intLevel>"     *  Note that the unit number is prepended by mux.     */    char        paramStr [END_INIT_STR_MAX];       /* end.h */    UINT32      ioAddr = 0;    int         intLevel;    CARD_INFO * pCardInfo = (CARD_INFO *)pBSP;    END_OBJ *   pEnd   = NULL;    char *      cp;    void *      pBSP2;    static const char * const   wlanParamTemplate = "%#010x:%#04x:%#04x";    /* set the access type to Memory mapped, PCMCIA card - the only       option available for the wrSbcPxa250 */    pBSP2 = (void *) (WLAN_MEM_ACCESS | WLAN_PCMCIA_CARD);    if (strlen (initString) == 0)        {#ifdef INCLUDE_SYM_CFCARD        /* set the function ptr for the Symbol init routines */        pIntPrismSymDownload = intPrismSymDownload;        pIntPrismSymMacAddrGet = intPrismSymMacAddrGet;#endif        /*         * muxDevLoad() calls us twice.  If the string is         * zero length, then this is the first time through         * this routine, so we just return.         */#ifdef SYSWLAN_DEBUG        taskDelay(5*sysClkRateGet());#endif        pEnd = intPrismLoad (initString, pBSP2);        }    else        {        /* Make sure the card is there */        if (pCardInfo->sock < 0)            {            printf("Cannot load WLAN END driver -- card not present\n");            return (void *)NULL;            }        /*         * On the second pass though here, we actually create         * the initialization parameter string on the fly.         * Note that we will be handed our unit number on the         * second pass through and we need to preserve that information.         * So we use the unit number handed from the input string.         */        intLevel = socketTbl [pCardInfo->sock].intLevel;        SYSWLANLOGMSG(("sysWlanEndPrismLoad: intLevel = %d\n",                       intLevel, 2, 3, 4, 5, 6));        ioAddr = socketTbl [pCardInfo->sock].ioAddr;        SYSWLANLOGMSG(("sysWlanEndPrismLoad: ioAddr = %#010x\n",                       ioAddr, 2, 3, 4, 5, 6));        ioAddr &= ~(0x0000ffff);        SYSWLANLOGMSG(("sysWlanEndPrismLoad: ioAddr = %#010x\n",                       ioAddr, 2, 3, 4, 5, 6));        ioAddr += pCardInfo->offset;        SYSWLANLOGMSG(("sysWlanEndPrismLoad: ioAddr = %#010x\n",                       ioAddr, 2, 3, 4, 5, 6));        wlanResources[pCardInfo->sock].intLevel = intLevel;        cp = strcpy (paramStr, initString);  /* cp points to paramStr */        /* Now, we advance cp, by finding the end the string */        cp += strlen (paramStr);        sprintf (cp, wlanParamTemplate, ioAddr, intLevel, intLevel);        SYSWLANLOGMSG(("sysWlanEndPrismLoad: initstring = %s\n",                       (int)paramStr, 2, 3, 4, 5, 6));#ifdef SYSWLAN_DEBUG        taskDelay(5*sysClkRateGet());#endif        if ((pEnd = intPrismLoad (paramStr, pBSP2)) == (END_OBJ *)NULL)            {            printf ("sysWlanEndPrismLoad: intPrismLoad failed.\n");            }        }    return (pEnd);    }#endif /* INCLUDE_PRISM_END */#ifdef INCLUDE_AIRONET_END/******************************************************************************** sysWlanEndAironetLoad - load an instance of the Cisco Aironet END driver** This routine loads the cisAir driver with the parameters specified by* the resource table for the device, and some default values.** The END device load string formed by this routine is in the following* following format.* <devIoAddr>:<vecnum>:<intLvl>** .IP <devIoAddr>* Device register base IO address* .IP <vecNum>* Interrupt vector number.* .IP <intLvl>* Interrupt level.** This routine only loads and initializes instance zero of the device.* If the user wishes to use more than one wlan devices, this routine* should be changed.** RETURNS: pointer to END object or ERROR.** SEE ALSO: sysWlanEndPrismLoad()*/END_OBJ * sysWlanEndAironetLoad    (    char * initString,   /* Initial parameters to initialize device with */    void * pBSP          /* BSP specific pointer - unused in this driver */    )    {    /*     * The End driver END_LOAD_STRING should be:     * "<ioBase>:<intVec>:<intLevel>:<attachmentType>:<nRxFrames>"     *  Note that the unit number is prepended by mux.     */    char        paramStr [END_INIT_STR_MAX];       /* end.h */    UINT32      ioAddr = 0;    int         intLevel;    CARD_INFO * pCardInfo = (CARD_INFO *)pBSP;    END_OBJ *   pEnd   = NULL;    char *      cp;    void *      pBSP2;    static const char * const   wlanParamTemplate = "%#010x:%#04x:%#04x";    /* set the access type to Memory mapped, PCMCIA card - the only       option available for the wrSbcPxa250 */    pBSP2 = (void *) (WLAN_MEM_ACCESS | WLAN_PCMCIA_CARD);    if (strlen (initString) == 0)        {        /*         * muxDevLoad() calls us twice.  If the string is         * zero length, then this is the first time through         * this routine, so we just return.         */#ifdef SYSWLAN_DEBUG        taskDelay(5*sysClkRateGet());#endif        pEnd = cisAironetEndLoad (initString, pBSP2);        }    else        {        /* Make sure the card is there */        if (pCardInfo->sock < 0)            {            printf("Cannot load WLAN END driver -- card not present\n");            return (void *)NULL;            }        /*         * On the second pass though here, we actually create         * the initialization parameter string on the fly.         * Note that we will be handed our unit number on the         * second pass through and we need to preserve that information.         * So we use the unit number handed from the input string.         */        intLevel = socketTbl [pCardInfo->sock].intLevel;        SYSWLANLOGMSG(("sysWlanEndAironetLoad: intLevel = %d\n",                       intLevel, 2, 3, 4, 5, 6));        ioAddr = socketTbl [pCardInfo->sock].ioAddr;        SYSWLANLOGMSG(("sysWlanEndAironetLoad: ioAddr = %#010x\n",                       ioAddr, 2, 3, 4, 5, 6));        ioAddr &= ~(0x0000ffff);        SYSWLANLOGMSG(("sysWlanEndAironetLoad: ioAddr = %#010x\n",                       ioAddr, 2, 3, 4, 5, 6));        ioAddr += pCardInfo->offset;        SYSWLANLOGMSG(("sysWlanEndAironetLoad: ioAddr = %#010x\n",                       ioAddr, 2, 3, 4, 5, 6));        wlanResources[pCardInfo->sock].intLevel = intLevel;        cp = strcpy (paramStr, initString);  /* cp points to paramStr */        /* Now, we advance cp to end of string and finish it off */        cp += strlen (paramStr);        sprintf (cp, wlanParamTemplate, ioAddr, intLevel, intLevel);        SYSWLANLOGMSG(("sysWlanEndAironetLoad: initstring = %s\n",                       (int)paramStr, 2, 3, 4, 5, 6));#ifdef SYSWLAN_DEBUG        taskDelay(5*sysClkRateGet());#endif        if ((pEnd = cisAironetEndLoad (paramStr, pBSP2)) == (END_OBJ *)NULL)            {            printf("sysWlanEndAironetLoad: cisAironetEndLoad failed.\n");            }        }    return (pEnd);    }#endif /* INCLUDE_AIRONET_END *//********************************************************************************* sysWlanMemInByte - read byte from device** RETURNS: UCHAR** NOMANUAL*/UINT8 sysWlanMemInByte    (    UINT32 port    )    {    UINT8 tempUINT8;    tempUINT8 = * (volatile UINT8 *) port;    return (tempUINT8);    }/********************************************************************************* sysWlanMemOutByte - write byte to device** RETURNS: N/A** NOMANUAL*/void sysWlanMemOutByte    (    UINT32 port,    UINT8  data    )    {    * (volatile UINT8 *) port = data;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -