prism2mgmt.c
来自「Linux的无线局域网方案是一个Linux设备驱动程序和子系统 一揽子方案的用」· C语言 代码 · 共 2,318 行 · 第 1/5 页
C
2,318 行
#endif /* WLAN_HOSTIF != WLAN_USB */ DBFEXIT; return 0;}/*----------------------------------------------------------------* prism2mgmt_auxport_read** Copies data from 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_read(wlandevice_t *wlandev, void *msgp){#if (WLAN_HOSTIF != WLAN_USB) prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; 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_DEBUG0(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_ERROR0("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) prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; 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_DEBUG0(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_ERROR0("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){ prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; p80211msg_p2req_low_level_t *msg = msgp; DBFENTER; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; /* call some routine to execute the test command */ hfa384x_drvr_low_level(hw, msg->command.data, msg->param0.data, msg->param1.data, msg->param2.data); msg->resp0.data = (UINT32) hw->resp0; msg->resp1.data = (UINT32) hw->resp1; msg->resp2.data = (UINT32) hw->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){ prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; p80211msg_p2req_test_command_t *msg = msgp; DBFENTER; /* call some routine to execute the test command */ hfa384x_drvr_test_command(hw, msg->testcode.data, msg->testparam.data); 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 = hw->status; msg->resp0.status = P80211ENUM_msgitem_status_data_ok; msg->resp0.data = hw->resp0; msg->resp1.status = P80211ENUM_msgitem_status_data_ok; msg->resp1.data = hw->resp1; msg->resp2.status = P80211ENUM_msgitem_status_data_ok; msg->resp2.data = hw->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){ prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; p80211msg_p2req_mmi_read_t *msg = msgp; 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); /* I'm not sure if this is "architecturally" correct, but it is expedient. */ msg->value.status = P80211ENUM_msgitem_status_data_ok; msg->value.data = (UINT32) hw->resp0; 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){ prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; 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){ prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; p80211msg_p2req_ramdl_state_t *msg = msgp; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { WLAN_LOG_ERROR0( "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){ prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; p80211msg_p2req_ramdl_write_t *msg = msgp; UINT32 addr; UINT32 len; UINT8 *buf; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { WLAN_LOG_ERROR0( "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){ prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv; hfa384x_t *hw = priv->hw; p80211msg_p2req_flashdl_state_t *msg = msgp; DBFENTER; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { WLAN_LOG_ERROR0( "flashdl_state(): may only be called "
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?