Exemple #1
0
/**
 * \fn     tmr_DestroyTimer
 * \brief  Destroy the specified timer
 *
 * Destroy the specified timer object, icluding the timer in the OS-API.
 *
 * \note   This timer destruction function should be used before tmr_Destroy() is executed!!
 * \param  hTimerInfo - The timer handle
 * \return TI_OK on success or TI_NOK on failure
 * \sa     tmr_CreateTimer
 */
TI_STATUS tmr_DestroyTimer (TI_HANDLE hTimerInfo)
{
	TTimerInfo *pTimerInfo = (TTimerInfo *)hTimerInfo;  /* The timer handle */
	TTimerModule *pTimerModule;                  /* The timer module handle */

	if (!pTimerInfo) {
		return TI_NOK;
	}
	pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule;
	if (!pTimerModule) {
		WLAN_OS_REPORT (("tmr_DestroyTimer(): ERROR - NULL timer!\n"));
		/* Free the timer object */
		os_memoryFree (NULL, hTimerInfo, sizeof(TTimerInfo));
		return TI_NOK;
	}

	/* Free the OS-API timer */
	if (pTimerInfo->hOsTimerObj) {
		os_timerDestroy (pTimerModule->hOs, pTimerInfo->hOsTimerObj);
		pTimerModule->uTimersCount--;  /* update created timers number */
	}
	/* Free the timer object */
	os_memoryFree (pTimerModule->hOs, hTimerInfo, sizeof(TTimerInfo));
	return TI_OK;
}
/**
 * \author Yuval Adler\n
 * \date 29-Dec-2004\n
 * \brief Finalizes the scan SRV module (releasing memory and timer)
 *
 * Function Scope \e Public.\n
 * \param hScanSRV - handle to the scan SRV object.\n
 */
void MacServices_scanSRV_destroy( TI_HANDLE hScanSRV )
{
    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSRV;

    /* free timer */
    os_timerStop( pScanSRV->hOS, pScanSRV->timer );
    os_timerDestroy( pScanSRV->hOS, pScanSRV->timer );

    /* free memory */
    fsm_Unload( pScanSRV->hOS, pScanSRV->SM );
    os_memoryFree( pScanSRV->hOS, (TI_HANDLE)pScanSRV , sizeof(scanSRV_t) );
}
Exemple #3
0
/**
 * \fn     tmr_DestroyTimer
 * \brief  Destroy the specified timer
 *
 * Destroy the specified timer object, icluding the timer in the OS-API.
 *
 * \note   This timer destruction function should be used before tmr_Destroy() is executed!!
 * \param  hTimerInfo - The timer handle
 * \return TI_OK on success or TI_NOK on failure
 * \sa     tmr_CreateTimer
 */
TI_STATUS tmr_DestroyTimer (TI_HANDLE hTimerInfo)
{
    TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */
    TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */

    /* Free the OS-API timer */
    os_timerDestroy (pTimerModule->hOs, pTimerInfo->hOsTimerObj);

    /* Free the timer object */
    os_memoryFree (pTimerModule->hOs, hTimerInfo, sizeof(TTimerInfo));

    pTimerModule->uTimersCount--;  /* update created timers number */

    return TI_OK;
}
/**
*
* mainKeys_config
*
* \b Description: 
*
* Init main security state machine state machine
*
* \b ARGS:
*
*  none
*
* \b RETURNS:
*
*  OK on success, NOK otherwise.
*
* \sa 
*/
TI_STATUS mainKeys_unload(mainKeys_t *pMainKeys)
{
	TI_STATUS	status;

	if (pMainKeys == NULL)
	{
		return NOK;
	}

	status = fsm_Unload(pMainKeys->hOs, pMainKeys->pMainKeysSm);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error releasing FSM memory \n"));
	}

	os_timerStop(pMainKeys->hOs, pMainKeys->timer);
    os_timerDestroy(pMainKeys->hOs, pMainKeys->timer);
	
    status = keyParser_unload(pMainKeys->pKeyParser);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error unloading key parser\n"));
	}

	status = broadcastKey_unload(pMainKeys->pBcastSm);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error unloading broadcast key SM\n"));
	}

	status = unicastKey_unload(pMainKeys->pUcastSm);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pMainKeys->hReport, RSN_MODULE_LOG,
						  ("MAIN_KEYS_SM: Error unloading unicast key SM\n"));
	}
	
	os_memoryFree(pMainKeys->hOs, pMainKeys, sizeof(mainKeys_t));

    return OK;
}
/****************************************************************************
 *                      elpCtrl_Destroy()
 ****************************************************************************
 * DESCRIPTION: 
 * 
 * INPUTS:  hElpCtrl - the handle to the ElpCtrl module.
 *      
 * 
 * OUTPUT:  
 * 
 * RETURNS: OK
 ****************************************************************************/
