Esempio n. 1
0
/**
 * \fn     tmr_CreateTimer
 * \brief  Create a new timer
 *
 * Create a new timer object, icluding creating a timer in the OS-API.
 *
 * \note   This timer creation may be used only after tmr_Create() and tmr_Init() were executed!!
 * \param  hTimerModule - The module handle
 * \return TI_HANDLE    - The created timer handle
 * \sa     tmr_DestroyTimer
 */
TI_HANDLE tmr_CreateTimer (TI_HANDLE hTimerModule)
{
	TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */
	TTimerInfo   *pTimerInfo;  /* The created timer handle */

	if (!pTimerModule) {
		WLAN_OS_REPORT (("tmr_CreateTimer(): ERROR - NULL timer!\n"));
		return NULL;
	}

	/* Allocate timer object */
	pTimerInfo = os_memoryAlloc (pTimerModule->hOs, sizeof(TTimerInfo));
	if (!pTimerInfo) {
		WLAN_OS_REPORT (("tmr_CreateTimer():  Timer allocation failed!!\n"));
		return NULL;
	}
	os_memoryZero (pTimerModule->hOs, pTimerInfo, (sizeof(TTimerInfo)));

	/* Allocate OS-API timer, providing the common expiry callback with the current timer handle */
	pTimerInfo->hOsTimerObj = os_timerCreate(pTimerModule->hOs, tmr_GetExpiry, (TI_HANDLE)pTimerInfo);
	if (!pTimerInfo->hOsTimerObj) {
		os_memoryFree (pTimerModule->hOs, pTimerInfo, sizeof(TTimerInfo));
		WLAN_OS_REPORT (("tmr_CreateTimer():  OS-API Timer allocation failed!!\n"));
		return NULL;
	}

	/* Save the timer module handle in the created timer object (needed for the expiry callback) */
	pTimerInfo->hTimerModule = hTimerModule;
	pTimerModule->uTimersCount++;  /* count created timers */

	/* Return the created timer handle */
	return (TI_HANDLE)pTimerInfo;
}
void FW_DebugSendPacket(TI_HANDLE hDrvMain ,TI_HANDLE hOs, TI_HANDLE hTxMgmtQ, void *pParam)
{
	void *fSendPkt;

	if ( pParam == NULL ) {
		os_printf("\nFW_DebugSendPacket Error: received NULL parameter\n");
		return;
	}

	/* Open Tx path for all packet types */
	txMgmtQ_SetConnState (hTxMgmtQ, TX_CONN_STATE_MGMT);
	txMgmtQ_SetConnState (hTxMgmtQ, TX_CONN_STATE_EAPOL);
	txMgmtQ_SetConnState (hTxMgmtQ, TX_CONN_STATE_OPEN);

	infinitLoopFl	= 0;
	numOfPackets 	= 1;
	packetsNum 		= 1;
	packetLength    = *(TI_UINT32*)pParam;
	os_printf("\nFW_DebugSendPacket: packetsNum = %d, packetLength = %d\n",packetsNum, packetLength);
	fSendPkt = bSendDataPkt ? sendDataPacket : sendMgmtPacket;
	dTimer = os_timerCreate(hOs, fSendPkt, hDrvMain);
	os_timerStart(hOs, dTimer, 1000);

	SendFlag = TI_TRUE;
}
Esempio n. 3
0
/****************************************************************************
 *                      elpCtrl_Create()
 ****************************************************************************
 * DESCRIPTION: 
 * 
 * INPUTS:  hOs - the handle to the OS layer
 *          hReport - the handle to the report module 
 *      
 * 
 * OUTPUT:  the context of the ElpCtrl module
 * 
 * RETURNS: the context of the ElpCtrl module (NULL if error)
 ****************************************************************************/
