//============================================================================
#include <linux/usb.h>
+#include "core.h"
#include "sysdef.h"
#include "wb35rx_f.h"
-void Wb35Rx_start(phw_data_t pHwData)
+void Wb35Rx_start(struct ieee80211_hw *hw)
{
+ struct wbsoft_priv *priv = hw->priv;
+ phw_data_t pHwData = &priv->sHwData;
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
// Allow only one thread to run into the Wb35Rx() function
if (atomic_inc_return(&pWb35Rx->RxFireCounter) == 1) {
pWb35Rx->EP3vm_state = VM_RUNNING;
- Wb35Rx(pHwData);
+ Wb35Rx(hw);
} else
atomic_dec(&pWb35Rx->RxFireCounter);
}
// This function cannot reentrain
-void Wb35Rx( phw_data_t pHwData )
+void Wb35Rx(struct ieee80211_hw *hw)
{
+ struct wbsoft_priv *priv = hw->priv;
+ phw_data_t pHwData = &priv->sHwData;
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
u8 * pRxBufferAddress;
struct urb *urb = pWb35Rx->RxUrb;
usb_fill_bulk_urb(urb, pHwData->WbUsb.udev,
usb_rcvbulkpipe(pHwData->WbUsb.udev, 3),
pRxBufferAddress, MAX_USB_RX_BUFFER,
- Wb35Rx_Complete, pHwData);
+ Wb35Rx_Complete, hw);
pWb35Rx->EP3vm_state = VM_RUNNING;
void Wb35Rx_Complete(struct urb *urb)
{
- phw_data_t pHwData = urb->context;
+ struct ieee80211_hw *hw = urb->context;
+ struct wbsoft_priv *priv = hw->priv;
+ phw_data_t pHwData = &priv->sHwData;
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
u8 * pRxBufferAddress;
u32 SizeCheck;
pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength;
if (!pWb35Rx->RxOwner[ RxBufferId ])
- Wb35Rx_indicate(pHwData);
+ Wb35Rx_indicate(hw);
kfree(pWb35Rx->pDRx);
// Do the next receive
- Wb35Rx(pHwData);
+ Wb35Rx(hw);
return;
error:
pRxDes->buffer_size[0] = BufferSize;
}
-extern void packet_came(char *pRxBufferAddress, int PacketSize);
+extern void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize);
-u16 Wb35Rx_indicate(phw_data_t pHwData)
+u16 Wb35Rx_indicate(struct ieee80211_hw *hw)
{
+ struct wbsoft_priv *priv = hw->priv;
+ phw_data_t pHwData = &priv->sHwData;
DESCRIPTOR RxDes;
PWB35RX pWb35Rx = &pHwData->Wb35Rx;
u8 * pRxBufferAddress;
RxDes.buffer_total_size = RxDes.buffer_size[0];
Wb35Rx_adjust(&RxDes);
- packet_came(pRxBufferAddress, PacketSize);
+ packet_came(hw, pRxBufferAddress, PacketSize);
// Move RxBuffer point to the next
stmp = PacketSize + 3;
#ifndef __WINBOND_WB35RX_F_H
#define __WINBOND_WB35RX_F_H
+#include <net/mac80211.h>
#include "wbhal_s.h"
//====================================
unsigned char Wb35Rx_initial( phw_data_t pHwData );
void Wb35Rx_destroy( phw_data_t pHwData );
void Wb35Rx_stop( phw_data_t pHwData );
-u16 Wb35Rx_indicate( phw_data_t pHwData );
+u16 Wb35Rx_indicate(struct ieee80211_hw *hw);
void Wb35Rx_adjust( PDESCRIPTOR pRxDes );
-void Wb35Rx_start( phw_data_t pHwData );
+void Wb35Rx_start(struct ieee80211_hw *hw);
-void Wb35Rx( phw_data_t pHwData );
+void Wb35Rx(struct ieee80211_hw *hw);
void Wb35Rx_Complete(struct urb *urb);
#endif
add_timer(&pHwData->LEDTimer);
}
-
-u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
+u8 hal_init_hardware(struct ieee80211_hw *hw)
{
+ struct wbsoft_priv *priv = hw->priv;
+ phw_data_t pHwData = &priv->sHwData;
u16 SoftwareSet;
// Initial the variable
pHwData->InitialResource = 4;
init_timer(&pHwData->LEDTimer);
pHwData->LEDTimer.function = hal_led_control;
- pHwData->LEDTimer.data = (unsigned long) adapter;
+ pHwData->LEDTimer.data = (unsigned long) priv;
pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(1000);
add_timer(&pHwData->LEDTimer);
return false;
#endif
- Wb35Rx_start( pHwData );
- Wb35Tx_EP2VM_start(adapter);
+ Wb35Rx_start(hw);
+ Wb35Tx_EP2VM_start(priv);
return true;
}
void hal_get_ethernet_address( phw_data_t pHwData, u8 *current_address );
void hal_set_ethernet_address( phw_data_t pHwData, u8 *current_address );
void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address );
-unsigned char hal_init_hardware( phw_data_t pHwData, struct wbsoft_priv * adapter );
+u8 hal_init_hardware(struct ieee80211_hw *hw);
void hal_set_power_save_mode( phw_data_t pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim );
void hal_get_power_save_mode( phw_data_t pHwData, u8 *pin_pwr_save );
void hal_set_slot_time( phw_data_t pHwData, u8 type );
}
unsigned char
-WbWLanInitialize(struct wbsoft_priv * adapter)
+WbWLanInitialize(struct ieee80211_hw *hw)
{
+ struct wbsoft_priv *priv = hw->priv;
phw_data_t pHwData;
u8 *pMacAddr;
u8 *pMacAddr2;
//
// Setting default value for Linux
//
- adapter->sLocalPara.region_INF = REGION_AUTO;
- adapter->sLocalPara.TxRateMode = RATE_AUTO;
- psLOCAL->bMacOperationMode = MODE_802_11_BG; // B/G mode
- adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold;
- adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD;
- hal_set_phy_type( &adapter->sHwData, RF_WB_242_1 );
- adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE;
- psLOCAL->bPreambleMode = AUTO_MODE;
- adapter->sLocalPara.RadioOffStatus.boSwRadioOff = false;
- pHwData = &adapter->sHwData;
+ priv->sLocalPara.region_INF = REGION_AUTO;
+ priv->sLocalPara.TxRateMode = RATE_AUTO;
+ priv->sLocalPara.bMacOperationMode = MODE_802_11_BG; // B/G mode
+ priv->Mds.TxRTSThreshold = DEFAULT_RTSThreshold;
+ priv->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD;
+ hal_set_phy_type( &priv->sHwData, RF_WB_242_1 );
+ priv->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE;
+ priv->sLocalPara.bPreambleMode = AUTO_MODE;
+ priv->sLocalPara.RadioOffStatus.boSwRadioOff = false;
+ pHwData = &priv->sHwData;
hal_set_phy_type( pHwData, RF_DECIDE_BY_INF );
//
// Initial each module and variable
//
- if (!WBLINUX_Initial(adapter)) {
+ if (!WBLINUX_Initial(priv)) {
#ifdef _PE_USB_INI_DUMP_
WBDEBUG(("[w35und]WBNDIS initialization failed\n"));
#endif
}
// Initial Software variable
- adapter->sLocalPara.ShutDowned = false;
+ priv->sLocalPara.ShutDowned = false;
//added by ws for wep key error detection
- adapter->sLocalPara.bWepKeyError= false;
- adapter->sLocalPara.bToSelfPacketReceived = false;
- adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds
+ priv->sLocalPara.bWepKeyError= false;
+ priv->sLocalPara.bToSelfPacketReceived = false;
+ priv->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds
// Initial USB hal
InitStep = 1;
- pHwData = &adapter->sHwData;
- if (!hal_init_hardware(pHwData, adapter))
+ pHwData = &priv->sHwData;
+ if (!hal_init_hardware(hw))
goto error;
EEPROM_region = hal_get_region_from_EEPROM( pHwData );
if (EEPROM_region != REGION_AUTO)
- psLOCAL->region = EEPROM_region;
+ priv->sLocalPara.region = EEPROM_region;
else {
- if (psLOCAL->region_INF != REGION_AUTO)
- psLOCAL->region = psLOCAL->region_INF;
+ if (priv->sLocalPara.region_INF != REGION_AUTO)
+ priv->sLocalPara.region = priv->sLocalPara.region_INF;
else
- psLOCAL->region = REGION_USA; //default setting
+ priv->sLocalPara.region = REGION_USA; //default setting
}
// Get Software setting flag from hal
- adapter->sLocalPara.boAntennaDiversity = false;
+ priv->sLocalPara.boAntennaDiversity = false;
if (hal_software_set(pHwData) & 0x00000001)
- adapter->sLocalPara.boAntennaDiversity = true;
+ priv->sLocalPara.boAntennaDiversity = true;
//
// For TS module
// For MDS module
InitStep = 3;
- Mds_initial(adapter);
+ Mds_initial(priv);
//=======================================
// Initialize the SME, SCAN, MLME, ROAM
InitStep = 6;
// If no user-defined address in the registry, use the addresss "burned" on the NIC instead.
- pMacAddr = adapter->sLocalPara.ThisMacAddress;
- pMacAddr2 = adapter->sLocalPara.PermanentAddress;
- hal_get_permanent_address( pHwData, adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM
+ pMacAddr = priv->sLocalPara.ThisMacAddress;
+ pMacAddr2 = priv->sLocalPara.PermanentAddress;
+ hal_get_permanent_address( pHwData, priv->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM
if (memcmp(pMacAddr, "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH) == 0)
memcpy(pMacAddr, pMacAddr2, MAC_ADDR_LENGTH);
else {
// Set the user define MAC address
- hal_set_ethernet_address(pHwData, adapter->sLocalPara.ThisMacAddress);
+ hal_set_ethernet_address(pHwData, priv->sLocalPara.ThisMacAddress);
}
//get current antenna
- psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData);
+ priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData);
#ifdef _PE_STATE_DUMP_
WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo));
#endif
while (!hal_idle(pHwData))
msleep(10);
- MTO_Init(adapter);
+ MTO_Init(priv);
HwRadioOff = hal_get_hw_radio_off( pHwData );
- psLOCAL->RadioOffStatus.boHwRadioOff = !!HwRadioOff;
+ priv->sLocalPara.RadioOffStatus.boHwRadioOff = !!HwRadioOff;
- hal_set_radio_mode( pHwData, (unsigned char)(psLOCAL->RadioOffStatus.boSwRadioOff || psLOCAL->RadioOffStatus.boHwRadioOff) );
+ hal_set_radio_mode( pHwData, (unsigned char)(priv->sLocalPara.RadioOffStatus.boSwRadioOff || priv->sLocalPara.RadioOffStatus.boHwRadioOff) );
hal_driver_init_OK(pHwData) = 1; // Notify hal that the driver is ready now.
//set a tx power for reference.....
-// sme_set_tx_power_level(adapter, 12); FIXME?
+// sme_set_tx_power_level(priv, 12); FIXME?
return true;
error:
switch (InitStep) {
case 5:
case 4:
- case 3: Mds_Destroy( adapter );
+ case 3: Mds_Destroy( priv );
case 2:
- case 1: WBLINUX_Destroy( adapter );
+ case 1: WBLINUX_Destroy( priv );
hal_halt( pHwData, NULL );
case 0: break;
}
struct net_device_stats * wb35_netdev_stats( struct net_device *netdev );
void WBLINUX_stop( struct wbsoft_priv *adapter );
void WbWlanHalt( struct wbsoft_priv *adapter );
-unsigned char WbWLanInitialize(struct wbsoft_priv *adapter);
+unsigned char WbWLanInitialize(struct ieee80211_hw *hw);
+
#endif
};
int wbsoft_enabled;
-struct ieee80211_hw *my_dev;
static int wbsoft_add_interface(struct ieee80211_hw *dev,
struct ieee80211_if_init_conf *conf)
goto error;
priv = dev->priv;
- my_dev = dev;
pWbUsb = &priv->sHwData.WbUsb;
pWbUsb->udev = udev;
pWbUsb->IsUsb20 = 1;
}
- if (!WbWLanInitialize(priv)) {
+ if (!WbWLanInitialize(dev)) {
err = -EINVAL;
goto error_free_hw;
}
return err;
}
-void packet_came(char *pRxBufferAddress, int PacketSize)
+void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize)
{
struct sk_buff *skb;
struct ieee80211_rx_status rx_status = {0};
rx_status.phymode = MODE_IEEE80211B;
*/
- ieee80211_rx_irqsafe(my_dev, skb, &rx_status);
+ ieee80211_rx_irqsafe(hw, skb, &rx_status);
}
static void wb35_disconnect(struct usb_interface *intf)