X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=blobdiff_plain;f=carlfw%2Fsrc%2Fcmd.c;h=13081c24cf37c7de245859a78ece1026ffafcbdf;hp=90aa21407ad4a052306da150e57222613c3cc300;hb=af915846d44d23adc02c7ded807282d607b46faa;hpb=b8f7132bb9cc3eb1b0fdeab865493b08e096b47a diff --git a/carlfw/src/cmd.c b/carlfw/src/cmd.c index 90aa214..13081c2 100644 --- a/carlfw/src/cmd.c +++ b/carlfw/src/cmd.c @@ -6,7 +6,7 @@ * Copyright (c) 2000-2005 ZyDAS Technology Corporation * Copyright (c) 2007-2009 Atheros Communications, Inc. * Copyright 2009 Johannes Berg - * Copyright 2009, 2010 Christian Lamparter + * Copyright 2009-2011 Christian Lamparter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,17 +59,21 @@ void handle_cmd(struct carl9170_rsp *resp) break; case CARL9170_CMD_SWRST: - resp->hdr.len = 0; +#ifdef CONFIG_CARL9170FW_FW_MAC_RESET + /* + * Command has no payload, so the response + * has no payload either. + * resp->hdr.len = 0; + */ fw.wlan.mac_reset = CARL9170_MAC_RESET_FORCE; +#endif /* CONFIG_CARL9170FW_FW_MAC_RESET */ break; case CARL9170_CMD_REBOOT: /* - * reboot does not return and generates no response * resp->len = 0; */ - - reboot(); + fw.reboot = 1; break; case CARL9170_CMD_READ_TSF: @@ -77,24 +81,42 @@ void handle_cmd(struct carl9170_rsp *resp) read_tsf((uint32_t *)resp->tsf.tsf); break; + case CARL9170_CMD_RX_FILTER: + resp->hdr.len = 0; + fw.wlan.rx_filter = cmd->rx_filter.rx_filter; + break; + +#ifdef CONFIG_CARL9170FW_WOL + case CARL9170_CMD_WOL: + memcpy(&fw.wlan.wol.cmd, &cmd->wol, sizeof(cmd->wol)); + break; +#endif /* CONFIG_CARL9170FW_WOL */ + #ifdef CONFIG_CARL9170FW_CAB_QUEUE - case CARL9170_CMD_FLUSH_CAB: + case CARL9170_CMD_BCN_CTRL: resp->hdr.len = 0; - fw.wlan.cab_flush_trigger = CARL9170_CAB_TRIGGER_ARMED; - fw.wlan.cab_flush_time = get_clock_counter() + - CARL9170_TBTT_DELTA; + + if (cmd->bcn_ctrl.mode & CARL9170_BCN_CTRL_CAB_TRIGGER) { + wlan_modify_beacon(cmd->bcn_ctrl.vif_id, + cmd->bcn_ctrl.bcn_addr, cmd->bcn_ctrl.bcn_len); + set(AR9170_MAC_REG_BCN_ADDR, cmd->bcn_ctrl.bcn_addr); + set(AR9170_MAC_REG_BCN_LENGTH, cmd->bcn_ctrl.bcn_len); + set(AR9170_MAC_REG_BCN_CTRL, AR9170_BCN_CTRL_READY); + } else { + wlan_cab_flush_queue(cmd->bcn_ctrl.vif_id); + fw.wlan.cab_flush_trigger[i] = CARL9170_CAB_TRIGGER_EMPTY; + } break; #endif /* CONFIG_CARL9170FW_CAB_QUEUE */ #ifdef CONFIG_CARL9170FW_SECURITY_ENGINE case CARL9170_CMD_EKEY: - resp->hdr.len = 1; + resp->hdr.len = 0; set_key(&cmd->setkey); break; case CARL9170_CMD_DKEY: - /* Disable Key */ - resp->hdr.len = 1; + resp->hdr.len = 0; disable_key(&cmd->disablekey); break; #endif /* CONFIG_CARL9170FW_SECURIT_ENGINE */ @@ -106,28 +128,21 @@ void handle_cmd(struct carl9170_rsp *resp) break; case CARL9170_CMD_FREQ_START: - resp->hdr.len = 0; + /* + * resp->hdr.len = 0; + */ rf_notify_set_channel(); break; -# ifdef CONFIG_CARL9170FW_PSM case CARL9170_CMD_PSM: resp->hdr.len = 0; fw.phy.psm.state = le32_to_cpu(cmd->psm.state); rf_psm(); break; -# endif /* CONFIG_CARL9170FW_PSM */ #endif /* CONFIG_CARL9170FW_RADIO_FUNCTIOS */ -#ifdef CONFIG_CARL9170FW_USB_WATCHDOG - case CARL9170_CMD_USB_WD: - resp->hdr.len = 4; - fw.usb.watchdog.state = le32_to_cpu(cmd->watchdog.state); - break; - -#endif /* CONFIG_CARL9170FW_USB_WATCHDOG */ - default: + BUG("Unknown command %x\n", cmd->hdr.cmd); break; } }