TI_HANDLE elpCtrl_Create (TI_HANDLE hOs)
{
    elpCtrl_t *pElpCtrl;

    /* Create context */
    pElpCtrl = os_memoryAlloc (hOs, sizeof(elpCtrl_t));
    if (pElpCtrl == NULL)
    {
        WLAN_OS_REPORT (("%s: Error allocating object\n", __FUNCTION__));
        return NULL;        
    }
    os_memoryZero (hOs, pElpCtrl, sizeof(elpCtrl_t));

    pElpCtrl->hOs = hOs;
   
    /* Create timer */
    pElpCtrl->hTimer = os_timerCreate (hOs, elpCtrl_TimerTimeout, pElpCtrl);
    if (pElpCtrl->hTimer == NULL)
    {
        WLAN_OS_REPORT (("%s: Error in creating timer\n", __FUNCTION__));
        elpCtrl_Destroy (pElpCtrl);
        return NULL;
    }

    return pElpCtrl;
}
/**
*
* assoc_create - allocate memory for association SM
*
* \b Description: 
*
* Allocate memory for association SM. \n
* 		Allocates memory for Association context. \n
* 		Allocates memory for association timer. \n
* 		Allocates memory for association SM matrix. \n
*
* \b ARGS:
*
*  I   - hOs - OS context  \n
*
* \b RETURNS:
*
*  OK if successful, NOK otherwise.
*
* \sa rsn_mainSecSmKeysOnlyStop()
*/
TI_HANDLE assoc_create(TI_HANDLE hOs)
{
	assoc_t 	*pHandle;
	TI_STATUS		status;

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

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

	pHandle->hOs = hOs;

	/* allocate memory for association state machine */
	status = fsm_Create(hOs, &pHandle->pAssocSm, ASSOC_SM_NUM_STATES, ASSOC_SM_NUM_EVENTS);
	if (status != OK)
	{
		os_memoryFree(hOs, pHandle, sizeof(assoc_t));
		return NULL;
	}

	/* allocate OS timer memory */
	pHandle->timer = os_timerCreate(hOs, assoc_smTimeout, pHandle);
	if (pHandle->timer == NULL)
	{
		fsm_Unload(hOs, pHandle->pAssocSm);
		os_memoryFree(hOs, pHandle, sizeof(assoc_t));		
		return NULL;
	}

	return pHandle;
}
/**
 * \author Yuval Adler\n
 * \date 16-Oct-2004\n
 * \brief Creates the scan SRV object
 *
 * Function Scope \e Public.\n
 * \param hOS - handle to the OS object.\n
 * \return a handle to the scan SRV object, NULL if an error occurred.\n
 */
TI_HANDLE MacServices_scanSRV_create( TI_HANDLE hOS )
{
    /* allocate the scan SRV object */
    scanSRV_t *pScanSRV = os_memoryAlloc( hOS, sizeof(scanSRV_t) );
    if ( NULL == pScanSRV )
    {
        WLAN_OS_REPORT( ("ERROR: Failed to create scan SRV module") );
        return NULL;
    }

    /* allocate the state machine */
    if ( OK != fsm_Create( hOS, &(pScanSRV->SM), SCAN_SRV_NUM_OF_STATES, SCAN_SRV_NUM_OF_EVENTS ) )
    {
        WLAN_OS_REPORT( ("ERROR: Failed to allocate scan SRV state machine") );
        os_memoryFree( hOS, pScanSRV, sizeof(scanSRV_t) );
        return NULL;
    }

    /* create the timer */
    pScanSRV->timer = os_timerCreate( hOS, MacServices_scanSRV_scanTimerExpired, pScanSRV );
    if ( NULL == pScanSRV->timer )
    {
        WLAN_OS_REPORT( ("ERROR: Failed to create timer for scan SRV module") );
        fsm_Unload( hOS, pScanSRV->SM );
        os_memoryFree( hOS, pScanSRV, sizeof(scanSRV_t) );
        return NULL;
    }

    /* store the OS handle */
    pScanSRV->hOS = hOS;

    return pScanSRV;
}
void FW_DebugInfinitSendPacket(TI_HANDLE hDrvMain ,TI_HANDLE hOs)
{
	infinitLoopFl = 1;
	numOfPackets = 1;

	dTimer = os_timerCreate(hOs, sendMgmtPacket, hDrvMain);
	os_timerStart(hOs, dTimer, 1000);
	SendFlag = TI_TRUE;
}
Esempio n. 7
0
/** 
 * \fn     wlanDrvIf_Create
 * \brief  Create the driver instance
 * 
 * Allocate driver object.
 * Initialize driver OS resources (IRQ, workqueue, events socket)
 * Setup driver network interface.
 * Create and link all driver modules.
 *
 * \note   
 * \param  void
 * \return 0 - OK, else - failure
 * \sa     wlanDrvIf_Destroy
 */ 
static int wlanDrvIf_Create (void)
{
    TWlanDrvIfObj *drv;
    int rc;

    /* Allocate driver's structure */
    drv = kmalloc (sizeof(TWlanDrvIfObj), GFP_KERNEL);
    if (!drv)
    {
        return -ENOMEM;
    }
#ifdef TI_DBG
    tb_init(TB_OPTION_NONE);
#endif
    pDrvStaticHandle = drv;  /* save for module destroy */
    #ifdef TI_MEM_ALLOC_TRACE        
      os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(TWlanDrvIfObj), GFP_KERNEL, sizeof(TWlanDrvIfObj));
    #endif
    memset (drv, 0, sizeof(TWlanDrvIfObj));
/*
#if defined HOST_PLATFORM_OMAP3430 || defined HOST_PLATFORM_ZOOM2 || defined HOST_PLATFORM_ZOOM1

	if(g_external_board)
	{
		WLAN_OS_REPORT(("\nZoom2 use external board"));
		drv->irq = (OMAP_GPIO_IRQ(IRQ_GPIO_EXT));
	}
	else
	{
		drv->irq = (OMAP_GPIO_IRQ(IRQ_GPIO));
	}
#endif   
*/
    drv->irq = tiwlan_ext_int_init(); 

    drv->tCommon.eDriverState = DRV_STATE_IDLE;
#ifdef AP_MODE_ENABLED
    /* for STA role, need to allocate another driver and to set STA role */
    drv->tCommon.eIfRole = IF_ROLE_TYPE_AP;
#endif

    drv->pWorkQueue = create_singlethread_workqueue (TIWLAN_DRV_NAME);
    if (!drv->pWorkQueue)
    {
        return -ENOMEM; 
    }

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
    INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask, (void *)drv);
#else
    INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask);
#endif
    spin_lock_init (&drv->lock);

    /* Setup driver network interface. */
    rc = wlanDrvIf_SetupNetif (drv);
    if (rc)
    {
        kfree (drv);
        return rc;
    }
   

    /* Create the events socket interface */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
    drv->wl_sock = netlink_kernel_create( NETLINK_USERSOCK, 0, NULL, THIS_MODULE );
#else
        drv->wl_sock = netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0, NULL, NULL, THIS_MODULE );
#endif
    if (drv->wl_sock == NULL)
    {
        ti_dprintf (TIWLAN_LOG_ERROR, "netlink_kernel_create() failed !\n");
        return -EINVAL;
    }

    /* Create all driver modules and link their handles */
    drvMain_Create (drv, 
                    &drv->tCommon.hDrvMain, 
                    &drv->tCommon.hCmdHndlr, 
                    &drv->tCommon.hContext, 
                    &drv->tCommon.hTxDataQ,
                    &drv->tCommon.hTxMgmtQ,
                    &drv->tCommon.hTxCtrl,
                    &drv->tCommon.hTWD,
                    &drv->tCommon.hEvHandler,
                    &drv->tCommon.hCmdDispatch,
                    &drv->tCommon.hReport);

    /* 
     *  Initialize interrupts (or polling mode for debug):
     */
#ifdef PRIODIC_INTERRUPT
    /* Debug mode: Polling (the timer is started by HwInit process) */
    drv->hPollTimer = os_timerCreate ((TI_HANDLE)drv, wlanDrvIf_PollIrqHandler, (TI_HANDLE)drv);
#else 
    /* Normal mode: Interrupts (the default mode) */
    rc = hPlatform_initInterrupt (drv, (void*)wlanDrvIf_HandleInterrupt);
    if (rc)
    {
        ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to register interrupt handler!\n");
        return rc;
    }
#ifdef  HOST_PLATFORM_OMAP2430
    set_irq_type (drv->irq, IRQT_FALLING);
#endif
#endif  /* PRIODIC_INTERRUPT */

   return 0;
}
/**
*
* 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_Create
 * \brief  Create the driver instance
 * 
 * Allocate driver object.
 * Initialize driver OS resources (IRQ, workqueue, events socket)
 * Setup driver network interface.
 * Create and link all driver modules.
 *
 * \note   
 * \param  void
 * \return 0 - OK, else - failure
 * \sa     wlanDrvIf_Destroy
 */ 
static int wlanDrvIf_Create (void)
{
	TWlanDrvIfObj *drv; /* Dm: Failure is not cleaned properly !!! */
	int rc;

	/* Allocate driver's structure */
	drv = kmalloc (sizeof(TWlanDrvIfObj), GFP_KERNEL);
    if (!drv)
    {
		return -ENOMEM;
	}
#ifdef TI_DBG
	tb_init(TB_OPTION_NONE);
#endif
	pDrvStaticHandle = drv;  /* save for module destroy */
#ifdef TI_MEM_ALLOC_TRACE        
	os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(TWlanDrvIfObj), GFP_KERNEL, sizeof(TWlanDrvIfObj));
#endif
	memset (drv, 0, sizeof(TWlanDrvIfObj));

	/* Dm:    drv->irq = TNETW_IRQ; */
	drv->tCommon.eDriverState = DRV_STATE_IDLE;

	drv->tiwlan_wq = create_freezeable_workqueue(DRIVERWQ_NAME);
	if (!drv->tiwlan_wq) {
		ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to create workQ!\n");
		rc = -EINVAL;
		goto drv_create_end_1;
	}
	drv->wl_packet = 0;
	drv->wl_count = 0;
#ifdef CONFIG_HAS_WAKELOCK
	wake_lock_init(&drv->wl_wifi, WAKE_LOCK_SUSPEND, "wifi_wake");
	wake_lock_init(&drv->wl_rxwake, WAKE_LOCK_SUSPEND, "wifi_rx_wake");
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
	INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask, (void *)drv);
#else
	INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask);
#endif
	spin_lock_init (&drv->lock);

	/* Setup driver network interface. */
	rc = wlanDrvIf_SetupNetif (drv);
	if (rc)	{
		goto drv_create_end_2;
	}

	/* Create the events socket interface */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
	drv->wl_sock = netlink_kernel_create( NETLINK_USERSOCK, 0, NULL, THIS_MODULE );
#else
	drv->wl_sock = netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0, NULL, NULL, THIS_MODULE );
#endif
	if (drv->wl_sock == NULL) {
	        ti_dprintf (TIWLAN_LOG_ERROR, "netlink_kernel_create() failed !\n");
		rc = -EINVAL;
		goto drv_create_end_3;
	}

	/* Create all driver modules and link their handles */
	rc = drvMain_Create (drv,
			&drv->tCommon.hDrvMain,
			&drv->tCommon.hCmdHndlr,
			&drv->tCommon.hContext,
			&drv->tCommon.hTxDataQ,
			&drv->tCommon.hTxMgmtQ,
			&drv->tCommon.hTxCtrl,
			&drv->tCommon.hTWD,
					&drv->tCommon.hEvHandler,
                    &drv->tCommon.hCmdDispatch,
		&drv->tCommon.hReport);
	if (rc != TI_OK) {
		ti_dprintf (TIWLAN_LOG_ERROR, "%s: Failed to dvrMain_Create!\n", __func__);
		rc = -EINVAL;
		goto drv_create_end_4;
	}
	/*
	 *  Initialize interrupts (or polling mode for debug):
	 */
#ifdef PRIODIC_INTERRUPT
	/* Debug mode: Polling (the timer is started by HwInit process) */
	drv->hPollTimer = os_timerCreate ((TI_HANDLE)drv, wlanDrvIf_PollIrqHandler, (TI_HANDLE)drv);
#else 
	/* Normal mode: Interrupts (the default mode) */
	rc = hPlatform_initInterrupt (drv, (void*)wlanDrvIf_HandleInterrupt);
#if 1 //wait to debug
	if (rc)	{
		ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to register interrupt handler!\n");
		goto drv_create_end_5;
	}
#endif
#endif  /* PRIODIC_INTERRUPT */
	return 0;
#if 1 //wait to debug
drv_create_end_5:
	/* Destroy all driver modules */
	if (drv->tCommon.hDrvMain) {
		drvMain_Destroy (drv->tCommon.hDrvMain);
	}
#endif
drv_create_end_4:
	if (drv->wl_sock) {
		sock_release (drv->wl_sock->sk_socket);
	}

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

drv_create_end_2:
#ifdef CONFIG_HAS_WAKELOCK
	wake_lock_destroy(&drv->wl_wifi);
	wake_lock_destroy(&drv->wl_rxwake);
#endif
	if (drv->tiwlan_wq)
		destroy_workqueue(drv->tiwlan_wq);

drv_create_end_1:
	kfree(drv);
	printk("%s: Fail\n", __func__);
	return rc;
}
Esempio n. 10
0
/**
 * \fn     wlanDrvIf_Create
 * \brief  Create the driver instance
 *
 * Allocate driver object.
 * Initialize driver OS resources (IRQ, workqueue, events socket)
 * Setup driver network interface.
 * Create and link all driver modules.
 *
 * \note
 * \param  void
 * \return 0 - OK, else - failure
 * \sa     wlanDrvIf_Destroy
 */
static int wlanDrvIf_Create (void)
{
	TWlanDrvIfObj *drv;
	int rc;

	/* Allocate driver's structure */
	drv = kmalloc (sizeof(TWlanDrvIfObj), GFP_KERNEL);
	if (!drv)
	{
		return -ENOMEM;
	}
#ifdef TI_DBG
	tb_init(TB_OPTION_NONE);
#endif
	pDrvStaticHandle = drv;  /* save for module destroy */
#ifdef TI_MEM_ALLOC_TRACE
	os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(TWlanDrvIfObj), GFP_KERNEL, sizeof(TWlanDrvIfObj));
#endif
	memset (drv, 0, sizeof(TWlanDrvIfObj));

	drv->tCommon.eDriverState = DRV_STATE_IDLE;

	drv->pWorkQueue = create_singlethread_workqueue(TIWLAN_WQ_NAME);
	if (!drv->pWorkQueue)
	{
		return -ENOMEM;
	}

	drv->wl_packet = 0;
	drv->wl_count = 0;
#ifdef CONFIG_HAS_WAKELOCK
	wake_lock_init(&drv->wl_wifi, WAKE_LOCK_SUSPEND, "wifi_wake");
	wake_lock_init(&drv->wl_rxwake, WAKE_LOCK_SUSPEND, "wifi_rx_wake");
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
	INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask, (void *)drv);
#else
	INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask);
#endif
	spin_lock_init (&drv->lock);

	/* Setup driver network interface. */
	rc = wlanDrvIf_SetupNetif (drv);
	if (rc)
	{
		kfree (drv);
		return rc;
	}


	/* Create the events socket interface */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
	drv->wl_sock = netlink_kernel_create( NETLINK_USERSOCK, 0, NULL, THIS_MODULE );
#else
	drv->wl_sock = netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0, NULL, NULL, THIS_MODULE );
#endif
	if (drv->wl_sock == NULL)
	{
		ti_dprintf (TIWLAN_LOG_ERROR, "netlink_kernel_create() failed !\n");
		return -EINVAL;
	}

	/* Create all driver modules and link their handles */
	drvMain_Create (drv,
	                &drv->tCommon.hDrvMain,
	                &drv->tCommon.hCmdHndlr,
	                &drv->tCommon.hContext,
	                &drv->tCommon.hTxDataQ,
	                &drv->tCommon.hTxMgmtQ,
	                &drv->tCommon.hTxCtrl,
	                &drv->tCommon.hTWD,
	                &drv->tCommon.hEvHandler,
	                &drv->tCommon.hCmdDispatch,
	                &drv->tCommon.hReport);

	/*
	 *  Initialize interrupts (or polling mode for debug):
	 */
#ifdef PRIODIC_INTERRUPT
	/* Debug mode: Polling (the timer is started by HwInit process) */
	drv->hPollTimer = os_timerCreate ((TI_HANDLE)drv, wlanDrvIf_PollIrqHandler, (TI_HANDLE)drv);
#else
	/* Normal mode: Interrupts (the default mode) */
	rc = hPlatform_initInterrupt (drv, (void*)wlanDrvIf_HandleInterrupt);
	if (rc)
	{
		ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to register interrupt handler!\n");
		return rc;
	}
#endif  /* PRIODIC_INTERRUPT */

#ifdef CONFIG_PM
	/* register PM hooks in our SDIO driver */
	sdioDrv_register_pm(wlanDrvIf_Resume, wlanDrvIf_Suspend);
#endif


	return 0;
}