/* APIs visible to the driver */ void BMIInit(void) { bmiDone = false; pendingEventsFuncCheck = false; /* * On some platforms, it's not possible to DMA to a static variable * in a device driver (e.g. Linux loadable driver module). * So we need to A_MALLOC space for "command credits" and for commands. * * Note: implicitly relies on A_MALLOC to provide a buffer that is * suitable for DMA (or PIO). This buffer will be passed down the * bus stack. */ if (!pBMICmdCredits) { pBMICmdCredits = (u32 *)A_MALLOC_NOWAIT(4); A_ASSERT(pBMICmdCredits); } if (!pBMICmdBuf) { pBMICmdBuf = (u8 *)A_MALLOC_NOWAIT(MAX_BMI_CMDBUF_SZ); A_ASSERT(pBMICmdBuf); } A_REGISTER_MODULE_DEBUG_INFO(bmi); }
/* ------ Functions ------ */ A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks) { int status; AR_DEBUG_ASSERT(callbacks != NULL); A_REGISTER_MODULE_DEBUG_INFO(hif); /* store the callback handlers */ osdrvCallbacks = *callbacks; /* Register with bus driver core */ AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, ("AR6000: HIFInit registering\n")); registered = 1; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) && defined(CONFIG_PM) if (callbacks->deviceSuspendHandler && callbacks->deviceResumeHandler) { ar6k_driver.drv.pm = &ar6k_device_pm_ops; } #endif /* CONFIG_PM */ status = sdio_register_driver(&ar6k_driver); AR_DEBUG_ASSERT(status==0); if (status != 0) { return A_ERROR; } return A_OK; }
/* * Node table support. */ void wlan_node_table_init(void *wmip, struct ieee80211_node_table *nt) { int i; AR_DEBUG_PRINTF(ATH_DEBUG_WLAN, ("node table = 0x%x\n", (A_UINT32)nt)); IEEE80211_NODE_LOCK_INIT(nt); A_REGISTER_MODULE_DEBUG_INFO(wlan); nt->nt_node_first = nt->nt_node_last = NULL; for(i = 0; i < IEEE80211_NODE_HASHSIZE; i++) { nt->nt_hash[i] = NULL; } A_INIT_TIMER(&nt->nt_inact_timer, wlan_node_timeout, nt); nt->isTimerArmed = FALSE; nt->nt_wmip = wmip; nt->nt_nodeAge = WLAN_NODE_INACT_TIMEOUT_MSEC; // // nt_scangen never initialized before and during suspend/resume of winmobile, // that some junk has been stored in this, due to this scan list didn't properly updated // nt->nt_scangen = 0; #ifdef OS_ROAM_MANAGEMENT nt->nt_si_gen = 0; #endif }
void a_module_debug_support_init(void) { if (g_ModuleDebugInit) { return; } A_MUTEX_INIT(&g_ModuleListLock); g_pModuleInfoHead = NULL; g_ModuleDebugInit = TRUE; A_REGISTER_MODULE_DEBUG_INFO(misc); }
/* ------ Functions ------ */ A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks) { SDIO_STATUS status; AR_DEBUG_ASSERT(callbacks != NULL); A_REGISTER_MODULE_DEBUG_INFO(hif); /* Store the callback and event handlers */ osdrvCallbacks = *callbacks; /* Register with bus driver core */ status = SDIO_RegisterFunction(&FunctionContext.function); AR_DEBUG_ASSERT(SDIO_SUCCESS(status)); return SDIO_SUCCESS(status) ? A_OK : A_ERROR; }
/* ------ Functions ------ */ int HIFInit(OSDRV_CALLBACKS *callbacks) { int r; AR_DEBUG_ASSERT(callbacks != NULL); A_REGISTER_MODULE_DEBUG_INFO(hif); /* store the callback handlers */ osdrvCallbacks = *callbacks; /* Register with bus driver core */ registered = 1; r = sdio_register_driver(&ath6kl_hifdev_driver); if (r < 0) return r; return 0; }
/* APIs visible to the driver */ void BMIInit(struct ol_ath_softc_net80211 *scn) { scn->bmiDone = FALSE; /* * On some platforms, it's not possible to DMA to a static variable * in a device driver (e.g. Linux loadable driver module). * So we need to A_MALLOC space for "command credits" and for commands. * * Note: implicitly relies on A_MALLOC to provide a buffer that is * suitable for DMA (or PIO). This buffer will be passed down the * bus stack. */ if (!scn->pBMICmdBuf) { scn->pBMICmdBuf = (A_UCHAR *)OS_MALLOC_CONSISTENT(scn->sc_osdev, MAX_BMI_CMDBUF_SZ, &scn->BMICmd_pa, OS_GET_DMA_MEM_CONTEXT(scn, bmicmd_dmacontext), 0); ASSERT(scn->pBMICmdBuf); } if (!scn->pBMIRspBuf) { scn->pBMIRspBuf = (A_UCHAR *)OS_MALLOC_CONSISTENT(scn->sc_osdev, MAX_BMI_CMDBUF_SZ, &scn->BMIRsp_pa, OS_GET_DMA_MEM_CONTEXT(scn, bmirsp_dmacontext), 0); ASSERT(scn->pBMIRspBuf); } A_REGISTER_MODULE_DEBUG_INFO(bmi); }
/* registered target arrival callback from the HIF layer */ HTC_HANDLE HTCCreate(void *hHIF, HTC_INIT_INFO *pInfo, adf_os_device_t osdev) { MSG_BASED_HIF_CALLBACKS htcCallbacks; HTC_ENDPOINT *pEndpoint=NULL; HTC_TARGET *target = NULL; int i; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("+HTCCreate .. HIF :%p \n",hHIF)); A_REGISTER_MODULE_DEBUG_INFO(htc); if ((target = (HTC_TARGET *)A_MALLOC(sizeof(HTC_TARGET))) == NULL) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("HTC : Unable to allocate memory\n")); return NULL; } A_MEMZERO(target, sizeof(HTC_TARGET)); adf_os_spinlock_init(&target->HTCLock); adf_os_spinlock_init(&target->HTCRxLock); adf_os_spinlock_init(&target->HTCTxLock); do { A_MEMCPY(&target->HTCInitInfo,pInfo,sizeof(HTC_INIT_INFO)); target->host_handle = pInfo->pContext; target->osdev = osdev; ResetEndpointStates(target); INIT_HTC_PACKET_QUEUE(&target->ControlBufferTXFreeList); for (i = 0; i < HTC_PACKET_CONTAINER_ALLOCATION; i++) { HTC_PACKET *pPacket = (HTC_PACKET *)A_MALLOC(sizeof(HTC_PACKET)); if (pPacket != NULL) { A_MEMZERO(pPacket,sizeof(HTC_PACKET)); FreeHTCPacketContainer(target,pPacket); } } #ifdef TODO_FIXME for (i = 0; i < NUM_CONTROL_TX_BUFFERS; i++) { pPacket = BuildHTCTxCtrlPacket(); if (NULL == pPacket) { break; } HTCFreeControlTxPacket(target,pPacket); } #endif /* setup HIF layer callbacks */ A_MEMZERO(&htcCallbacks, sizeof(MSG_BASED_HIF_CALLBACKS)); htcCallbacks.Context = target; htcCallbacks.rxCompletionHandler = HTCRxCompletionHandler; htcCallbacks.txCompletionHandler = HTCTxCompletionHandler; htcCallbacks.txResourceAvailHandler = HTCTxResourceAvailHandler; htcCallbacks.fwEventHandler = HTCFwEventHandler; target->hif_dev = hHIF; /* Get HIF default pipe for HTC message exchange */ pEndpoint = &target->EndPoint[ENDPOINT_0]; HIFPostInit(hHIF, target, &htcCallbacks); HIFGetDefaultPipe(hHIF, &pEndpoint->UL_PipeID, &pEndpoint->DL_PipeID); } while (FALSE); HTCRecvInit(target); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("-HTCCreate (0x%p) \n", target)); return (HTC_HANDLE)target; }
/* registered target arrival callback from the HIF layer */ HTC_HANDLE htc_create(void *ol_sc, HTC_INIT_INFO *pInfo, cdf_device_t osdev) { struct hif_msg_callbacks htcCallbacks; HTC_ENDPOINT *pEndpoint = NULL; HTC_TARGET *target = NULL; int i; if (ol_sc == NULL) { HTC_ERROR("%s: ol_sc = NULL", __func__); return NULL; } HTC_TRACE("+htc_create .. HIF :%p", ol_sc); A_REGISTER_MODULE_DEBUG_INFO(htc); target = (HTC_TARGET *) cdf_mem_malloc(sizeof(HTC_TARGET)); if (target == NULL) { HTC_ERROR("%s: Unable to allocate memory", __func__); return NULL; } A_MEMZERO(target, sizeof(HTC_TARGET)); cdf_spinlock_init(&target->HTCLock); cdf_spinlock_init(&target->HTCRxLock); cdf_spinlock_init(&target->HTCTxLock); cdf_spinlock_init(&target->HTCCreditLock); do { A_MEMCPY(&target->HTCInitInfo, pInfo, sizeof(HTC_INIT_INFO)); target->host_handle = pInfo->pContext; target->osdev = osdev; reset_endpoint_states(target); INIT_HTC_PACKET_QUEUE(&target->ControlBufferTXFreeList); for (i = 0; i < HTC_PACKET_CONTAINER_ALLOCATION; i++) { HTC_PACKET *pPacket = (HTC_PACKET *) cdf_mem_malloc(sizeof(HTC_PACKET)); if (pPacket != NULL) { A_MEMZERO(pPacket, sizeof(HTC_PACKET)); free_htc_packet_container(target, pPacket); } } #ifdef TODO_FIXME for (i = 0; i < NUM_CONTROL_TX_BUFFERS; i++) { pPacket = build_htc_tx_ctrl_packet(); if (NULL == pPacket) { break; } htc_free_control_tx_packet(target, pPacket); } #endif /* setup HIF layer callbacks */ cdf_mem_zero(&htcCallbacks, sizeof(struct hif_msg_callbacks)); htcCallbacks.Context = target; htcCallbacks.rxCompletionHandler = htc_rx_completion_handler; htcCallbacks.txCompletionHandler = htc_tx_completion_handler; htcCallbacks.txResourceAvailHandler = htc_tx_resource_avail_handler; htcCallbacks.fwEventHandler = htc_fw_event_handler; target->hif_dev = ol_sc; /* Get HIF default pipe for HTC message exchange */ pEndpoint = &target->EndPoint[ENDPOINT_0]; hif_post_init(target->hif_dev, target, &htcCallbacks); hif_get_default_pipe(target->hif_dev, &pEndpoint->UL_PipeID, &pEndpoint->DL_PipeID); } while (false); htc_recv_init(target); HTC_TRACE("-htc_create: (0x%p)", target); return (HTC_HANDLE) target; }