Ejemplo n.º 1
0
/** 
 *  @brief This function opens the network device
 *  
 *  @param dev     A pointer to net_device structure
 *  @return        WLAN_STATUS_SUCCESS
 */
static int
wlan_open(struct net_device *dev)
{
    wlan_private *priv = (wlan_private *) netdev_priv(dev);
    wlan_adapter *adapter = priv->adapter;

    ENTER();

    /* On some systems the device open handler will be called before HW ready.
       Use the following flag check and wait function to work around the issue. */
    {
        int i = 0;

        while ((adapter->HardwareStatus != WlanHardwareStatusReady) &&
               (i < MAX_WAIT_DEVICE_READY_COUNT)) {
            i++;
            os_sched_timeout(100);
        }
        if (i >= MAX_WAIT_DEVICE_READY_COUNT) {
            PRINTM(FATAL, "HW not ready, wlan_open() return failure\n");
            LEAVE();
            return WLAN_STATUS_FAILURE;
        }
    }

    if (MODULE_GET == 0) {
        LEAVE();
        return WLAN_STATUS_FAILURE;
    }

    priv->open = TRUE;

    if ((adapter->MediaConnectStatus == WlanMediaStateConnected)
        && (adapter->InfrastructureMode != Wlan802_11IBSS
            || adapter->AdhocLinkSensed == TRUE))
        os_carrier_on(priv);
    else
        os_carrier_off(priv);

    os_start_queue(priv);
    wmm_start_queue(priv);

    LEAVE();
    return WLAN_STATUS_SUCCESS;
}
Ejemplo n.º 2
0
/** 
 *  @brief This function opens the network device
 *  
 *  @param dev     A pointer to net_device structure
 *  @return 	   WLAN_STATUS_SUCCESS
 */
int
wlan_open(struct eth_drv_sc *sc)
{
    wlan_private *priv = (wlan_private *) sc->driver_private;
    wlan_adapter *adapter = priv->adapter;

    ENTER();

//    MODULE_GET;

    priv->open = TRUE;
#if 0
    if (adapter->MediaConnectStatus == WlanMediaStateConnected)
        os_carrier_on(priv);
    else
        os_carrier_off(priv);

    os_start_queue(priv);
#endif
    LEAVE();
    return WLAN_STATUS_SUCCESS;
}