Removed byte order calls for arguments to cmd_download in ramdl_enable.

This commit is contained in:
mark 2000-02-03 18:45:32 +00:00
parent 122f0a24c1
commit 70958c8b44
3 changed files with 258 additions and 5 deletions

View File

@ -57,6 +57,9 @@
/*--- Support Constants -----------------------------*/
#define HFA384x_BAP_PROC 0
#define HFA384x_BAP_INT 1
#define HFA384x_PORTTYPE_BSS 1
#define HFA384x_PORTTYPE_WDS 2
#define HFA384x_PORTTYPE_IBSS 3
/*--- Aux register masks/tests ----------------------*/
/* masks and macros used to generate AUX page and */
@ -435,6 +438,7 @@ Information RID Lengths: MAC Information
#define HFA384x_RID_CURRENTTXRATE6_LEN (0)
#define HFA384x_RID_OWNMACADDRESS_LEN (0)
#define HFA384x_RID_PCFINFO_LEN (6)
#define HFA384x_RID_CNFAPPCFINFO_LEN (8)
/*--------------------------------------------------------------------
Information RIDs: Modem Information
@ -476,6 +480,7 @@ API ENHANCEMENTS (NOT ALREADY IMPLEMENTED)
#define HFA384x_RID_CNFAPPCFINFO (0xFC34)
#define HFA384x_RID_CNFSTAPCFINFO (0xFC35)
#define HFA384x_RID_CNFBASICRATES (0xFCB3)
#define HFA384x_RID_CNFSUPPRATES (0xFCB4)
#define HFA384x_RID_CNFSHORTPREAMBLE (0xFCB0)
#define HFA384x_RID_CNFEXCLONGPREAMBLE (0xFCB1)
#define HFA384x_RID_CNFAUTHRSPTIMEOUT (0xFCB2)
@ -1260,6 +1265,7 @@ typedef struct hfa384x_PCFInfo_data
UINT16 MediumOccupancyLimit __WLAN_ATTRIB_PACK__;
UINT16 CFPPeriod __WLAN_ATTRIB_PACK__;
UINT16 CFPMaxDuration __WLAN_ATTRIB_PACK__;
UINT16 CFPFlags __WLAN_ATTRIB_PACK__;
} hfa384x_PCFInfo_data_t;
/*--------------------------------------------------------------------

View File

@ -518,9 +518,7 @@ hw->dlstate = HFA384x_DLSTATE_RAMENABLED;
/* Call the download(1,addr) function */
lowaddr = (UINT16)(exeaddr & 0x0000ffff);
lowaddr = host2hfa384x_16(lowaddr);
hiaddr = (UINT16)(exeaddr >> 16);
hiaddr = host2hfa384x_16(hiaddr);
result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_RAM,
lowaddr, hiaddr, 0);

View File