int elpCtrl_Destroy (TI_HANDLE hElpCtrl)
{           
    elpCtrl_t *pElpCtrl = (elpCtrl_t*)hElpCtrl;

    if (pElpCtrl)
    {
        if (NULL != pElpCtrl->hTimer)
        {
            os_timerDestroy (pElpCtrl->hOs, pElpCtrl->hTimer);
        }

        os_memoryFree (pElpCtrl->hOs, pElpCtrl, sizeof(elpCtrl_t));
    }

    return OK;
}
void sendMgmtPacket(TI_HANDLE hOs)
{
	static TI_UINT8            aMsg[2000];
	TI_UINT32           i;
	dot11MgmtSubType_e  eMsgType = DE_AUTH;

	for (i = 0; i < packetLength; i++) {
		aMsg[i] = i;
	}

	mlmeBuilder_sendFrame(tmp_hMlme, eMsgType, aMsg, packetLength, 0);

	numOfPackets++;
	if ((infinitLoopFl == 0) && (numOfPackets > packetsNum)) {
		os_timerStop(hOs, dTimer);
		os_printf("\n *********** Last Packet was sent **********");
		os_timerDestroy(hOs, dTimer);
	} else {
		os_timerStart(hOs, dTimer, 1000);
	}
}
/**
*
* assocunload - unload association SM from memory
*
* \b Description: 
*
* Unload association SM from memory
*
* \b ARGS:
*
*  I   - hAssoc - association SM context  \n
*
* \b RETURNS:
*
*  OK if successful, NOK otherwise.
*
* \sa rsn_mainSecSmKeysOnlyStop()
*/
TI_STATUS assoc_unload(TI_HANDLE hAssoc)
{
    TI_STATUS 		status;
	assoc_t		*pHandle;

	pHandle = (assoc_t*)hAssoc;

	status = fsm_Unload(pHandle->hOs, pHandle->pAssocSm);
    if (status != OK)
	{
		/* report failure but don't stop... */
		WLAN_REPORT_ERROR(pHandle->hReport, ASSOC_MODULE_LOG,
				  ("ASSOC_SM: Error releasing FSM memory \n"));
	}
	
	os_timerDestroy(pHandle->hOs, pHandle->timer);
	
	os_memoryFree(pHandle->hOs, hAssoc, sizeof(assoc_t));

	return OK;
}
Exemple #8
0
/** 
 * \fn     wlanDrvIf_Destroy
 * \brief  Destroy the driver instance
 * 
 * Destroy all driver modules.
 * Release driver OS resources (IRQ, workqueue, events socket)
 * Release driver network interface.
 * Free init files memory.
 * Free driver object.
 *
 * \note   
 * \param  drv - The driver object handle
 * \return void
 * \sa     wlanDrvIf_Create
 */ 
static void wlanDrvIf_Destroy (TWlanDrvIfObj *drv)
{
    /* Release the driver network interface */
    if (drv->netdev)
    {
        netif_stop_queue  (drv->netdev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
        wlanDrvIf_Stop    (drv->netdev);
#endif
        unregister_netdev (drv->netdev);
        free_netdev(drv->netdev);
    }

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21))
    cancel_work_sync (&drv->tWork); 
#else
    cancel_delayed_work (&drv->tWork);
#endif
    flush_workqueue (drv->pWorkQueue);
    destroy_workqueue (drv->pWorkQueue);

    /* Destroy all driver modules */
    if (drv->tCommon.hDrvMain)
    {
        drvMain_Destroy (drv->tCommon.hDrvMain);
    }

    /* close the ipc_kernel socket*/
    if (drv && drv->wl_sock) 
    {
        sock_release (drv->wl_sock->sk_socket);
    }

    /* Release the driver interrupt (or polling timer) */
#ifdef PRIODIC_INTERRUPT
    os_timerDestroy (drv, drv->hPollTimer);
#else
    if (drv->irq)
    {
        free_irq (drv->irq, drv);
	drv->irq=NULL;
        hPlatform_freeInterrupt ();
    }
#endif

    /* 
     *  Free init files memory
     */
    if (drv->tCommon.tFwImage.pImage)
    {
        os_memoryFree (drv, drv->tCommon.tFwImage.pImage, drv->tCommon.tFwImage.uSize);
        #ifdef TI_MEM_ALLOC_TRACE        
          os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", 
              __FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, -drv->tCommon.tFwImage.uSize);
        #endif
    }
    if (drv->tCommon.tNvsImage.pImage)
    {
        kfree (drv->tCommon.tNvsImage.pImage);
        #ifdef TI_MEM_ALLOC_TRACE        
          os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", 
              __FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, -drv->tCommon.tNvsImage.uSize);
        #endif
    }
    if (drv->tCommon.tIniFile.pImage)
    {
        kfree (drv->tCommon.tIniFile.pImage);
        #ifdef TI_MEM_ALLOC_TRACE        
          os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", 
              __FUNCTION__, __LINE__, drv->tCommon.tIniFile.uSize, -drv->tCommon.tIniFile.uSize);
        #endif
    }

    /* Free the driver object */
#ifdef TI_DBG
    tb_destroy();
#endif  
    kfree (drv);
}
/**
*
* mainKeys_create
*
* \b Description: 
*
* Allocate memory for the main security context, and create all the rest of the needed contexts.
*
* \b ARGS:
*
*  I - hOs - OS handle for OS operations.
*
* \b RETURNS:
*
*  pointer to main security context. If failed, returns NULL.
*
* \sa 
*/
mainKeys_t* mainKeys_create(TI_HANDLE hOs)
{
	mainKeys_t 	*pHandle;
	TI_STATUS		status;

	/* allocate association context memory */
	pHandle = (mainKeys_t*)os_memoryAlloc(hOs, sizeof(mainKeys_t));
	if (pHandle == NULL)
	{
		return NULL;
	}

	os_memoryZero(hOs, pHandle, sizeof(mainKeys_t));

	/* allocate memory for association state machine */
	status = fsm_Create(hOs, &pHandle->pMainKeysSm, MAIN_KEYS_NUM_STATES, MAIN_KEYS_NUM_EVENTS);
	if (status != OK)
	{
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->timer = os_timerCreate(hOs, mainKeys_sessionTimeout, pHandle);
	if (pHandle->timer == NULL)
	{
		fsm_Unload(hOs, pHandle->pMainKeysSm);
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->pKeyParser = keyParser_create(hOs);
	if (pHandle->pKeyParser == NULL)
	{
		os_timerDestroy(hOs, pHandle->timer);
		fsm_Unload(hOs, pHandle->pMainKeysSm);
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->pBcastSm = broadcastKey_create(hOs);
	if (pHandle->pBcastSm == NULL)
	{
		keyParser_unload(pHandle->pKeyParser);
		os_timerDestroy(hOs, pHandle->timer);
		fsm_Unload(hOs, pHandle->pMainKeysSm);
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}

	pHandle->pUcastSm = unicastKey_create(hOs);
	if (pHandle->pBcastSm == NULL)
	{
		broadcastKey_unload(pHandle->pBcastSm);
		keyParser_unload(pHandle->pKeyParser);
		os_timerDestroy(hOs, pHandle->timer);
		fsm_Unload(hOs, pHandle->pMainKeysSm);
		os_memoryFree(hOs, pHandle, sizeof(mainKeys_t));
		return NULL;
	}
    
	pHandle->hOs = hOs;
    
	/* At first Timeout we will send MediaSpecific Event   */
	/* At any other Timeout we will send the Timeout Event */

	pHandle->mainKeysTimeoutCounter = FALSE;
    
	return pHandle;
}
/** 
 * \fn     wlanDrvIf_Destroy
 * \brief  Destroy the driver instance
 * 
 * Destroy all driver modules.
 * Release driver OS resources (IRQ, workqueue, events socket)
 * Release driver network interface.
 * Free init files memory.
 * Free driver object.
 *
 * \note   
 * \param  drv - The driver object handle
 * \return void
 * \sa     wlanDrvIf_Create
 */ 
static void wlanDrvIf_Destroy (TWlanDrvIfObj *drv)
{
	if (!drv)
		return;

	if (drv->tiwlan_wq) {
		cancel_work_sync(&drv->tWork);
		flush_workqueue(drv->tiwlan_wq);
	}

	/* Release the driver network interface */
	if (drv->netdev) {
		netif_stop_queue  (drv->netdev);
		wlanDrvIf_Stop    (drv->netdev);
		unregister_netdev (drv->netdev);
		free_netdev (drv->netdev);
	}

	/* Destroy all driver modules */
	if (drv->tCommon.hDrvMain) {
		drvMain_Destroy (drv->tCommon.hDrvMain);
	}

	/* close the ipc_kernel socket*/
	if (drv && drv->wl_sock) 
	{
		sock_release (drv->wl_sock->sk_socket);
	}
	/* Release the driver interrupt (or polling timer) */
#ifdef PRIODIC_INTERRUPT
	os_timerDestroy (drv, drv->hPollTimer);
#else
	if (drv->irq)
	{
		hPlatform_freeInterrupt(drv);
	}
#endif

	if (drv->tiwlan_wq)
		destroy_workqueue(drv->tiwlan_wq);
		
#ifdef CONFIG_HAS_WAKELOCK
	wake_lock_destroy(&drv->wl_wifi);
	wake_lock_destroy(&drv->wl_rxwake);
#endif
	/* 
	 *  Free init files memory
	 */
    if (drv->tCommon.tFwImage.pImage)
    {
        os_memoryFree (drv, drv->tCommon.tFwImage.pImage, drv->tCommon.tFwImage.uSize);
        #ifdef TI_MEM_ALLOC_TRACE        
          os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", 
              __FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, -drv->tCommon.tFwImage.uSize);
        #endif
    }
    if (drv->tCommon.tNvsImage.pImage)
    {
        kfree (drv->tCommon.tNvsImage.pImage);
        #ifdef TI_MEM_ALLOC_TRACE        
          os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", 
              __FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, -drv->tCommon.tNvsImage.uSize);
        #endif
    }
    if (drv->tCommon.tIniFile.pImage)
    {
        kfree (drv->tCommon.tIniFile.pImage);
        #ifdef TI_MEM_ALLOC_TRACE        
          os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", 
              __FUNCTION__, __LINE__, drv->tCommon.tIniFile.uSize, -drv->tCommon.tIniFile.uSize);
        #endif
    }
    /* Free the driver object */
#ifdef TI_DBG
	tb_destroy();
#endif
	kfree (drv);
}