📄 wmi.c
字号:
#endif
cc->channel = channel;
if (bssid != NULL) {
A_MEMCPY(cc->bssid, bssid, ATH_MAC_LEN);
}
return (wmi_cmd_send(wmip, osbuf, WMI_CONNECT_CMDID, NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_reconnect_cmd(struct wmi_t *wmip, A_UINT8 *bssid, A_UINT16 channel)
{
void *osbuf;
WMI_RECONNECT_CMD *cc;
osbuf = a_netbuf_alloc(sizeof(WMI_RECONNECT_CMD));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(WMI_RECONNECT_CMD));
cc = (WMI_RECONNECT_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cc, sizeof(*cc));
cc->channel = channel;
if (bssid != NULL) {
A_MEMCPY(cc->bssid, bssid, ATH_MAC_LEN);
}
return (wmi_cmd_send(wmip, osbuf, WMI_RECONNECT_CMDID, NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_disconnect_cmd(struct wmi_t *wmip)
{
void *osbuf;
A_STATUS status;
osbuf = a_netbuf_alloc(0); /* no payload */
if (osbuf == NULL) {
return A_NO_MEMORY;
}
status = (wmi_cmd_send(wmip, osbuf, WMI_DISCONNECT_CMDID,
SYNC_BEFORE_WMIFLAG));
wmi_qos_state_init(wmip);
return status;
}
A_STATUS
wmi_startscan_cmd(struct wmi_t *wmip, WMI_SCAN_TYPE scanType)
{
void *osbuf;
WMI_START_SCAN_CMD *sc;
if ((scanType != WMI_LONG_SCAN) && (scanType != WMI_SHORT_SCAN)) {
return A_EINVAL;
}
osbuf = a_netbuf_alloc(sizeof(*sc));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*sc));
sc = (WMI_START_SCAN_CMD *)(a_netbuf_to_data(osbuf));
sc->scanType = scanType;
return (wmi_cmd_send(wmip, osbuf, WMI_START_SCAN_CMDID, NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_scanparams_cmd(struct wmi_t *wmip, A_UINT16 fg_start_sec,
A_UINT16 fg_end_sec, A_UINT16 bg_sec,
A_UINT16 act_chdw_msec, A_UINT16 pas_chdw_msec,
A_UINT8 shScanRatio)
{
void *osbuf;
WMI_SCAN_PARAMS_CMD *sc;
osbuf = a_netbuf_alloc(sizeof(*sc));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*sc));
sc = (WMI_SCAN_PARAMS_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(sc, sizeof(*sc));
sc->fg_start_period = fg_start_sec;
sc->fg_end_period = fg_end_sec;
sc->bg_period = bg_sec;
sc->act_chdwell_time = act_chdw_msec;
sc->pas_chdwell_time = pas_chdw_msec;
sc->shortScanRatio = shScanRatio;
return (wmi_cmd_send(wmip, osbuf, WMI_SET_SCAN_PARAMS_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_bssfilter_cmd(struct wmi_t *wmip, A_UINT8 filter)
{
void *osbuf;
WMI_BSS_FILTER_CMD *cmd;
if (filter >= LAST_BSS_FILTER) {
return A_EINVAL;
}
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_BSS_FILTER_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->bssFilter = filter;
return (wmi_cmd_send(wmip, osbuf, WMI_SET_BSS_FILTER_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_probedSsid_cmd(struct wmi_t *wmip, A_UINT8 index, A_UINT8 flag,
A_UINT8 ssidLength, A_UCHAR *ssid)
{
void *osbuf;
WMI_PROBED_SSID_CMD *cmd;
if (index > MAX_PROBED_SSID_INDEX) {
return A_EINVAL;
}
if (ssidLength > sizeof(cmd->ssid)) {
return A_EINVAL;
}
if ((flag & (DISABLE_SSID_FLAG | ANY_SSID_FLAG)) && (ssidLength > 0)) {
return A_EINVAL;
}
if ((flag & SPECIFIC_SSID_FLAG) && !ssidLength) {
return A_EINVAL;
}
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_PROBED_SSID_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->entryIndex = index;
cmd->flag = flag;
cmd->ssidLength = ssidLength;
A_MEMCPY(cmd->ssid, ssid, ssidLength);
return (wmi_cmd_send(wmip, osbuf, WMI_SET_PROBED_SSID_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_listeninterval_cmd(struct wmi_t *wmip, A_UINT16 listenInterval, A_UINT16 numBeacons )
{
void *osbuf;
WMI_LISTEN_INT_CMD *cmd;
if ( listenInterval ) {
if ((listenInterval<MIN_LISTEN_INTERVAL) ||
(listenInterval>MAX_LISTEN_INTERVAL)) {
return A_EINVAL;
}
}
#ifndef AR6K_FIRMWARE_1_0
if ( numBeacons ) {
if ((numBeacons<MIN_LISTEN_BEACONS) || (numBeacons>MAX_LISTEN_BEACONS)) {
return A_EINVAL;
}
}
#endif
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_LISTEN_INT_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->listenInterval = listenInterval;
#ifndef AR6K_FIRMWARE_1_0
cmd->numBeacons = numBeacons;
#endif
return (wmi_cmd_send(wmip, osbuf, WMI_SET_LISTEN_INT_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_bmisstime_cmd(struct wmi_t *wmip, A_UINT16 bmissTime, A_UINT16 numBeacons)
{
void *osbuf;
WMI_BMISS_TIME_CMD *cmd;
if ( (bmissTime<MIN_BMISS_TIME) || (bmissTime>MAX_BMISS_TIME) ) {
return A_EINVAL;
}
#ifndef AR6K_FIRMWARE_1_0
if ( (numBeacons<MIN_BMISS_BEACONS) || (numBeacons>MAX_BMISS_BEACONS) ) {
return A_EINVAL;
}
#endif
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_BMISS_TIME_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->bmissTime= bmissTime;
#ifndef AR6K_FIRMWARE_1_0
cmd->numBeacons= numBeacons;
#endif
return (wmi_cmd_send(wmip, osbuf, WMI_SET_BMISS_TIME_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_associnfo_cmd(struct wmi_t *wmip, A_UINT8 ieType,
A_UINT8 ieLen, A_UINT8 *ieInfo)
{
void *osbuf;
WMI_SET_ASSOC_INFO_CMD *cmd;
A_UINT16 cmdLen;
if (ieType > WMI_MAX_ASSOC_INFO_TYPE) {
return A_EINVAL;
}
cmdLen = sizeof(*cmd) + ieLen - 1;
osbuf = a_netbuf_alloc(cmdLen);
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, cmdLen);
cmd = (WMI_SET_ASSOC_INFO_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, cmdLen);
cmd->ieType = ieType;
cmd->bufferSize = ieLen;
A_MEMCPY(cmd->assocInfo, ieInfo, ieLen);
return (wmi_cmd_send(wmip, osbuf, WMI_SET_ASSOC_INFO_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_powermode_cmd(struct wmi_t *wmip, A_UINT8 powerMode)
{
void *osbuf;
WMI_POWER_MODE_CMD *cmd;
if ( (powerMode != REC_POWER) && (powerMode != MAX_PERF_POWER) ) {
return A_EINVAL;
}
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_POWER_MODE_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->powerMode = powerMode;
return (wmi_cmd_send(wmip, osbuf, WMI_SET_POWER_MODE_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_ibsspmcaps_cmd(struct wmi_t *wmip, A_UINT8 pmEnable, A_UINT8 ttl, A_UINT16 atim_windows, A_UINT16 timeout_value)
{
void *osbuf;
WMI_IBSS_PM_CAPS_CMD *cmd;
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_IBSS_PM_CAPS_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->power_saving = pmEnable;
cmd->atim_windows = atim_windows;
#ifndef AR6K_FIRMWARE_1_0
cmd->ttl = ttl;
cmd->timeout_value = timeout_value;
#endif
return (wmi_cmd_send(wmip, osbuf, WMI_SET_IBSS_PM_CAPS_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_pmparams_cmd(struct wmi_t *wmip, A_UINT16 idlePeriod,
A_UINT16 psPollNum, A_UINT16 dtimPolicy)
{
void *osbuf;
WMI_POWER_PARAMS_CMD *pm;
if ( dtimPolicy > STICK_DTIM ) {
return A_EINVAL;
}
osbuf = a_netbuf_alloc(sizeof(*pm));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*pm));
pm = (WMI_POWER_PARAMS_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(pm, sizeof(*pm));
pm->idle_period = idlePeriod;
pm->pspoll_number = psPollNum;
pm->dtim_policy = dtimPolicy;
return (wmi_cmd_send(wmip, osbuf, WMI_SET_POWER_PARAMS_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_disctimeout_cmd(struct wmi_t *wmip, A_UINT8 timeout)
{
void *osbuf;
WMI_DISC_TIMEOUT_CMD *cmd;
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_DISC_TIMEOUT_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->disconnectTimeout = timeout;
return (wmi_cmd_send(wmip, osbuf, WMI_SET_DISC_TIMEOUT_CMDID,
NO_SYNC_WMIFLAG));
}
A_STATUS
wmi_addKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex, CRYPTO_TYPE keyType,
A_UINT8 keyUsage, A_UINT8 keyLength, A_UINT8 *keyRSC,
A_UINT8 *keyMaterial)
{
void *osbuf;
WMI_ADD_CIPHER_KEY_CMD *cmd;
if ((keyIndex > WMI_MAX_KEY_INDEX) || (keyLength > WMI_MAX_KEY_LEN) ||
(keyMaterial == NULL))
{
return A_EINVAL;
}
if ((WEP_CRYPT != keyType) && (NULL == keyRSC)) {
return A_EINVAL;
}
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_ADD_CIPHER_KEY_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->keyIndex = keyIndex;
cmd->keyType = keyType;
cmd->keyUsage = keyUsage;
cmd->keyLength = keyLength;
A_MEMCPY(cmd->key, keyMaterial, keyLength);
if (NULL != keyRSC) {
A_MEMCPY(cmd->keyRSC, keyRSC, sizeof(cmd->keyRSC));
}
return (wmi_cmd_send(wmip, osbuf, WMI_ADD_CIPHER_KEY_CMDID,
SYNC_BEFORE_WMIFLAG));
}
A_STATUS
wmi_deleteKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex)
{
void *osbuf;
WMI_DELETE_CIPHER_KEY_CMD *cmd;
if (keyIndex > WMI_MAX_KEY_INDEX) {
return A_EINVAL;
}
osbuf = a_netbuf_alloc(sizeof(*cmd));
if (osbuf == NULL) {
return A_NO_MEMORY;
}
a_netbuf_put(osbuf, sizeof(*cmd));
cmd = (WMI_DELETE_CIPHER_KEY_CMD *)(a_netbuf_to_data(osbuf));
A_MEMZERO(cmd, sizeof(*cmd));
cmd->keyIndex = keyIndex;
return (wmi_cmd_send(wmip, osbuf, WMI_DELETE_CIPHER_KEY_CMDID,
NO_SYNC_WMIFLAG));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -