Exemple #1
0
/** 
 * \fn     wlanDrvIf_Open
 * \brief  Start driver
 * 
 * Called by network stack upon opening network interface (ifconfig up).
 * Can also be called from user application or CLI for flight mode.
 * Start the driver initialization process up to OPERATIONAL state.
 *
 * \note   
 * \param  dev - The driver network-interface handle
 * \return 0 if succeeded, error if driver not available
 * \sa     wlanDrvIf_Release
 */ 
int wlanDrvIf_Open (struct net_device *dev)
{
    TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev);

    ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Open()\n");

    if (!drv->tCommon.hDrvMain)
    {
        ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Open() Driver not created!\n");
        return -ENODEV;
    }
    if (drv->tCommon.eDriverState == DRV_STATE_FAILED) 
    {
        ti_dprintf (TIWLAN_LOG_ERROR, "Driver in FAILED state!\n");
        return -EPERM;
    }
    if (drv->tCommon.eDriverState != DRV_STATE_RUNNING) 
	{
        wlanDrvIf_Start(dev);
    }

#ifndef AP_MODE_ENABLED 
	netif_start_queue (dev); /* Temporal, use wlanDrvIf_Enable/DisableTx in STA mode */
#endif

    /* register 3430 PM hooks in our SDIO driver */
#ifdef CONFIG_PM
    /*sdioDrv_register_pm(wlanDrvIf_pm_resume, wlanDrvIf_pm_suspend);*/
#endif

    return 0;
}
int wlanDrvIf_Open (struct net_device *dev)
{
	TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev);
	int status = 0;

	ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Open()\n");
	printk("%s\n", __func__);
	if (!drv->tCommon.hDrvMain) {
		ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Open() Driver not created!\n");
		return -ENODEV;
	}

	if (drv->tCommon.eDriverState == DRV_STATE_STOPPED ||
	    drv->tCommon.eDriverState == DRV_STATE_IDLE) {
		status = wlanDrvIf_Start(dev);
	}

	/*
	 *  Finalize network interface setup
	 */
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31))
	drv->netdev->hard_start_xmit = wlanDrvIf_Xmit;
#else
	drv->netdev->netdev_ops = &tiwlan_ops_pri;
#endif
	drv->netdev->addr_len = MAC_ADDR_LEN;
	netif_start_queue (dev);

	return status;
}
Exemple #3
0
/**
 * \fn     wlanDrvIf_Open
 * \brief  Start driver
 *
 * Called by network stack upon opening network interface (ifconfig up).
 * Can also be called from user application or CLI for flight mode.
 * Start the driver initialization process up to OPERATIONAL state.
 *
 * \note
 * \param  dev - The driver network-interface handle
 * \return 0 if succeeded, error if driver not available
 * \sa     wlanDrvIf_Release
 */
int wlanDrvIf_Open (struct net_device *dev)
{
    TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev);
    int status = 0;
    WLAN_OS_REPORT(("wlanDrvIf_Open()\n"));

    if (!drv->tCommon.hDrvMain)
    {
        ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Open() Driver not created!\n");
        return -ENODEV;
    }
    if (drv->tCommon.eDriverState == DRV_STATE_FAILED)
    {
        ti_dprintf (TIWLAN_LOG_ERROR, "Driver in FAILED state!\n");
        return -EPERM;
    }
    if (drv->tCommon.eDriverState != DRV_STATE_RUNNING)
    {
	status = wlanDrvIf_Start(dev);
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31))
	drv->netdev->hard_start_xmit = wlanDrvIf_Xmit;
#else
	drv->netdev->netdev_ops = &tiwlan_ops_pri;
#endif
	drv->netdev->addr_len = MAC_ADDR_LEN;
    netif_start_queue (dev);

    }
	return status;
}
Exemple #4
0
int wlanDrvIf_Open (struct net_device *dev)
{
	TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev);
	WLAN_OS_REPORT(("wlanDrvIf_Open()\n"));
	if (!drv->tCommon.hDrvMain)
	{
		ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Open() Driver not created!\n");
		return -ENODEV;
	}

	wlanDrvIf_Start(dev);
	/*
	 *  Finalize network interface setup
	 */
	drv->netdev->hard_start_xmit = wlanDrvIf_Xmit;
	drv->netdev->addr_len = MAC_ADDR_LEN;
	netif_start_queue (dev);

	return 0;
}
Exemple #5
0
static int wlanDrvIf_pm_resume(void)
{
    return(wlanDrvIf_Start(pDrvStaticHandle->netdev));
}
Exemple #6
0
int wlanDrvWext_Handler (struct net_device *dev,
                     struct iw_request_info *info, 
                     void *iw_req, 
                     void *extra)
{
   int              rc;
   TWlanDrvIfObj   *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev);
   ti_private_cmd_t my_command; 
   struct iw_mlme   mlme;
   void             *copy_to_buf=NULL, *param3=NULL;
   ECmdType         CmdType = CMD_WEXT_CMD_E;

#if 0
   /* abort if the IOCTL is disabled */
   if (!wlanDrvIf_IsIoctlEnabled(drv, info->cmd))
   {
	   return TI_NOK;
   }
#endif

   os_memoryZero(drv, &my_command, sizeof(ti_private_cmd_t));
   os_memoryZero(drv, &mlme,       sizeof(struct iw_mlme));

   switch (info->cmd)
   {
   case SIOCIWFIRSTPRIV:
   case SIOCIWAPPRIV:
     {
	   void *copy_from_buf;

       if (os_memoryCopyFromUser(drv, &my_command, ((union iwreq_data *)iw_req)->data.pointer, sizeof(ti_private_cmd_t)))
	   {
		 os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser FAILED !!!\n");
		 return TI_NOK;
	   }

#if 0
       /* abort if the private-command is disabled */
       if (!wlanDrvIf_IsCmdEnabled(drv, my_command.cmd))
       {
		return TI_NOK;
       }
#endif

	   if (IS_PARAM_FOR_MODULE(my_command.cmd, DRIVER_MODULE_PARAM))
       {
		   /* If it's a driver level command, handle it here and exit */
           switch (my_command.cmd)
           {
           case DRIVER_INIT_PARAM:
               return wlanDrvIf_LoadFiles (drv, my_command.in_buffer);
                
           case DRIVER_START_PARAM:
               return wlanDrvIf_Start (dev);

           case DRIVER_STOP_PARAM:
               return wlanDrvIf_Stop (dev);

           case DRIVER_STATUS_PARAM:
               *(TI_UINT32 *)my_command.out_buffer = 
                   (drv->tCommon.eDriverState == DRV_STATE_RUNNING) ? TI_TRUE : TI_FALSE;
               return TI_OK;
           }
       }
	   /* if we are still here handle a normal private command*/

	   if ((my_command.in_buffer) && (my_command.in_buffer_len))
       {
		 copy_from_buf        = my_command.in_buffer;
		 my_command.in_buffer = os_memoryAlloc(drv, my_command.in_buffer_len);
		 if (os_memoryCopyFromUser(drv, my_command.in_buffer, copy_from_buf, my_command.in_buffer_len))
		 {
		   os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser 1 FAILED !!!\n");
		   return TI_NOK;
		 }
	   }
       if ((my_command.out_buffer) && (my_command.out_buffer_len))
	   {
		 copy_to_buf          = my_command.out_buffer;
		 my_command.out_buffer = os_memoryAlloc(drv, my_command.out_buffer_len);
	   }
	   param3 = &my_command;

      switch (info->cmd)
      {
      case SIOCIWFIRSTPRIV:
           CmdType = CMD_WEXT_CMD_E;
           break;
      case SIOCIWAPPRIV:
           CmdType = CMD_AP_CMD_E;
           break;
      default:
          os_printf ("wlanDrvWext_Handler() illegal command !!!\n");
          break;
      }
     }
	 break;

     case SIOCSIWMLME:
     {
		os_memoryCopyFromUser(drv, &mlme, ((union iwreq_data *)iw_req)->data.pointer, sizeof(struct iw_mlme));
		param3 = &mlme;
        CmdType = CMD_WEXT_CMD_E;
     }
	 break;
     case SIOCSIWGENIE:
     {
         TI_UINT16 ie_length = ((union iwreq_data *)iw_req)->data.length;
         TI_UINT8 *ie_content = ((union iwreq_data *)iw_req)->data.pointer;

         if ((ie_length == 0) && (ie_content == NULL)) {
                 /* Do nothing, deleting the IE */
         } else if ((ie_content != NULL) && (ie_length <= RSN_MAX_GENERIC_IE_LENGTH) && (ie_length > 0)) { 
                 /* One IE cannot be larger than RSN_MAX_GENERIC_IE_LENGTH bytes */
                 my_command.in_buffer = os_memoryAlloc(drv, ie_length);
                 os_memoryCopyFromUser(drv, my_command.in_buffer, ie_content, ie_length );
                 param3 = my_command.in_buffer;
         } else {
                 return TI_NOK;
         }

       CmdType = CMD_WEXT_CMD_E;
     }
	 break;
   }

   
   /* If the friver is not running, return NOK */
   if (drv->tCommon.eDriverState != DRV_STATE_RUNNING)
   {
       return TI_NOK;
   }

   /* Call the Cmd module with the given user paramters */
   rc = (cmdHndlr_InsertCommand (drv->tCommon.hCmdHndlr, 
                                   info->cmd, 
                                   info->flags, 
                                   iw_req, 
                                   0, 
                                   extra, 
                                   0, 
                                   param3, 
                                   NULL,
                                   CmdType ));
   /* Here we are after the command was completed */
   if (my_command.in_buffer)
   {
	 os_memoryFree (drv, my_command.in_buffer, my_command.in_buffer_len);
   }
   if (my_command.out_buffer)
   {
	 if (os_memoryCopyToUser(drv, copy_to_buf, my_command.out_buffer, my_command.out_buffer_len))
	 {
	   os_printf ("wlanDrvWext_Handler() os_memoryCopyToUser FAILED !!!\n");
	   rc = TI_NOK;
	 }
	 os_memoryFree (drv, my_command.out_buffer, my_command.out_buffer_len);
   }

   return rc;
}