?? dot11lib.c
字號(hào):
{ DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndLoad: Error allocating device structure\n", 0, 0, 0, 0, 0, 0)); return NULL; } /* Fill in the constant definitions. These are deliberately never freed, since other instances may use them. The only reason they are not constants is that we cannot reliably assure alignment of constant byte-arrays.*/ if (dot11BcastMAC == NULL) { if ((dot11BcastMAC = memalign(sizeof(UINT32), DOT11_ADDR_LEN)) == NULL) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndLoad: Error allocating dot11BcastMAC\n", 0, 0, 0, 0, 0, 0)); free(pDot11); return NULL; } bfill(dot11BcastMAC, DOT11_ADDR_LEN, 0xff); } if (dot11NullMAC == NULL) { if ((dot11NullMAC = memalign(sizeof(UINT32), DOT11_ADDR_LEN)) == NULL) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndLoad: Error allocating dot11NullMAC\n", 0, 0, 0, 0, 0, 0)); free(pDot11); free(dot11BcastMAC); return NULL; } bzero(dot11NullMAC, DOT11_ADDR_LEN); } pDot11->endLoad = (FUNCPTR)dot11EndLoad; pDot11->endStart = (FUNCPTR)dot11EndStart; pDot11->endStop = (FUNCPTR)dot11EndStop; pDot11->endUnload = (FUNCPTR)dot11EndUnload; pDot11->debugLevelSet = (FUNCPTR)dot11DebugLevelSet; pDot11->debugLevelGet = (FUNCPTR)dot11DebugLevelGet; /* Load the membase, etc from the initstring */ if (dot11Parse(pDot11, initString) != OK) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndLoad: Error parsing initstring.\n", (int)initString,0,0,0,0,0)); DOT11_LOG_FLUSH; free(pDot11); free(dot11BcastMAC); free(dot11NullMAC); return NULL; } /* Set up the network buffer pool */ if (dot11MemInit(pDot11) != OK) { /* Error message was given above at the location of the error */ free(pDot11); free(dot11BcastMAC); free(dot11NullMAC); return NULL; } if (dot11TimerInit() != OK) { /* Error message was given above at the location of the error */ dot11MemFree(pDot11); free(pDot11); free(dot11BcastMAC); free(dot11NullMAC); return NULL; } /* initialize the HDD Object and detect what chipset we are using */ if (dot11HddInit(pDot11) != OK) { /* Error message was given above at the location of the error */ dot11TimerDestroy(); dot11MemFree(pDot11); free(pDot11); free(dot11BcastMAC); free(dot11NullMAC); return NULL; } /* Fill in the macAddr */ if (pDot11->hdd->macAddrGet != NULL) { (pDot11->hdd->macAddrGet)(pDot11, (UINT8 *)pDot11->macAddr); } else { /* Since we don't have a MAC address, use the vxworks "bad memory" character */ bfill((char*)pDot11->macAddr, DOT11_ADDR_LEN, 0xee); } /* initialize the DPE Object and detect what chipset we are using */ if (dot11DpeInit(pDot11) != OK) { /* Error message was given above at the location of the error */ pDot11->hdd->free(pDot11); dot11TimerDestroy(); dot11MemFree(pDot11); free(dot11BcastMAC); free(dot11NullMAC); free(pDot11); return NULL; } /* initialize the SME Object and detect what chipset we are using */ switch (dot11SmeInit(pDot11)) { case OK: break; case EINVAL: /* This indicates that the SME framework was initialized, but the SME module was not */ DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_INIT, ("dot11EndLoad: Default SME module does not exist\n", 0,0,0,0,0,0)); break; case ERROR: default: DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndLoad: Error in SME module init\n", 0,0,0,0,0,0)); pDot11->dpe->free(pDot11); pDot11->hdd->free(pDot11); dot11TimerDestroy(); dot11MemFree(pDot11); free(pDot11); free(dot11BcastMAC); free(dot11NullMAC); return NULL; break; } /* Set up the END function table */ pDot11->dot11EndFuncTable.start = pDot11->endStart; pDot11->dot11EndFuncTable.stop = pDot11->endStop; pDot11->dot11EndFuncTable.unload = pDot11->endUnload; pDot11->dot11EndFuncTable.ioctl = (FUNCPTR)pDot11->sme->endIoctl; pDot11->dot11EndFuncTable.send = pDot11->dpe->endSend; pDot11->dot11EndFuncTable.mCastAddrAdd = pDot11->sme->endMCastAddrAdd; pDot11->dot11EndFuncTable.mCastAddrDel = pDot11->sme->endMCastAddrDel; pDot11->dot11EndFuncTable.mCastAddrGet = pDot11->sme->endMCastAddrGet; pDot11->dot11EndFuncTable.pollSend = pDot11->dpe->endPollSend; pDot11->dot11EndFuncTable.pollRcv = pDot11->dpe->endPollRcv; pDot11->dot11EndFuncTable.formAddress = endEtherAddressForm; pDot11->dot11EndFuncTable.packetDataGet = endEtherPacketDataGet; pDot11->dot11EndFuncTable.addrGet = endEtherPacketAddrGet; pDot11->dot11EndFuncTable.endBind = NULL; /* Set up the END driver */ if ((END_OBJ_INIT (&pDot11->endObj, (DEV_OBJ *)pDot11, (char *)DOT11_IFNAME, pDot11->unitNum, &pDot11->dot11EndFuncTable, "Wind River Systems Wireless END Driver") == ERROR)) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndLoad: END_OBJ init failed.\n", 0, 0, 0, 0, 0, 0)); pDot11->sme->free(pDot11); pDot11->dpe->free(pDot11); pDot11->hdd->free(pDot11); dot11TimerDestroy(); dot11MemFree(pDot11); free(pDot11); free(dot11BcastMAC); free(dot11NullMAC); return NULL; } if (mib2Init(&(pDot11->endObj.mib2Tbl), M2_ifType_ethernet_csmacd, pDot11->macAddr, DOT11_ADDR_LEN, DOT11_ETHERMTU, DOT11_MAXRATE) == ERROR) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndLoad: Failed MIB-II Init.\n", 0, 0, 0, 0, 0, 0)); pDot11->sme->free(pDot11); pDot11->dpe->free(pDot11); pDot11->hdd->free(pDot11); dot11TimerDestroy(); free(dot11BcastMAC); free(dot11NullMAC); dot11MemFree(pDot11); free(pDot11); return NULL; } pDebug = pDot11; DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_INIT, ("dot11EndLoad: Completed.\n", 0, 0, 0, 0, 0, 0)); return &pDot11->endObj; }/****************************************************************************** dot11EndStart - The END start routine - puts card in operational state** This routine is called via muxDevStart(). It is meant to be called * immediately after the END load routine, and completes the process of * initializing the device. ** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11EndStart ( END_OBJ * pEnd /* END device to start. Must be wireless */ ) { DOT11_FW * pDot11 = (DOT11_FW *)pEnd; /* Zero out the statistics */ bzero((char *)&pDot11->stats, sizeof(DOT11_STATS)); DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_INIT, ("dot11EndStart: Called. Initial mode = %s.\n", (int)dot11ModeNames[pDot11->dot11Mode], 0, 0, 0, 0, 0)); /* Start the timers that maintain bytes/sec info */ if (dot11StatsTimerInit(pDot11) != OK) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndStart: Error initializing stat timer.\n", 0, 0, 0, 0, 0, 0)); return ERROR; } if (pDot11->dot11Mode != DOT11_MODE_NONE) { /* Start the device, ISR, etc */ if (pDot11->hdd->start(pDot11) != OK) { /* Don't mark the device as UP if the init failed */ return ERROR; } } /* Initialize the SME type selected above */ if (pDot11->sme->modeStart(pDot11, pDot11->dot11Mode) != OK) { /* Stop the device, ISR, etc */ if (pDot11->hdd->stop(pDot11) != OK) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11EndStart: Error initializing SME Mode.\n", 0, 0, 0, 0, 0, 0)); return ERROR; } DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_INIT, ("dot11EndStart: Device mode not supported. Starting in" " DOT11_MODE_NONE.\n", 0, 0, 0, 0, 0, 0)); pDot11->dot11Mode = DOT11_MODE_NONE; } /* Inform END that the device is "up" */ END_OBJ_READY(&pDot11->endObj, IFF_NOTRAILERS | IFF_BROADCAST | IFF_MULTICAST | IFF_UP | IFF_RUNNING); return OK; }/****************************************************************************** dot11EndStop - The END stop function** This function is called via muxDevStop(). It stops the device, halting* interrupts. When this function has been called, the device is in a * non-operational state, but nothing has been de-initialized and no settings* have been lost. Calling dot11EndStart() again will resume operation.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11EndStop ( END_OBJ * pEnd /* wireless END device to stop*/ ) {
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -