📄 prism2mgmt.c
字号:
----------------------------------------------------------------*/int prism2mgmt_auxport_read(wlandevice_t *wlandev, void *msgp){#if (WLAN_HOSTIF != WLAN_USB) hfa384x_t *hw = wlandev->priv; p80211msg_p2req_auxport_read_t *msg = msgp; UINT32 addr; UINT32 len; UINT8* buf; UINT32 maxlen = sizeof(msg->data.data); DBFENTER; if ( hw->auxen ) { addr = msg->addr.data; len = msg->len.data; buf = msg->data.data; if ( len <= maxlen ) { /* max read/write size */ hfa384x_copy_from_aux(hw, addr, HFA384x_AUX_CTL_EXTDS, buf, len); msg->resultcode.data = P80211ENUM_resultcode_success; } else { WLAN_LOG_DEBUG(1,"Attempt to read > maxlen from auxport.\n"); msg->resultcode.data = P80211ENUM_resultcode_refused; } } else { msg->resultcode.data = P80211ENUM_resultcode_refused; } msg->data.status = P80211ENUM_msgitem_status_data_ok; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; DBFEXIT; return 0;#else DBFENTER; WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); DBFEXIT; return 0;#endif}/*----------------------------------------------------------------* prism2mgmt_auxport_write** Copies data to the card using the auxport. The auxport must* have previously been enabled. Note: this is not the way to * do downloads, see the [ram|flash]dl functions.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_auxport_write(wlandevice_t *wlandev, void *msgp){#if (WLAN_HOSTIF != WLAN_USB) hfa384x_t *hw = wlandev->priv; p80211msg_p2req_auxport_write_t *msg = msgp; UINT32 addr; UINT32 len; UINT8* buf; UINT32 maxlen = sizeof(msg->data.data); DBFENTER; if ( hw->auxen ) { addr = msg->addr.data; len = msg->len.data; buf = msg->data.data; if ( len <= maxlen ) { /* max read/write size */ hfa384x_copy_to_aux(hw, addr, HFA384x_AUX_CTL_EXTDS, buf, len); } else { WLAN_LOG_DEBUG(1,"Attempt to write > maxlen from auxport.\n"); msg->resultcode.data = P80211ENUM_resultcode_refused; } } else { msg->resultcode.data = P80211ENUM_resultcode_refused; } msg->data.status = P80211ENUM_msgitem_status_data_ok; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; DBFEXIT; return 0;#else DBFENTER; WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); DBFEXIT; return 0;#endif}/*----------------------------------------------------------------* prism2mgmt_low_level** Puts the card into the desired test mode.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns:* 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_low_level(wlandevice_t *wlandev, void *msgp){ hfa384x_t *hw = wlandev->priv; p80211msg_p2req_low_level_t *msg = msgp; hfa384x_metacmd_t cmd; DBFENTER; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; /* call some routine to execute the test command */ cmd.cmd = (UINT16) msg->command.data; cmd.parm0 = (UINT16) msg->param0.data; cmd.parm1 = (UINT16) msg->param1.data; cmd.parm2 = (UINT16) msg->param2.data; hfa384x_drvr_low_level(hw,&cmd); msg->resp0.data = (UINT32) cmd.result.resp0; msg->resp1.data = (UINT32) cmd.result.resp1; msg->resp2.data = (UINT32) cmd.result.resp2; msg->resultcode.data = P80211ENUM_resultcode_success; DBFEXIT; return 0;}/*----------------------------------------------------------------* prism2mgmt_test_command** Puts the card into the desired test mode.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_test_command(wlandevice_t *wlandev, void *msgp){ hfa384x_t *hw = wlandev->priv; p80211msg_p2req_test_command_t *msg = msgp; hfa384x_metacmd_t cmd; DBFENTER; cmd.cmd = ((UINT16) msg->testcode.data) << 8 | 0x38; cmd.parm0 = (UINT16) msg->testparam.data; cmd.parm1 = 0; cmd.parm2 = 0; /* call some routine to execute the test command */ hfa384x_drvr_low_level(hw,&cmd); msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; msg->resultcode.data = P80211ENUM_resultcode_success; msg->status.status = P80211ENUM_msgitem_status_data_ok; msg->status.data = cmd.result.status; msg->resp0.status = P80211ENUM_msgitem_status_data_ok; msg->resp0.data = cmd.result.resp0; msg->resp1.status = P80211ENUM_msgitem_status_data_ok; msg->resp1.data = cmd.result.resp1; msg->resp2.status = P80211ENUM_msgitem_status_data_ok; msg->resp2.data = cmd.result.resp2; DBFEXIT; return 0;}/*----------------------------------------------------------------* prism2mgmt_mmi_read** Read from one of the MMI registers.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_mmi_read(wlandevice_t *wlandev, void *msgp){ hfa384x_t *hw = wlandev->priv; p80211msg_p2req_mmi_read_t *msg = msgp; UINT32 resp; DBFENTER; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; /* call some routine to execute the test command */ hfa384x_drvr_mmi_read(hw, msg->addr.data, &resp); /* I'm not sure if this is "architecturally" correct, but it is expedient. */ msg->value.status = P80211ENUM_msgitem_status_data_ok; msg->value.data = resp; msg->resultcode.data = P80211ENUM_resultcode_success; DBFEXIT; return 0;}/*----------------------------------------------------------------* prism2mgmt_mmi_write** Write a data value to one of the MMI registers.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_mmi_write(wlandevice_t *wlandev, void *msgp){ hfa384x_t *hw = wlandev->priv; p80211msg_p2req_mmi_write_t *msg = msgp; DBFENTER; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; /* call some routine to execute the test command */ hfa384x_drvr_mmi_write(hw, msg->addr.data, msg->data.data); msg->resultcode.data = P80211ENUM_resultcode_success; DBFEXIT; return 0;}/*----------------------------------------------------------------* prism2mgmt_ramdl_state** Establishes the beginning/end of a card RAM download session.** It is expected that the ramdl_write() function will be called * one or more times between the 'enable' and 'disable' calls to* this function.** Note: This function should not be called when a mac comm port * is active.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp){ hfa384x_t *hw = wlandev->priv; p80211msg_p2req_ramdl_state_t *msg = msgp; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { WLAN_LOG_ERROR( "ramdl_state(): may only be called " "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; DBFEXIT; return 0; } /* ** Note: Interrupts are locked out if this is an AP and are NOT ** locked out if this is a station. */ msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; if ( msg->enable.data == P80211ENUM_truth_true ) { if ( hfa384x_drvr_ramdl_enable(hw, msg->exeaddr.data) ) { msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; } else { msg->resultcode.data = P80211ENUM_resultcode_success; } } else { hfa384x_drvr_ramdl_disable(hw); msg->resultcode.data = P80211ENUM_resultcode_success; } DBFEXIT; return 0;}/*----------------------------------------------------------------* prism2mgmt_ramdl_write** Writes a buffer to the card RAM using the download state. This* is for writing code to card RAM. To just read or write raw data* use the aux functions.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp){ hfa384x_t *hw = wlandev->priv; p80211msg_p2req_ramdl_write_t *msg = msgp; UINT32 addr; UINT32 len; UINT8 *buf; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { WLAN_LOG_ERROR( "ramdl_write(): may only be called " "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; DBFEXIT; return 0; } msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; /* first validate the length */ if ( msg->len.data > sizeof(msg->data.data) ) { msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters; return 0; } /* call the hfa384x function to do the write */ addr = msg->addr.data; len = msg->len.data; buf = msg->data.data; if ( hfa384x_drvr_ramdl_write(hw, addr, buf, len) ) { msg->resultcode.data = P80211ENUM_resultcode_refused; } msg->resultcode.data = P80211ENUM_resultcode_success; DBFEXIT; return 0;}/*----------------------------------------------------------------* prism2mgmt_flashdl_state** Establishes the beginning/end of a card Flash download session.** It is expected that the flashdl_write() function will be called * one or more times between the 'enable' and 'disable' calls to* this function.** Note: This function should not be called when a mac comm port * is active.** Arguments:* wlandev wlan device structure* msgp ptr to msg buffer** Returns: * 0 success and done* <0 success, but we're waiting for something to finish.* >0 an error occurred while handling the message.* Side effects:** Call context:* process thread (usually)----------------------------------------------------------------*/int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp){ int result = 0; hfa384x_t *hw = wlandev->priv; p80211msg_p2req_flashdl_state_t *msg = msgp; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { WLAN_LOG_ERROR( "flashdl_state(): may only be called " "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; DBFEXIT; return 0; } /* ** Note: Interrupts are locked out if this is an AP and are NOT ** locked out if this is a station. */ msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; if ( msg->enable.data == P80211E
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -