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

📄 sysdot11end.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
    binding->support.sysUsDelay = sysDot11UsDelay;    binding->support.sysCacheInvalidate = sysDot11CacheInvalidate;    binding->support.sysCacheFlush = sysDot11CacheFlush;    binding->support.sysPhysToVirt = sysDot11BusToVirt;    binding->support.sysVirtToPhys = sysDot11VirtToBus;    binding->support.sysWbufFlush = sysDot11WbufFlush;    binding->support.sysDmaMemFree = sysDot11DmaMemFree;    binding->support.essInit = NULL;    binding->support.ibssInit = NULL;    binding->support.apInit = NULL;    /* These definitions bring in the SME modules, if selected */#ifdef INCLUDE_DOT11_END_ESS    binding->support.essInit = dot11SmeEssInit;#endif#ifdef INCLUDE_DOT11_END_IBSS    binding->support.ibssInit = dot11SmeIbssInit;#endif#ifdef INCLUDE_DOT11_END_AP    binding->support.apInit = dot11SmeApInit;#endif    /* Bind in the required lower level board support functions     and configuration parameters */    binding->bsp = &hardware;    /* Fill in the rest of sysDot11WlanCfg that couldn't be configured above */    sysDot11WlanCfg.secPol = 0;    binding->support.rsnInit = NULL;#ifdef INCLUDE_DOT11_SECPOL_TSN    sysDot11WlanCfg.secPol |= DOT11_SECPOL_TSN;    binding->support.rsnInit = dot11RsnInit;#endif#ifdef INCLUDE_DOT11_SECPOL_WPA    sysDot11WlanCfg.secPol |= DOT11_SECPOL_WPA;    binding->support.rsnInit = dot11RsnInit;#endif#ifdef INCLUDE_DOT11_SECPOL_11i    sysDot11WlanCfg.secPol |= DOT11_SECPOL_11i;    binding->support.rsnInit = dot11RsnInit;#endif    sysDot11WlanCfg.authPol = DOT11_AUTHPOL_NONE;    sysDot11WlanCfg.rsnPassphrase = NULL;#ifdef INCLUDE_DOT11_AUTH_8021X    sysDot11WlanCfg.authPol |= DOT11_AUTHPOL_8021X;#endif#if defined(INCLUDE_DOT11_AUTH_PSK)    sysDot11WlanCfg.authPol |= DOT11_AUTHPOL_PSK;    sysDot11WlanCfg.rsnPassphrase = NULL;#endif#if defined(INCLUDE_DOT11_AUTH_PSK_PASSPHRASE)    sysDot11WlanCfg.authPol |= DOT11_AUTHPOL_PSK;    /* We also need to copy the passphrase over to the config structure */    sysDot11WlanCfg.rsnPassphrase = DOT11_AUTH_PSK_PASSPHRASE;    #endif    sysDot11WlanCfg.ciphPol = 0;#ifdef INCLUDE_DOT11_CIPH_WEP40    sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_WEP40;#endif#ifdef INCLUDE_DOT11_CIPH_WEP104    sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_WEP104;#endif#ifdef INCLUDE_DOT11_CIPH_TKIP    sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_TKIP;#endif#ifdef INCLUDE_DOT11_CIPH_AES    sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_AES;#endif    /* Bind in the default WLAN device configuration structure */    binding->wlanConfig = &sysDot11WlanCfg;    /* Bind a reference to the supported card list */    binding->cards = sysDot11Ids;    /* Bind in the rest of the required elements */    binding->nDevs = 0;    binding->endLoad = dot11EndLoad;    binding->endTbl = endDevTbl;    /* Initial the card resource so that all of the devices    are ready to be used if one is found in any given slot */    for (unit = 0; unit < binding->bsp->system.busSlots; unit++)        {        binding->resource[unit].used = FALSE;          }    /* Clear the instance counters */    for (unit = 0; unit < DOT11_CARDS; unit++)        {        binding->cards[unit].instance = 0;        }    /* Now call the BSP level functions to map our devices onto    the bus */    sysDot11Init();    }/********************************************************************* sysDot11Init - bus initialization for dot11 devices** The function scans all of the bus slots supported by the BSP for * one of each of the supported devices. If a valid device is found * then the information that is associated with the device * (i.e. irq, base address etc...) is copied into one of the * resource structures that have been allocated. * For every similar instance of a device that is found in a unique * slot on the bus a unit number is assigned that starts at 0 for * the first instance and is incrementented by 1 for each new * instance of the device that is found. * Once the device has been added to the resource table and a unique * has been assigned to the device it is then installed into the* end table.** RETURNS: N/A** NOMANUAL*/LOCAL void sysDot11Init(void)     {    UINT32 slot;     /* available IDs */    UINT32 idx;      /* card unit found */    UINT32 unit = 0; /* unit number */     /* Hack required by the integrator BSP when booting    with the fei and wlan card inserted in the PCI bus */    SYS_DOT11_DELAY();    /* Try to find the occurrence of the card.     Once a card is found we will fill up its resource stucture     with the data that is provided by the device find method */    for (slot = 0; slot < binding->bsp->system.busSlots; slot++)         {             /* For each slot we will check for the existense of        one of the supported cards. If the a card is found         we will configure the resource structure and assign        a unit number for the device. If no valid card is found        we will move on to the next slot and repeat the         process */        idx = 0;        while (idx < DOT11_CARDS)            {            /* Search for an instance of the device on the bus */            if (sysDot11DeviceFind(binding->cards[idx].vendorId,                                   binding->cards[idx].deviceId,                                   binding->cards[idx].instance,                                    &binding->resource[unit].bus,                                    &binding->resource[unit].device,                                    &binding->resource[unit].function)                  == OK)                {                /* For some architectures we will need to manually                install the resource into the PCI driver */                if (binding->bsp->bus.assignDevice != NULL)                    {                    binding->bsp->bus.assignDevice                        (binding->resource[unit].bus,                          binding->resource[unit].device,                          binding->resource[unit].function);                    }                /* Up date the resource structure if the card passes                the hardware level setup */                 if (sysDot11BusConfig(&binding->resource[unit],                                      binding->bsp)                    == OK)                    {                    /* Add the entry to the end table and then mark the                    device as a valid instance */                    if (sysDot11EndTblBind(unit) == OK)                        {                        /* Override the value passed back for the IDT334                        BSP which has a bug */                        if (binding->bsp->type == IS_IDT334)                            {                            /* Override BSP error for assigning IRQ */                            binding->resource[unit].irqLevel                                 = binding->bsp->cpu.iVec;                            binding->resource[unit].irqVector =                                 binding->resource[unit].irqLevel;                            }                        /* We have found a valid device on the bus so                        update the card instance that is associated                         with the device */                        binding->cards[idx].instance++;                                                /* Add the bsp version */                        binding->resource[unit].magicNum = DOT11_BSP_VERSION;                                                /* Update the unit number */                        unit++;                                                /* Save a local copy of the num of devices found */                        binding->nDevs++;                        }                    }                                                /* Move on to the next slot */                break;                }            idx++;            }         }    }/****************************************************************************** sysDot11BusConfig - Update a resource configuration stucture ** This routine queries the BSP level bus driver to gather all of the * required parameters from the card that are needed by the higher * level device driver. * * RETURNS: OK if the device has been added to the table else ERROR.*/LOCAL STATUS sysDot11BusConfig    (    DOT11_BUS_RSRC*    resource, /* resource binding */    DOT11_BSP_BINDING* bsp       /* bsp level binding */    )    {    STATUS status = OK;    /* Query the pci host for the irq level that is     associated with the device */    status |= pciConfigInByte(resource->bus,                               resource->device,                               resource->function,                               PCI_CFG_DEV_INT_LINE,                               &resource->irqLevel);      /* Convert the interrupt level to an interrupt vector */    SYS_DOT11_ILEVEL_TO_IVEC(bsp,                              resource->irqLevel,                              resource->irqVector);         /* Query the pci host for the memory mapped base address    that is associated with the device */    status |= pciConfigInLong(resource->bus,                               resource->device,                               resource->function,                              PCI_CFG_BASE_ADDRESS_0,                               &resource->membaseCsr);        /* Save the value to the device driver configuration    structure and set the lower order bits to that     indicate the device looks like a memory mapped     perfiferal as opposed to an IO mapped variant */    resource->membaseCsr &= PCI_MEMBASE_MASK;    /* Convert the memory base returned from the card into    an address which can access the PCI space */    SYS_DOT11_CPU_TO_PCI_ADDR(bsp, resource->membaseCsr);        /* Check to see if the BSP requires that we map    the PCI device into the mmu at runtime */    if (bsp->cpu.mmuMappingAdd != NULL)        {        /* Map the PCI space into the virtual address space        if the BSP requires this step */        if (bsp->cpu.mmuMappingAdd            ((void*)resource->membaseCsr,             DOT11_BUS_MEM_SIZE,             bsp->cpu.mmuMask,             bsp->cpu.mmuConfig)            == ERROR)            {                 /* We have encountered an error while attempting to             map the card memory into the processor mmy table so            we will forget about this entry and attempt to             set up the next device */            resource->used = FALSE;            return(ERROR);            }        }    /* Get the vendor ID from the CIS */    status |= pciConfigInWord(resource->bus,                               resource->device,                               resource->function,                               PCI_CFG_VENDOR_ID,                               &resource->vendorId);             /* Get the device ID from the CIS */    status |= pciConfigInWord(resource->bus,                               resource->device,                               resource->function,                               PCI_CFG_DEVICE_ID,                               &resource->deviceId);        /* Get the sub-vendor ID from the CIS */    status |= pciConfigInWord(resource->bus,                               resource->device,                               resource->function,                               0x2C,                               &resource->subVenId);        /* Get the sub-device ID from the CIS */    status |= pciConfigInWord(resource->bus,                               resource->device,                               resource->function,                               PCI_CFG_SUB_SYSTEM_ID,                               &resource->subDevId);        /* Get the chip set revision number from the CIS */    status |= pciConfigInByte(resource->bus,                               resource->device,                               resource->function,                               PCI_CFG_REVISION,                                &resource->pciChipSetRev);        /* enable mapped memory access and Master */    status |= pciConfigOutWord(resource->bus,                                resource->device,                                resource->function,                                PCI_CFG_COMMAND,                                PCI_CMD_MEM_ENABLE | PCI_CMD_MASTER_ENABLE);        /* Tag the device as being valid */    if (status == OK)        {        resource->used = TRUE;        }    /* Success */    return(status);    }/****************************************************************************** sysDot11EndTblBind - Bind an END device into the end table** This routine looks into the end table for the first available* vacant enry. This is accomplished by finding a unit number of -1 * and a value of END_TBL_END in the load fucntion members. * Once found the table enrty is initialized with the proper entries* so that the mux layer will pick up and initialize the driver when* called during the network initialization phase.* * RETURNS: OK if the device has been added to the table else ERROR.*/LOCAL STATUS sysDot11EndTblBind        (    INT32 devNum /* Device instance number */    )    {    STATUS rcode = OK; /* return code */

⌨️ 快捷键说明

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