@ -82,6 +82,11 @@
/*================================================================*/
/* Local Macros */
/* Converts 802.11 format rate specifications to prism2 */
#define p80211rate_to_p2bit(n) ((((n)&~BIT7) == 2) ? BIT0 : \
(((n)&~BIT7) == 4) ? BIT1 : \
(((n)&~BIT7) == 11) ? BIT2 : \
(((n)&~BIT7) == 22) ? BIT3 : 0)
/*================================================================*/
/* Local Types */
@ -1201,12 +1206,256 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp)
hfa384x_t *hw = priv->hw;
int result = 0;
p80211msg_dot11req_start_t *msg = msgp;
p80211pstrd_t *pstr;
UINT8 bytebuf[80];
hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf;
hfa384x_PCFInfo_data_t *pcfinfo = (hfa384x_PCFInfo_data_t*)bytebuf;
UINT16 word;
DBFENTER;
/* TODO: remove the following line, it's just to get rid of warnings for now */
msg->resultcode.data = hw->bap;
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
/* Validate the command, if BSStype=infra is the tertiary loaded? */
if ( (msg->bsstype.data == P80211ENUM_bsstype_independent &&
priv->cap_sup_sta.role != 4) ||
(msg->bsstype.data == P80211ENUM_bsstype_infrastructure &&
priv->cap_sup_sta.role != 5) ) {
msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
return 0;
}
/* Set the REQUIRED config items */
/* SSID */
pstr = (p80211pstrd_t*)&(msg->ssid.data);
prism2mgmt_pstr2bytestr(p2bytestr, pstr);
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID,
bytebuf, HFA384x_RID_CNFOWNSSID_LEN);
if ( result ) {
WLAN_LOG_DEBUG0(1, "Unable to set SSID\n");
goto failed;
}
/* bsstype */
switch( msg->bsstype.data ) {
case P80211ENUM_bsstype_independent:
word = HFA384x_PORTTYPE_IBSS;
break;
case P80211ENUM_bsstype_infrastructure:
word = HFA384x_PORTTYPE_BSS;
break;
default:
result = -1;
WLAN_LOG_DEBUG1(1,"Bad bsstype=%ld\n", msg->bsstype.data);
goto failed;
break;
}
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set port type=%d.\n", word);
goto failed;
}
/* beacon period */
word = msg->beaconperiod.data;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNINT, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set beacon period=%d.\n", word);
goto failed;
}
/* dschannel */
word = msg->dschannel.data;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNCHANNEL, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set channel=%d.\n", word);
goto failed;
}
/* Basic rates */
word = p80211rate_to_p2bit(msg->basicrate1.data);
if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->basicrate2.data);
}
if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->basicrate3.data);
}
if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->basicrate4.data);
}
if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->basicrate5.data);
}
if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->basicrate6.data);
}
if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->basicrate7.data);
}
if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->basicrate8.data);
}
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set basicrates=%d.\n", word);
goto failed;
}
/* Operational rates (supprates and txratecontrol) */
word = msg->operationalrate1.data;
if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->operationalrate2.data);
}
if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->operationalrate3.data);
}
if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->operationalrate4.data);
}
if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->operationalrate5.data);
}
if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->operationalrate6.data);
}
if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->operationalrate7.data);
}
if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) {
word |= p80211rate_to_p2bit(msg->operationalrate8.data);
}
if ( msg->bsstype.data == P80211ENUM_bsstype_infrastructure ) {
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set supprates=%d.\n", word);
goto failed;
}
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL0, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set txrates=%d.\n", word);
goto failed;
}
} else { /* assume ibss */
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set txrates=%d.\n", word);
goto failed;
}
}
/* ibssatimwindow */
if (msg->bsstype.data != P80211ENUM_bsstype_independent ) {
WLAN_LOG_INFO0("Setting atimwindow for non-ibss is pointless.\n");
} else {
word = msg->ibssatimwindow.data;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNATIMWIN, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set atimwindow=%d.\n", word);
goto failed;
}
}
/* The settings below this if statement only apply to infrastructure */
/* if we're not infrastructure, skip over them */
if (msg->bsstype.data != P80211ENUM_bsstype_infrastructure ) {
goto ibss_skip;
}
/* DTIM period */
word = msg->dtimperiod.data;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNDTIMPER, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to set dtim period=%d.\n", word);
goto failed;
}
/* probedelay */
WLAN_LOG_INFO0("No setting for probedelay in prism2, skipped.\n");
/* cfpollable, cfpollreq, cfpperiod, cfpmaxduration */
if (msg->cfpollable.data == P80211ENUM_truth_true &&
msg->cfpollreq.data == P80211ENUM_truth_true ) {
WLAN_LOG_ERROR0("cfpollable=cfpollreq=true is illegal.\n");
result = -1;
goto failed;
}
/* read the PCFInfo and update */
result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFAPPCFINFO,
pcfinfo, HFA384x_RID_CNFAPPCFINFO_LEN);
if ( result ) {
WLAN_LOG_DEBUG0(1, "Unable to read pcfinfo.\n");
goto failed;
}
if ((msg->cfpollable.data == P80211ENUM_truth_false ||
msg->cfpollreq.data == P80211ENUM_truth_false) ) {
pcfinfo->MediumOccupancyLimit = 0;
pcfinfo->CFPPeriod = 0;
pcfinfo->CFPMaxDuration = 0;
pcfinfo->CFPFlags = 0;
if ( msg->cfpperiod.data == P80211ENUM_msgitem_status_data_ok ||
msg->cfpmaxduration.data == P80211ENUM_msgitem_status_data_ok ) {
WLAN_LOG_WARNING0(
"Setting cfpperiod or cfpmaxduration when "
"cfpollable and cfreq are false is pointless.\n");
}
}
if ((msg->cfpollable.data == P80211ENUM_truth_true ||
msg->cfpollreq.data == P80211ENUM_truth_true) ) {
if ( msg->cfpollable.data == P80211ENUM_truth_true) {
pcfinfo->CFPFlags |= host2hfa384x_16((UINT16)BIT0);
}
if ( msg->cfpperiod.status == P80211ENUM_msgitem_status_data_ok) {
pcfinfo->CFPPeriod = msg->cfpperiod.data;
pcfinfo->CFPPeriod = host2hfa384x_16(pcfinfo->CFPPeriod);
}
if ( msg->cfpmaxduration.status == P80211ENUM_msgitem_status_data_ok) {
pcfinfo->CFPMaxDuration = msg->cfpmaxduration.data;
pcfinfo->CFPMaxDuration = host2hfa384x_16(pcfinfo->CFPMaxDuration);
pcfinfo->MediumOccupancyLimit = pcfinfo->CFPMaxDuration;
}
}
result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFAPPCFINFO,
pcfinfo, HFA384x_RID_CNFAPPCFINFO_LEN);
if ( result ) {
WLAN_LOG_DEBUG0(1, "Unable to write pcfinfo.\n");
goto failed;
}
ibss_skip:
/* Set the PortType */
word = HFA384x_PORTTYPE_BSS;
result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, &word);
if ( result ) {
WLAN_LOG_DEBUG1(1, "Unable to write macport type=%d.\n", word);
goto failed;
}
/* Enable the interrupts */
word = HFA384x_INTEN_INFDROP_SET(1) |
HFA384x_INTEN_INFO_SET(1) |
HFA384x_INTEN_ALLOC_SET(1) |
HFA384x_INTEN_TXEXC_SET(1) |
HFA384x_INTEN_TX_SET(1) |
HFA384x_INTEN_RX_SET(1);
outw( 0xffff, HFA384x_EVSTAT(priv->hw->iobase));
outw( word, HFA384x_INTEN(hw->iobase));
/* Enable the Port */
result = hfa384x_cmd_enable(hw, 0);
if ( result ) {
WLAN_LOG_DEBUG0(1, "Unable to enable macport 0.\n");
goto failed;
}
msg->resultcode.data = P80211ENUM_resultcode_success;
goto done;
failed:
WLAN_LOG_DEBUG1(1, "Failed to set a config option, result=%d\n", result);
msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
done:
result = 0;
DBFEXIT;
return result;
}