VoodooIntel3945.cpp
/**
 * Configure the card to listen to a particular channel, this transitions the
 * card into being able to receive frames from remote devices.
 */
Configure the card to listen to a particular channel, this transitions the
card into being able to receive frames from remote devices.
Configure the card to listen to a particular channel this transitions the card into being able to receive frames from remote devices .
IOReturn MyClass::configure( )
{
	wpi_power	power;
	wpi_bluetooth	bluetooth;
	wpi_node_info	node;
	bzero(&power, sizeof power);
	power.flags = WPI_POWER_CAM | 0x8;
	if (sendCommand(WPI_CMD_SET_POWER_MODE, &power, sizeof power, 0) != kIOReturnSuccess) {
		DBG(dbgFatal, "Could not set power mode\n");
		return kIOReturnError;
	}
	bzero(&bluetooth, sizeof bluetooth);
	bluetooth.flags	= 3;
	bluetooth.lead	= 0xaa;
	bluetooth.kill	= 1;
	if (sendCommand(WPI_CMD_BLUETOOTH, &bluetooth, sizeof bluetooth, 0) != kIOReturnSuccess) {
		DBG(dbgFatal, "Could not configure bluetooth co-existence\n");
		return kIOReturnError;
	}
	bzero(&m_Config, sizeof (struct wpi_config));
	bcopy(&m_MacAddress, m_Config.myaddr, 6);
	m_Config.chan		 = m_CurrentChannel.number ; 
	m_Config.flags		 = WPI_CONFIG_TSF;
	if (m_CurrentChannel.flags & IEEE::Channel::band2GHz)
		m_Config.flags |= (WPI_CONFIG_AUTO | WPI_CONFIG_24GHZ);
	m_Config.filter		 = 0;
	m_Config.mode		 = WPI_MODE_STA;
	m_Config.filter		|= WPI_FILTER_MULTICAST;
	m_Config.cck_mask	 = 0x0f;	
	m_Config.ofdm_mask	 = 0xff;	
	if (sendCommand(WPI_CMD_CONFIGURE, &m_Config, sizeof (wpi_config), 0) != kIOReturnSuccess) {
		DBG(dbgFatal, "Configure command failed\n");
		return kIOReturnError;
	}
	if (setTxPower(m_CurrentChannel, 0) != kIOReturnSuccess) {
		DBG(dbgFatal, "could not set Tx power\n");
		return kIOReturnError;
	}
	bzero(&node, sizeof node);
	bcopy(broadcast_bssid, node.bssid, 6);
	node.id = WPI_ID_BROADCAST;
	node.rate = plcpSignal(2);
	if (sendCommand(WPI_CMD_ADD_NODE, &node, sizeof node, 0) != kIOReturnSuccess) {
		DBG(dbgFatal, "could not add broadcast node\n");
		return kIOReturnError;
	}
	if (mrrSetup() != kIOReturnSuccess) {
		DBG(dbgFatal, "could not setup MRR\n");
		return kIOReturnError;
	}
	return kIOReturnSuccess;
}
IOReturn MyClass :: configure ( ) { wpi_power power ; wpi_bluetooth bluetooth ; wpi_node_info node ; bzero ( & power , sizeof power ) ; power . flags = WPI_POWER_CAM | 0x8 ; if ( sendCommand ( WPI_CMD_SET_POWER_MODE , & power , sizeof power , 0 ) != kIOReturnSuccess ) { DBG ( dbgFatal , " \n " ) ; return kIOReturnError ; } bzero ( & bluetooth , sizeof bluetooth ) ; bluetooth . flags = 3 ; bluetooth . lead = 0xaa ; bluetooth . kill = 1 ; if ( sendCommand ( WPI_CMD_BLUETOOTH , & bluetooth , sizeof bluetooth , 0 ) != kIOReturnSuccess ) { DBG ( dbgFatal , " \n " ) ; return kIOReturnError ; } bzero ( & m_Config , sizeof ( struct wpi_config ) ) ; bcopy ( & m_MacAddress , m_Config . myaddr , 6 ) ; m_Config . chan = m_CurrentChannel . number ; m_Config . flags = WPI_CONFIG_TSF ; if ( m_CurrentChannel . flags & IEEE :: Channel :: band2GHz ) m_Config . flags |= ( WPI_CONFIG_AUTO | WPI_CONFIG_24GHZ ) ; m_Config . filter = 0 ; m_Config . mode = WPI_MODE_STA ; m_Config . filter |= WPI_FILTER_MULTICAST ; m_Config . cck_mask = 0x0f ; m_Config . ofdm_mask = 0xff ; if ( sendCommand ( WPI_CMD_CONFIGURE , & m_Config , sizeof ( wpi_config ) , 0 ) != kIOReturnSuccess ) { DBG ( dbgFatal , " \n " ) ; return kIOReturnError ; } if ( setTxPower ( m_CurrentChannel , 0 ) != kIOReturnSuccess ) { DBG ( dbgFatal , " \n " ) ; return kIOReturnError ; } bzero ( & node , sizeof node ) ; bcopy ( broadcast_bssid , node . bssid , 6 ) ; node . id = WPI_ID_BROADCAST ; node . rate = plcpSignal ( 2 ) ; if ( sendCommand ( WPI_CMD_ADD_NODE , & node , sizeof node , 0 ) != kIOReturnSuccess ) { DBG ( dbgFatal , " \n " ) ; return kIOReturnError ; } if ( mrrSetup ( ) != kIOReturnSuccess ) { DBG ( dbgFatal , " \n " ) ; return kIOReturnError ; } return kIOReturnSuccess ; }
Configure the card to listen to a particular channel, this transitions the
 card into being able to receive frames from remote devices.
Configure the card to listen to a particular channel this transitions the card into being able to receive frames from remote devices .
/* set power mode */ /* configure bluetooth coexistence */ /* configure adapter */ /*set defaults */ // XXX initially set during turnPowerOn() /* not yet negotiated */ /* not yet negotiated */ /* configuration has changed, set Tx power accordingly */ /* add broadcast node */ /* Setup rate scalling */