Staging: w35und: reformat wbhal.c

Impact: cleanup

In preparation for merging wbhal.c with wbusb.c, use Lindet to reformat
the file.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Pekka Enberg 2009-04-08 11:51:19 +03:00 committed by Greg Kroah-Hartman
parent 833d0cd39e
commit c6e523c0cb
1 changed files with 99 additions and 85 deletions

View File

@ -6,19 +6,22 @@ void hal_set_ethernet_address( struct hw_data * pHwData, u8 *current_address )
{ {
u32 ltmp[2]; u32 ltmp[2];
if( pHwData->SurpriseRemove ) return; if (pHwData->SurpriseRemove)
return;
memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN); memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN);
ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress); ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress);
ltmp[1]= cpu_to_le32( *(u32 *)(pHwData->CurrentMacAddress + 4) ) & 0xffff; ltmp[1] =
cpu_to_le32(*(u32 *) (pHwData->CurrentMacAddress + 4)) & 0xffff;
Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT); Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT);
} }
void hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address) void hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address)
{ {
if( pHwData->SurpriseRemove ) return; if (pHwData->SurpriseRemove)
return;
memcpy(pethernet_address, pHwData->PermanentMacAddress, 6); memcpy(pethernet_address, pHwData->PermanentMacAddress, 6);
} }
@ -28,7 +31,8 @@ void hal_set_beacon_period( struct hw_data * pHwData, u16 beacon_period )
{ {
u32 tmp; u32 tmp;
if( pHwData->SurpriseRemove ) return; if (pHwData->SurpriseRemove)
return;
pHwData->BeaconPeriod = beacon_period; pHwData->BeaconPeriod = beacon_period;
tmp = pHwData->BeaconPeriod << 16; tmp = pHwData->BeaconPeriod << 16;
@ -36,8 +40,8 @@ void hal_set_beacon_period( struct hw_data * pHwData, u16 beacon_period )
Wb35Reg_Write(pHwData, 0x0848, tmp); Wb35Reg_Write(pHwData, 0x0848, tmp);
} }
static void hal_set_current_channel_ex(struct hw_data *pHwData,
static void hal_set_current_channel_ex( struct hw_data * pHwData, ChanInfo channel ) ChanInfo channel)
{ {
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
@ -50,24 +54,28 @@ static void hal_set_current_channel_ex( struct hw_data * pHwData, ChanInfo cha
pHwData->Channel = channel.ChanNo; pHwData->Channel = channel.ChanNo;
pHwData->band = channel.band; pHwData->band = channel.band;
#ifdef _PE_STATE_DUMP_ #ifdef _PE_STATE_DUMP_
printk("Set channel is %d, band =%d\n", pHwData->Channel, pHwData->band); printk("Set channel is %d, band =%d\n", pHwData->Channel,
pHwData->band);
#endif #endif
reg->M28_MacControl &= ~0xff; // Clean channel information field reg->M28_MacControl &= ~0xff; // Clean channel information field
reg->M28_MacControl |= channel.ChanNo; reg->M28_MacControl |= channel.ChanNo;
Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl, Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl,
(s8 *) & channel, sizeof(ChanInfo)); (s8 *) & channel, sizeof(ChanInfo));
} }
//--------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------
void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel) void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel)
{ {
hal_set_current_channel_ex(pHwData, channel); hal_set_current_channel_ex(pHwData, channel);
} }
//--------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------
void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable) void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable)
{ {
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
if( pHwData->SurpriseRemove ) return; if (pHwData->SurpriseRemove)
return;
reg->M00_MacControl &= ~0x02000000; //The HW value reg->M00_MacControl &= ~0x02000000; //The HW value
@ -82,7 +90,8 @@ void hal_set_accept_promiscuous( struct hw_data * pHwData, u8 enable)
{ {
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
if (pHwData->SurpriseRemove) return; if (pHwData->SurpriseRemove)
return;
if (enable) { if (enable) {
reg->M00_MacControl |= 0x00400000; reg->M00_MacControl |= 0x00400000;
Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
@ -96,10 +105,12 @@ void hal_set_accept_multicast( struct hw_data * pHwData, u8 enable )
{ {
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
if( pHwData->SurpriseRemove ) return; if (pHwData->SurpriseRemove)
return;
reg->M00_MacControl &= ~0x01000000; //The HW value reg->M00_MacControl &= ~0x01000000; //The HW value
if (enable) reg->M00_MacControl |= 0x01000000;//The HW value if (enable)
reg->M00_MacControl |= 0x01000000; //The HW value
Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
} }
@ -107,7 +118,8 @@ void hal_set_accept_beacon( struct hw_data * pHwData, u8 enable )
{ {
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
if( pHwData->SurpriseRemove ) return; if (pHwData->SurpriseRemove)
return;
// 20040108 debug // 20040108 debug
if (!enable) //Due to SME and MLME are not suitable for 35 if (!enable) //Due to SME and MLME are not suitable for 35
@ -119,6 +131,7 @@ void hal_set_accept_beacon( struct hw_data * pHwData, u8 enable )
Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
} }
//--------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------
void hal_stop(struct hw_data *pHwData) void hal_stop(struct hw_data *pHwData)
@ -140,7 +153,8 @@ unsigned char hal_idle(struct hw_data * pHwData)
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
struct wb_usb *pWbUsb = &pHwData->WbUsb; struct wb_usb *pWbUsb = &pHwData->WbUsb;
if( !pHwData->SurpriseRemove && ( pWbUsb->DetectCount || reg->EP0vm_state!=VM_STOP ) ) if (!pHwData->SurpriseRemove
&& (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP))
return false; return false;
return true; return true;
@ -150,15 +164,14 @@ void hal_set_radio_mode( struct hw_data * pHwData, unsigned char radio_off)
{ {
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
if( pHwData->SurpriseRemove ) return; if (pHwData->SurpriseRemove)
return;
if (radio_off) //disable Baseband receive off if (radio_off) //disable Baseband receive off
{ {
pHwData->CurrentRadioSw = 1; // off pHwData->CurrentRadioSw = 1; // off
reg->M24_MacControl &= 0xffffffbf; reg->M24_MacControl &= 0xffffffbf;
} } else {
else
{
pHwData->CurrentRadioSw = 0; // on pHwData->CurrentRadioSw = 0; // on
reg->M24_MacControl |= 0x00000040; reg->M24_MacControl |= 0x00000040;
} }
@ -181,7 +194,8 @@ u8 hal_get_hw_radio_off( struct hw_data * pHwData )
{ {
struct wb35_reg *reg = &pHwData->reg; struct wb35_reg *reg = &pHwData->reg;
if( pHwData->SurpriseRemove ) return 1; if (pHwData->SurpriseRemove)
return 1;
//read the bit16 of register U1B0 //read the bit16 of register U1B0
Wb35Reg_Read(pHwData, 0x3b0, &reg->U1B0); Wb35Reg_Read(pHwData, 0x3b0, &reg->U1B0);