mxm_wifiex: add nxp mxm_wifiex sdk

Add initial MxM (multi-chip-multi-interface) wifi driver.
The driver target is to support 88w8987/88w8997/88w9098,
currently it only supports 88w8987.

The MxM wifi driver is merged from below repo and applied some
patches for block and build issues.
ssh://git@bitbucket.sw.nxp.com/wcswrel/
rel-nxp-wifi-fp92-bt-fp85-linux-android-mxm4x17169-gpl.git

The sdk only includes application, the driver already is
merged into linux kernel.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
This commit is contained in:
Fugang Duan 2020-04-20 00:54:27 +08:00
parent a33aa6ef80
commit 33d9f8e4f3
98 changed files with 92650 additions and 0 deletions

View file

@ -0,0 +1,558 @@
# File: Makefile
#
# Copyright 2014-2020 NXP
#
# This software file (the File) is distributed by NXP
# under the terms of the GNU General Public License Version 2, June 1991
# (the License). You may use, redistribute and/or modify the File in
# accordance with the terms and conditions of the License, a copy of which
# is available by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
# worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
# IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
# ARE EXPRESSLY DISCLAIMED. The License provides additional details about
# this warranty disclaimer.
#
COMPATDIR=/lib/modules/$(KERNELVERSION_X86)/build/compat-wireless-3.2-rc1-1/include
ifeq ($(CC),)
CC= $(CROSS_COMPILE)gcc -I$(COMPATDIR)
endif
ifeq ($(LD),)
LD= $(CROSS_COMPILE)ld
endif
BACKUP= /root/backup
YMD= `date +%Y%m%d%H%M`
#############################################################################
# Configuration Options
#############################################################################
# Multi-chipsets
CONFIG_SD8887=n
CONFIG_SD8897=n
CONFIG_USB8897=n
CONFIG_PCIE8897=n
CONFIG_SD8977=n
CONFIG_SD8978=n
CONFIG_USB8978=n
CONFIG_SD8997=n
CONFIG_USB8997=n
CONFIG_PCIE8997=n
CONFIG_SD8987=y
CONFIG_SD9097=n
CONFIG_USB9097=n
CONFIG_PCIE9097=n
CONFIG_SD9098=n
CONFIG_USB9098=n
CONFIG_PCIE9098=n
# Debug Option
# DEBUG LEVEL n/1/2:
# n: NO DEBUG
# 1: Only PRINTM(MMSG,...), PRINTM(MFATAL,...), ...
# 2: All PRINTM()
CONFIG_DEBUG=1
# Enable STA mode support
CONFIG_STA_SUPPORT=y
# Enable uAP mode support
CONFIG_UAP_SUPPORT=y
# Enable WIFIDIRECT support
CONFIG_WIFI_DIRECT_SUPPORT=y
# Re-association in driver
CONFIG_REASSOCIATION=y
# Manufacturing firmware support
CONFIG_MFG_CMD_SUPPORT=y
# OpenWrt support
CONFIG_OPENWRT_SUPPORT=n
# Big-endian platform
CONFIG_BIG_ENDIAN=n
ifeq ($(CONFIG_DRV_EMBEDDED_SUPPLICANT), y)
CONFIG_EMBEDDED_SUPP_AUTH=y
else
ifeq ($(CONFIG_DRV_EMBEDDED_AUTHENTICATOR), y)
CONFIG_EMBEDDED_SUPP_AUTH=y
endif
endif
#ifdef SDIO_MMC
# SDIO suspend/resume
CONFIG_SDIO_SUSPEND_RESUME=y
#endif
# DFS testing support
CONFIG_DFS_TESTING_SUPPORT=y
CONFIG_ANDROID_KERNEL=n
#32bit app over 64bit kernel support
CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT=n
#############################################################################
# Select Platform Tools
#############################################################################
ccflags-y += -DLINUX
KERNELVERSION_X86 := $(shell uname -r)
KERNELDIR ?= /lib/modules/$(KERNELVERSION_X86)/build
LD += -S
BINDIR = ../bin_mxm_wifiex
APPDIR= $(shell if test -d "mapp"; then echo mapp; fi)
#############################################################################
# Compiler Flags
#############################################################################
ccflags-y += -I$(KERNELDIR)/include
ccflags-y += -DFPNUM='"92"'
ifeq ($(CONFIG_DEBUG),1)
ccflags-y += -DDEBUG_LEVEL1
endif
ifeq ($(CONFIG_DEBUG),2)
ccflags-y += -DDEBUG_LEVEL1
ccflags-y += -DDEBUG_LEVEL2
DBG= -dbg
endif
ifeq ($(CONFIG_64BIT), y)
ccflags-y += -DMLAN_64BIT
endif
ifeq ($(CONFIG_STA_SUPPORT),y)
ccflags-y += -DSTA_SUPPORT
ifeq ($(CONFIG_REASSOCIATION),y)
ccflags-y += -DREASSOCIATION
endif
else
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_STA_WEXT=n
CONFIG_STA_CFG80211=n
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
ccflags-y += -DUAP_SUPPORT
else
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_UAP_WEXT=n
CONFIG_UAP_CFG80211=n
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
ccflags-y += -DWIFI_DIRECT_SUPPORT
endif
ifeq ($(CONFIG_MFG_CMD_SUPPORT),y)
ccflags-y += -DMFG_CMD_SUPPORT
endif
ifeq ($(CONFIG_BIG_ENDIAN),y)
ccflags-y += -DBIG_ENDIAN_SUPPORT
endif
ifeq ($(CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT),y)
ccflags-y += -DUSERSPACE_32BIT_OVER_KERNEL_64BIT
endif
#ifdef SDIO_MMC
ifeq ($(CONFIG_SDIO_SUSPEND_RESUME),y)
ccflags-y += -DSDIO_SUSPEND_RESUME
endif
#endif
ifeq ($(CONFIG_DFS_TESTING_SUPPORT),y)
ccflags-y += -DDFS_TESTING_SUPPORT
endif
ifeq ($(CONFIG_ANDROID_KERNEL), y)
ccflags-y += -DANDROID_KERNEL
endif
ifeq ($(CONFIG_OPENWRT_SUPPORT), y)
ccflags-y += -DOPENWRT
endif
ifeq ($(CONFIG_T50), y)
ccflags-y += -DT50
ccflags-y += -DT40
ccflags-y += -DT3T
endif
ifeq ($(CONFIG_SD8887),y)
CONFIG_SDIO=y
ccflags-y += -DSD8887
endif
ifeq ($(CONFIG_SD8897),y)
CONFIG_SDIO=y
ccflags-y += -DSD8897
endif
ifeq ($(CONFIG_SD8977),y)
CONFIG_SDIO=y
ccflags-y += -DSD8977
endif
ifeq ($(CONFIG_SD8978),y)
CONFIG_SDIO=y
ccflags-y += -DSD8978
endif
ifeq ($(CONFIG_SD8997),y)
CONFIG_SDIO=y
ccflags-y += -DSD8997
endif
ifeq ($(CONFIG_SD8987),y)
CONFIG_SDIO=y
ccflags-y += -DSD8987
endif
ifeq ($(CONFIG_SD9097),y)
CONFIG_SDIO=y
ccflags-y += -DSD9097
endif
ifeq ($(CONFIG_SD9098),y)
CONFIG_SDIO=y
ccflags-y += -DSD9098
endif
ifeq ($(CONFIG_USB8897),y)
CONFIG_MUSB=y
ccflags-y += -DUSB8897
endif
ifeq ($(CONFIG_USB8997),y)
CONFIG_MUSB=y
ccflags-y += -DUSB8997
endif
ifeq ($(CONFIG_USB8978),y)
CONFIG_MUSB=y
ccflags-y += -DUSB8978
endif
ifeq ($(CONFIG_USB9097),y)
CONFIG_MUSB=y
ccflags-y += -DUSB9097
endif
ifeq ($(CONFIG_USB9098),y)
CONFIG_MUSB=y
ccflags-y += -DUSB9098
endif
ifeq ($(CONFIG_PCIE8897),y)
CONFIG_PCIE=y
ccflags-y += -DPCIE8897
endif
ifeq ($(CONFIG_PCIE8997),y)
CONFIG_PCIE=y
ccflags-y += -DPCIE8997
endif
ifeq ($(CONFIG_PCIE9097),y)
CONFIG_PCIE=y
ccflags-y += -DPCIE9097
endif
ifeq ($(CONFIG_PCIE9098),y)
CONFIG_PCIE=y
ccflags-y += -DPCIE9098
endif
ifeq ($(CONFIG_SDIO),y)
ccflags-y += -DSDIO
ccflags-y += -DSDIO_MMC
endif
ifeq ($(CONFIG_MUSB),y)
ccflags-y += -DUSB
endif
ifeq ($(CONFIG_PCIE),y)
ccflags-y += -DPCIE
endif
# add -Wno-packed-bitfield-compat when GCC version greater than 4.4
GCC_VERSION := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \>= 4.4 | sed -e 's/\./*100+/g' | bc )
ifeq ($(GCC_VERSION),1)
ccflags-y += -Wno-packed-bitfield-compat
endif
ccflags-y += -Wno-stringop-overflow
ccflags-y += -Wno-tautological-compare
#############################################################################
# Make Targets
#############################################################################
ifneq ($(KERNELRELEASE),)
ifeq ($(CONFIG_WIRELESS_EXT),y)
ifeq ($(CONFIG_WEXT_PRIV),y)
# Enable WEXT for STA
CONFIG_STA_WEXT=y
# Enable WEXT for uAP
CONFIG_UAP_WEXT=y
else
# Disable WEXT for STA
CONFIG_STA_WEXT=n
# Disable WEXT for uAP
CONFIG_UAP_WEXT=n
endif
endif
# Enable CFG80211 for STA
ifeq ($(CONFIG_CFG80211),y)
CONFIG_STA_CFG80211=y
else
ifeq ($(CONFIG_CFG80211),m)
CONFIG_STA_CFG80211=y
else
CONFIG_STA_CFG80211=n
endif
endif
# OpenWrt
ifeq ($(CONFIG_OPENWRT_SUPPORT), y)
ifeq ($(CPTCFG_CFG80211),y)
CONFIG_STA_CFG80211=y
else
ifeq ($(CPTCFG_CFG80211),m)
CONFIG_STA_CFG80211=y
else
CONFIG_STA_CFG80211=n
endif
endif
endif
# Enable CFG80211 for uAP
ifeq ($(CONFIG_CFG80211),y)
CONFIG_UAP_CFG80211=y
else
ifeq ($(CONFIG_CFG80211),m)
CONFIG_UAP_CFG80211=y
else
CONFIG_UAP_CFG80211=n
endif
endif
# OpenWrt
ifeq ($(CONFIG_OPENWRT_SUPPORT), y)
ifeq ($(CPTCFG_CFG80211),y)
CONFIG_STA_CFG80211=y
else
ifeq ($(CPTCFG_CFG80211),m)
CONFIG_STA_CFG80211=y
else
CONFIG_STA_CFG80211=n
endif
endif
endif
ifneq ($(CONFIG_STA_SUPPORT),y)
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_STA_WEXT=n
CONFIG_STA_CFG80211=n
endif
ifneq ($(CONFIG_UAP_SUPPORT),y)
CONFIG_WIFI_DIRECT_SUPPORT=n
CONFIG_UAP_WEXT=n
CONFIG_UAP_CFG80211=n
endif
ifeq ($(CONFIG_STA_SUPPORT),y)
ifeq ($(CONFIG_STA_WEXT),y)
ccflags-y += -DSTA_WEXT
endif
ifeq ($(CONFIG_STA_CFG80211),y)
ccflags-y += -DSTA_CFG80211
endif
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
ifeq ($(CONFIG_UAP_WEXT),y)
ccflags-y += -DUAP_WEXT
endif
ifeq ($(CONFIG_UAP_CFG80211),y)
ccflags-y += -DUAP_CFG80211
endif
endif
print:
ifeq ($(CONFIG_STA_SUPPORT),y)
ifeq ($(CONFIG_STA_WEXT),n)
ifeq ($(CONFIG_STA_CFG80211),n)
@echo "Can not build STA without WEXT or CFG80211"
exit 2
endif
endif
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
ifeq ($(CONFIG_UAP_WEXT),n)
ifeq ($(CONFIG_UAP_CFG80211),n)
@echo "Can not build UAP without WEXT or CFG80211"
exit 2
endif
endif
endif
# Otherwise we were called directly from the command line; invoke the kernel build system.
else
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
###############################################################
export CC LD ccflags-y KERNELDIR
ifeq ($(CONFIG_STA_SUPPORT),y)
ifeq ($(CONFIG_UAP_SUPPORT),y)
.PHONY: mapp/mlanconfig mapp/mlan2040coex mapp/mlanevent mapp/uaputl mapp/mlanutl clean distclean
else
.PHONY: mapp/mlanconfig mapp/mlanevent mapp/mlan2040coex mapp/mlanutl clean distclean
endif
else
ifeq ($(CONFIG_UAP_SUPPORT),y)
.PHONY: mapp/mlanevent mapp/uaputl clean distclean
endif
endif
@echo "Finished Making NXP Wlan Linux Driver"
ifeq ($(CONFIG_STA_SUPPORT),y)
mapp/mlanconfig:
$(MAKE) -C $@
mapp/mlanutl:
$(MAKE) -C $@
mapp/mlan2040coex:
$(MAKE) -C $@
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
mapp/uaputl:
$(MAKE) -C $@
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
mapp/wifidirectutl:
$(MAKE) -C $@
endif
mapp/mlanevent:
$(MAKE) -C $@
echo:
build: echo default
@if [ ! -d $(BINDIR) ]; then \
mkdir $(BINDIR); \
fi
cp -rpf script/load $(BINDIR)/
cp -rpf script/unload $(BINDIR)/
ifeq ($(CONFIG_MUSB),y)
cp -rpf script/usbconfig $(BINDIR)/
endif
ifeq ($(CONFIG_STA_SUPPORT),y)
cp -f README $(BINDIR)
cp -f README_MLAN $(BINDIR)
#cp -f README_RBC $(BINDIR)
ifneq ($(APPDIR),)
$(MAKE) -C mapp/mlanconfig $@ INSTALLDIR=$(BINDIR)
$(MAKE) -C mapp/mlanutl $@ INSTALLDIR=$(BINDIR)
$(MAKE) -C mapp/mlan2040coex $@ INSTALLDIR=$(BINDIR)
endif
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
#cp -f README_UAP $(BINDIR)
ifneq ($(APPDIR),)
$(MAKE) -C mapp/uaputl $@ INSTALLDIR=$(BINDIR)
endif
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
#cp -f README_WIFIDIRECT $(BINDIR)
cp -rpf script/wifidirect $(BINDIR)
ifneq ($(APPDIR),)
$(MAKE) -C mapp/wifidirectutl $@ INSTALLDIR=$(BINDIR)
endif
endif
ifneq ($(APPDIR),)
$(MAKE) -C mapp/mlanevent $@ INSTALLDIR=$(BINDIR)
endif
clean:
-find . -name "*.o" -exec rm {} \;
-find . -name "*.ko" -exec rm {} \;
-find . -name ".*.cmd" -exec rm {} \;
-find . -name "*.mod.c" -exec rm {} \;
-find . -name "*.mod" -exec rm {} \;
-find . -name "Module.symvers" -exec rm {} \;
-find . -name "Module.markers" -exec rm {} \;
-find . -name "modules.order" -exec rm {} \;
-find . -name ".*.dwo" -exec rm {} \;
-find . -name "*dwo" -exec rm {} \;
-rm -rf .tmp_versions
ifneq ($(APPDIR),)
ifeq ($(CONFIG_STA_SUPPORT),y)
$(MAKE) -C mapp/mlanconfig $@
$(MAKE) -C mapp/mlanutl $@
$(MAKE) -C mapp/mlan2040coex $@
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
$(MAKE) -C mapp/uaputl $@
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
$(MAKE) -C mapp/wifidirectutl $@
endif
$(MAKE) -C mapp/mlanevent $@
endif
#ifdef SDIO
#endif // SDIO
install: default
echo $(INSTALLDIR)
echo "MX Driver Installed"
distclean:
-find . -name "*.o" -exec rm {} \;
-find . -name "*.orig" -exec rm {} \;
-find . -name "*.swp" -exec rm {} \;
-find . -name "*.*~" -exec rm {} \;
-find . -name "*~" -exec rm {} \;
-find . -name "*.d" -exec rm {} \;
-find . -name "*.a" -exec rm {} \;
-find . -name "tags" -exec rm {} \;
-find . -name ".*" -exec rm -rf 2> /dev/null \;
-find . -name "*.ko" -exec rm {} \;
-find . -name ".*.cmd" -exec rm {} \;
-find . -name "*.mod.c" -exec rm {} \;
-find . -name ".*.dwo" -exec rm {} \;
-find . -name "*dwo" -exec rm {} \;
-rm -rf .tmp_versions
ifneq ($(APPDIR),)
ifeq ($(CONFIG_STA_SUPPORT),y)
$(MAKE) -C mapp/mlanconfig $@
$(MAKE) -C mapp/mlanutl $@
$(MAKE) -C mapp/mlan2040coex $@
endif
ifeq ($(CONFIG_UAP_SUPPORT),y)
$(MAKE) -C mapp/uaputl $@
endif
ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y)
$(MAKE) -C mapp/wifidirectutl $@
endif
$(MAKE) -C mapp/mlanevent $@
endif
# End of file

1125
mxm_wifiex/wlan_src/README Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View file

@ -0,0 +1,48 @@
#
# File : mlan2040coex/Makefile
#
# Copyright 2014-2020 NXP
# Path to the top directory of the mlandriver distribution
PATH_TO_TOP = ../..
# Determine how we should copy things to the install directory
ABSPATH := $(filter /%, $(INSTALLDIR))
RELPATH := $(filter-out /%, $(INSTALLDIR))
INSTALLPATH := $(ABSPATH)
ifeq ($(strip $(INSTALLPATH)),)
INSTALLPATH := $(PATH_TO_TOP)/$(RELPATH)
endif
# Override CFLAGS for application sources, remove __ kernel namespace defines
CFLAGS := $(filter-out -D__%, $(ccflags-y))
# remove KERNEL include dir
CFLAGS := $(filter-out -I$(KERNELDIR)%, $(CFLAGS))
#
# List of application executables to create
#
libobjs:= mlan2040coex.o mlan2040misc.o
exectarget=mlan2040coex
TARGETS := $(exectarget)
#
# Make target rules
#
# All rule compiles list of TARGETS using builtin program target from src rule
all :
$(exectarget): $(libobjs)
$(CC) $(CFLAGS) $(libobjs) -o $(exectarget)
# Update any needed TARGETS and then copy to the install path
build install: $(TARGETS)
@cp -f $(exectarget) $(INSTALLPATH)
clean:
@rm -f $(exectarget)
@rm -f *.o
distclean: clean
@rm -f *~ core
@rm -f tags

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,239 @@
/** @file mlan2040coex.h
*
* @brief This file contains definitions for application
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
06/24/2009: initial version
************************************************************************/
#ifndef _COEX_H_
#define _COEX_H_
/** NXP private command identifier */
#define CMD_NXP "MRVL_CMD"
/** IOCTL number */
#define MLAN_ETH_PRIV (SIOCDEVPRIVATE + 14)
#if (BYTE_ORDER == LITTLE_ENDIAN)
#undef BIG_ENDIAN_SUPPORT
#endif
/** 16 bits byte swap */
#define swap_byte_16(x) \
((t_u16)((((t_u16)(x) & 0x00ffU) << 8) | \
(((t_u16)(x) & 0xff00U) >> 8)))
/** 32 bits byte swap */
#define swap_byte_32(x) \
((t_u32)((((t_u32)(x) & 0x000000ffUL) << 24) | \
(((t_u32)(x) & 0x0000ff00UL) << 8) | \
(((t_u32)(x) & 0x00ff0000UL) >> 8) | \
(((t_u32)(x) & 0xff000000UL) >> 24)))
/** 64 bits byte swap */
#define swap_byte_64(x) \
((t_u64)((t_u64)(((t_u64)(x) & 0x00000000000000ffULL) << 56) | \
(t_u64)(((t_u64)(x) & 0x000000000000ff00ULL) << 40) | \
(t_u64)(((t_u64)(x) & 0x0000000000ff0000ULL) << 24) | \
(t_u64)(((t_u64)(x) & 0x00000000ff000000ULL) << 8) | \
(t_u64)(((t_u64)(x) & 0x000000ff00000000ULL) >> 8) | \
(t_u64)(((t_u64)(x) & 0x0000ff0000000000ULL) >> 24) | \
(t_u64)(((t_u64)(x) & 0x00ff000000000000ULL) >> 40) | \
(t_u64)(((t_u64)(x) & 0xff00000000000000ULL) >> 56) ))
/** Convert to correct endian format */
#ifdef BIG_ENDIAN_SUPPORT
/** CPU to little-endian convert for 16-bit */
#define cpu_to_le16(x) swap_byte_16(x)
/** CPU to little-endian convert for 32-bit */
#define cpu_to_le32(x) swap_byte_32(x)
/** CPU to little-endian convert for 64-bit */
#define cpu_to_le64(x) swap_byte_64(x)
/** Little-endian to CPU convert for 16-bit */
#define le16_to_cpu(x) swap_byte_16(x)
/** Little-endian to CPU convert for 32-bit */
#define le32_to_cpu(x) swap_byte_32(x)
/** Little-endian to CPU convert for 64-bit */
#define le64_to_cpu(x) swap_byte_64(x)
#else
/** Do nothing */
#define cpu_to_le16(x) (x)
/** Do nothing */
#define cpu_to_le32(x) (x)
/** Do nothing */
#define cpu_to_le64(x) (x)
/** Do nothing */
#define le16_to_cpu(x) (x)
/** Do nothing */
#define le32_to_cpu(x) (x)
/** Do nothing */
#define le64_to_cpu(x) (x)
#endif
#ifdef __GNUC__
/** Structure packing begins */
#define PACK_START
/** Structure packeing end */
#define PACK_END __attribute__ ((packed))
#else
/** Structure packing begins */
#define PACK_START __packed
/** Structure packeing end */
#define PACK_END
#endif
/** Character, 1 byte */
typedef signed char t_s8;
/** Unsigned character, 1 byte */
typedef unsigned char t_u8;
/** Short integer */
typedef signed short t_s16;
/** Unsigned short integer */
typedef unsigned short t_u16;
/** Integer */
typedef signed int t_s32;
/** Unsigned integer */
typedef unsigned int t_u32;
/** Long long integer */
typedef signed long long t_s64;
/** Unsigned long long integer */
typedef unsigned long long t_u64;
/** Void pointer (4-bytes) */
typedef void t_void;
#ifdef FALSE
#undef FALSE
#endif
#ifdef TRUE
#undef TRUE
#endif
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/** Type definition: boolean */
typedef enum { FALSE, TRUE } boolean;
/** Find number of elements */
#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
/** Success */
#define MLAN_STATUS_SUCCESS (0)
/** Failure */
#define MLAN_STATUS_FAILURE (-1)
/** Enumeration for host-command index */
enum COMMANDS {
CMD_2040COEX = 1,
};
/** Maximum number of channels that can be sent in a setuserscan ioctl */
#define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
#ifndef ETH_ALEN
/** MAC address length */
#define ETH_ALEN 6
#endif
/** Netlink protocol number */
#define NETLINK_NXP (MAX_LINKS - 1)
/** Netlink maximum payload size */
#define NL_MAX_PAYLOAD 1024
/** Netlink multicast group number */
#define NL_MULTICAST_GROUP RTMGRP_LINK
/** Default wait time in seconds for events */
#define UAP_RECV_WAIT_DEFAULT 10
#ifndef NLMSG_HDRLEN
/** NL message header length */
#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
#endif
/** Event header */
typedef PACK_START struct _event_header {
/** Event ID */
t_u32 event_id;
/** Event data */
t_u8 event_data[];
} PACK_END event_header;
/** Event ID length */
#define EVENT_ID_LEN 4
/** Custom events definitions */
/** AP connected event */
#define CUS_EVT_AP_CONNECTED "EVENT=AP_CONNECTED"
/** Custom event : BW changed */
#define CUS_EVT_BW_CHANGED "EVENT=BW_CHANGED"
/** Custom event : OBSS scan parameter */
#define CUS_EVT_OBSS_SCAN_PARAM "EVENT=OBSS_SCAN_PARAM"
/** Custom events definitions end */
/** Structure defination of chan_intol_t*/
typedef struct _chan_intol_t {
/** Channel numer */
t_u8 chan_num;
/** Flag: Is any 40MHz intolerant AP found in this channel */
t_u8 is_intol_set;
} chan_intol_t;
/** Private command structure */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
struct eth_priv_cmd {
/** Command buffer pointer */
t_u64 buf;
/** buffer updated by driver */
int used_len;
/** buffer sent by application */
int total_len;
} __ATTRIB_PACK__;
#else
struct eth_priv_cmd {
/** Command buffer */
t_u8 *buf;
/** Used length */
int used_len;
/** Total length */
int total_len;
};
#endif
/** Legacy APs channel list */
chan_intol_t leg_ap_chan_list[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
/** Total number of channel present in Legacy APs channel list */
t_u8 num_leg_ap_chan;
int get_region_code(int *reg_code);
int process_host_cmd(int cmd, t_u8 *chan_list, t_u8 chan_num, t_u8 reg_class,
t_u8 is_intol_ap_present);
int is_intolerant_sta(int *intol);
#endif /* _COEX_H_ */

View file

@ -0,0 +1,286 @@
/** @file mlan2040misc.c
*
* @brief This file contains helper functions for coex application
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
06/24/2009: initial version
************************************************************************/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "mlan2040coex.h"
#include "mlan2040misc.h"
/********************************************************
Local Variables
********************************************************/
/** Regulatory class and Channel mapping for various regions */
static class_chan_t us_class_chan_t[] = {
{32, {1, 2, 3, 4, 5, 6, 7}, 7},
{33, {5, 6, 7, 8, 9, 10, 11}, 7}
};
static class_chan_t europe_class_chan_t[] = {
{11, {1, 2, 3, 4, 5, 6, 7, 8, 9}, 9},
{12, {5, 6, 7, 8, 9, 10, 11, 12, 13}, 9}
};
static class_chan_t japan_class_chan_t[] = {
{56, {1, 2, 3, 4, 5, 6, 7, 8, 9}, 9},
{57, {5, 6, 7, 8, 9, 10, 11, 12, 13}, 9},
{58, {14}, 1}
};
/** Region-code(Regulatory domain) and Class-channel table mapping */
static region_class_chan_t region_class_chan_table[] = {
{0x10, us_class_chan_t, sizeof(us_class_chan_t) / sizeof(class_chan_t)} /* US */
,
{0x20, us_class_chan_t, sizeof(us_class_chan_t) / sizeof(class_chan_t)} /* CANADA */
,
{0x30, europe_class_chan_t, sizeof(europe_class_chan_t) / sizeof(class_chan_t)} /* EUROPE */
,
{0x32, europe_class_chan_t, sizeof(europe_class_chan_t) / sizeof(class_chan_t)} /* FRANCE */
,
{0x40, japan_class_chan_t, sizeof(japan_class_chan_t) / sizeof(class_chan_t)} /* JAPAN */
,
{0x41, japan_class_chan_t, sizeof(japan_class_chan_t) / sizeof(class_chan_t)} /* JAPAN */
,
{0x50, europe_class_chan_t, sizeof(europe_class_chan_t) / sizeof(class_chan_t)} /* CHINA */
};
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief This function prepares the channel list for a particular
* regulatory class from channel number for legacy AP
* @param cur_class_chan_table A pointer to the class_chan_t
* @param num_entry Number of entry in cur_class_chan_table table
* @param chan_list A pointer to the output channel list
* @param chan_num total number of channel in output channel list
* @param reg_domain regulatory domain
* @param reg_class regulatory class
* @param is_intol_ap_present It sets TRUE when 40MHz intolerant AP is found
* otherwise FALSE
* @return None
*/
static void
get_channels_for_specified_reg_class(class_chan_t *cur_class_chan_table,
int num_entry, t_u8 *chan_list,
t_u8 *chan_num, t_u8 reg_domain,
t_u8 reg_class, t_u8 *is_intol_ap_present)
{
int i, j, k, idx = 0;
*is_intol_ap_present = FALSE;
/* For each regulatory class */
for (i = 0; i < num_entry; i++) {
if (cur_class_chan_table[i].reg_class == reg_class) {
/* For each channel of the regulatory class */
for (j = 0; j < cur_class_chan_table[i].total_chan; j++) {
for (k = 0; k < num_leg_ap_chan; k++) {
if (cur_class_chan_table[i].
channels[j] ==
leg_ap_chan_list[k].chan_num) {
*(chan_list + idx) =
leg_ap_chan_list[k].
chan_num;
idx++;
if (leg_ap_chan_list[k].
is_intol_set)
*is_intol_ap_present =
TRUE;
}
}
}
break;
}
}
/* update the total number of channel */
*chan_num = idx--;
return;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief Prepare 2040 coex command buffer
* @param buf A pointer to the command buffer
* @param chan_list Channel list
* @param num_of_chan Number of channel present in channel list
* @param reg_class Regulatory class
* @param is_intol_ap_present Flag: is any 40 MHz intolerant AP
* is present in these chaanel set
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
void
prepare_coex_cmd_buff(t_u8 *buf, t_u8 *chan_list, t_u8 num_of_chan,
t_u8 reg_class, t_u8 is_intol_ap_present)
{
HostCmd_DS_GEN *hostcmd;
MrvlIETypes_2040COEX_t *coex_ie = NULL;
MrvlIETypes_2040BssIntolerantChannelReport_t *bss_intol_ie = NULL;
t_u8 *pos = NULL;
int intol;
hostcmd = (HostCmd_DS_GEN *)(buf + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_11N_2040COEX);
hostcmd->size = S_DS_GEN;
pos = buf + sizeof(t_u32) + S_DS_GEN;
{
coex_ie = (MrvlIETypes_2040COEX_t *)pos;
coex_ie->header.element_id = TLV_ID_2040COEX;
coex_ie->header.len = sizeof(coex_ie->coex_elem);
/* Check STA is 40 MHz intolerant or not */
is_intolerant_sta(&intol);
if (intol)
coex_ie->coex_elem |= MBIT(1);
if (is_intol_ap_present)
coex_ie->coex_elem |= MBIT(2);
pos += sizeof(MrvlIETypes_2040COEX_t);
hostcmd->size += sizeof(MrvlIETypes_2040COEX_t);
}
{
bss_intol_ie =
(MrvlIETypes_2040BssIntolerantChannelReport_t *)pos;
bss_intol_ie->header.element_id =
TLV_ID_2040BSS_INTOL_CHAN_REPORT;
hostcmd->size +=
sizeof(MrvlIETypes_2040BssIntolerantChannelReport_t) -
sizeof(bss_intol_ie->chan_num);
bss_intol_ie->reg_class = reg_class;
memcpy(bss_intol_ie->chan_num, chan_list, num_of_chan);
bss_intol_ie->header.len =
sizeof(bss_intol_ie->reg_class) + num_of_chan;
hostcmd->size += num_of_chan;
}
hostcmd->size = cpu_to_le16(hostcmd->size);
return;
}
/**
* @brief Invoke multiple 2040Coex commands for multiple regulatory classes
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
invoke_coex_command(void)
{
int cur_reg_domain;
t_u8 chan_list[MAX_CHAN], is_intol_ap_present;
t_u8 num_of_chan;
int i, num_entry, ret = MLAN_STATUS_SUCCESS;
class_chan_t *cur_class_chan_table = NULL;
/** get region code */
ret = get_region_code(&cur_reg_domain);
if (ret != MLAN_STATUS_SUCCESS)
return ret;
/** Find region_class_chan_table for this region */
for (i = 0;
(unsigned int)i <
(sizeof(region_class_chan_table) / sizeof(region_class_chan_t));
i++) {
if (region_class_chan_table[i].reg_domain == cur_reg_domain) {
cur_class_chan_table =
region_class_chan_table[i].class_chan_list;
num_entry =
region_class_chan_table[i].num_class_chan_entry;
break;
}
}
if (cur_class_chan_table == NULL) {
printf("No region_class_chan table found for this region\n");
return MLAN_STATUS_FAILURE;
}
for (i = 0; i < num_entry; i++) {
/** Get channels for the specified regulatory class */
get_channels_for_specified_reg_class(cur_class_chan_table,
num_entry, chan_list,
&num_of_chan,
cur_reg_domain,
cur_class_chan_table[i].
reg_class,
&is_intol_ap_present);
/** If any channel found for this regulatory class, then invoke the 2040coex command */
if (num_of_chan > 0) {
ret = process_host_cmd(CMD_2040COEX, chan_list,
num_of_chan,
cur_class_chan_table[i].
reg_class, is_intol_ap_present);
if (ret)
break;
}
}
return ret;
}
/**
* @brief Process host_cmd response
*
* @param cmd_name The command string
* @param buf A pointer to the response buffer
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_host_cmd_resp(char *cmd_name, t_u8 *buf)
{
t_u32 hostcmd_size = 0;
HostCmd_DS_GEN *hostcmd = NULL;
int ret = MLAN_STATUS_SUCCESS;
buf += strlen(CMD_NXP) + strlen(cmd_name);
memcpy((t_u8 *)&hostcmd_size, buf, sizeof(t_u32));
buf += sizeof(t_u32);
hostcmd = (HostCmd_DS_GEN *)buf;
hostcmd->command = le16_to_cpu(hostcmd->command);
hostcmd->size = le16_to_cpu(hostcmd->size);
hostcmd->command &= ~HostCmd_RET_BIT;
if (!le16_to_cpu(hostcmd->result)) {
switch (hostcmd->command) {
}
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
ret = MLAN_STATUS_FAILURE;
}
return ret;
}

View file

@ -0,0 +1,449 @@
/** @file mlan2040misc.h
*
* @brief This file contains command definitions for application
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
06/24/2009: initial version
************************************************************************/
#ifndef _COEX_MISC_H_
#define _COEX_MISC_H_
/** MLAN MAC Address Length */
#define MLAN_MAC_ADDR_LENGTH (6)
/** Size of command buffer */
#define MRVDRV_SIZE_OF_CMD_BUFFER (3 * 1024)
/** Command RET code, MSB is set to 1 */
#define HostCmd_RET_BIT 0x8000
/** General purpose action : Get */
#define HostCmd_ACT_GEN_GET 0x0000
/** General purpose action : Set */
#define HostCmd_ACT_GEN_SET 0x0001
/** TLV Id for 2040Coex IE */
#define TLV_ID_2040COEX 0x48
/** TLV Id for 2040BSS intolarent channel report IE */
#define TLV_ID_2040BSS_INTOL_CHAN_REPORT 0x49
/** Host-command for 2040coex command */
#define HostCmd_CMD_11N_2040COEX 0x00e9
/** Maximum scan response buffer size */
#define SCAN_RESP_BUF_SIZE 2000
/** Maximum length of SSID */
#define MRVDRV_MAX_SSID_LENGTH 32
/** Length of ethernet address */
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
/** Maximum length of SSID list */
#define MRVDRV_MAX_SSID_LIST_LENGTH 10
/** Default scan interval in second*/
#define DEFAULT_SCAN_INTERVAL 300
/** BIT value */
#define MBIT(x) (((t_u32)1) << (x))
/** Check intolerent bit set */
#define IS_INTOL_BIT_SET(cap_info) (cap_info & MBIT(14))
/** Check OBSS non-HT STAs present bit set */
#define IS_NON_HT_STA_PRESENT(ht_info) (ht_info.field3 & MBIT(4))
/** IEEE Type definitions */
typedef enum _IEEEtypes_ElementId_e {
SSID = 0,
SUPPORTED_RATES = 1,
FH_PARAM_SET = 2,
DS_PARAM_SET = 3,
CF_PARAM_SET = 4,
IBSS_PARAM_SET = 6,
HT_CAPABILITY = 45,
HT_OPERATION = 61,
BSSCO_2040 = 72,
OVERLAPBSSSCANPARAM = 74,
EXT_CAPABILITY = 127,
ERP_INFO = 42,
EXTENDED_SUPPORTED_RATES = 50,
VENDOR_SPECIFIC_221 = 221,
WMM_IE = VENDOR_SPECIFIC_221,
RSN_IE = 48,
} __attribute__ ((packed))
IEEEtypes_ElementId_e;
/** HT Capabilities Data */
typedef struct _HTCap_t {
/** HT Capabilities Info field */
t_u16 ht_cap_info;
/** A-MPDU Parameters field */
t_u8 ampdu_param;
/** Supported MCS Set field */
t_u8 supported_mcs_set[16];
/** HT Extended Capabilities field */
t_u16 ht_ext_cap;
/** Transmit Beamforming Capabilities field */
t_u32 tx_bf_cap;
/** Antenna Selection Capability field */
t_u8 asel;
/** Reserved set to 0 */
t_u16 reserved;
} __attribute__ ((packed))
HTCap_t, *pHTCap_t;
/** HT Information Data */
typedef struct _HTInfo_t {
/** Primary channel */
t_u8 pri_chan;
/** Field 2 */
t_u8 field2;
/** Field 3 */
t_u16 field3;
/** Field 4 */
t_u16 field4;
/** Bitmap indicating MCSs supported by all HT STAs in the BSS */
t_u8 basic_mcs_set[16];
/** Reserved set to 0 */
t_u16 reserved;
} __attribute__ ((packed))
HTInfo_t, *pHTInfo_t;
/** 20/40 BSS Coexistence Data */
typedef struct _BSSCo2040_t {
/** 20/40 BSS Coexistence value */
t_u8 bss_co_2040_value;
/** Reserve field */
t_u8 reserved[3];
} __attribute__ ((packed))
BSSCo2040_t, *pBSSCo2040_t;
/** Extended Capabilities Data */
typedef struct _ExtCap_t {
/** Extended Capabilities value */
t_u8 ext_cap_value;
/** Reserved field */
t_u8 reserved[3];
} __attribute__ ((packed))
ExtCap_t, *pExtCap_t;
/** Overlapping BSS Scan Parameters Data */
typedef struct _OverlapBSSScanParam_t {
/** OBSS Scan Passive Dwell */
t_u16 obss_scan_passive_dwell;
/** OBSS Scan Active Dwell */
t_u16 obss_scan_active_dwell;
/** BSS Channel Width Trigger Scan Interval */
t_u16 bss_chan_width_trigger_scan_int;
/** OBSS Scan Passive Total Per Channel */
t_u16 obss_scan_passive_total;
/** OBSS Scan Active Total Per Channel */
t_u16 obss_scan_active_total;
/** BSS Width Channel Transition Delay Factor */
t_u16 bss_width_chan_trans_delay;
/** OBSS Scan Activity Threshold */
t_u16 obss_scan_active_threshold;
} __attribute__ ((packed))
OBSSScanParam_t, *pOBSSScanParam_t;
/** IEEEtypes_CapInfo_t structure*/
typedef struct _IEEEtypes_CapInfo_t {
/** Capability Bit Map : ESS */
t_u8 ess:1;
/** Capability Bit Map : IBSS */
t_u8 ibss:1;
/** Capability Bit Map : CF pollable */
t_u8 cf_pollable:1;
/** Capability Bit Map : CF poll request */
t_u8 cf_poll_rqst:1;
/** Capability Bit Map : privacy */
t_u8 privacy:1;
/** Capability Bit Map : Short preamble */
t_u8 short_preamble:1;
/** Capability Bit Map : PBCC */
t_u8 pbcc:1;
/** Capability Bit Map : Channel agility */
t_u8 chan_agility:1;
/** Capability Bit Map : Spectrum management */
t_u8 spectrum_mgmt:1;
/** Capability Bit Map : Reserved */
t_u8 rsrvd3:1;
/** Capability Bit Map : Short slot time */
t_u8 short_slot_time:1;
/** Capability Bit Map : APSD */
t_u8 apsd:1;
/** Capability Bit Map : Reserved */
t_u8 rsvrd2:1;
/** Capability Bit Map : DSS OFDM */
t_u8 dsss_ofdm:1;
/** Capability Bit Map : Reserved */
t_u8 rsrvd1:2;
} __attribute__ ((packed))
IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t;
typedef struct {
t_u8 chan_number;
/**< Channel Number to scan */
t_u8 radio_type;
/**< Radio type: 'B/G' Band = 0, 'A' Band = 1 */
t_u8 scan_type;
/**< Scan type: Active = 1, Passive = 2 */
t_u8 reserved;
/**< Reserved */
t_u32 scan_time;
/**< Scan duration in milliseconds; if 0 default used */
} __attribute__ ((packed))
wlan_ioctl_user_scan_chan;
typedef struct {
char ssid[MRVDRV_MAX_SSID_LENGTH + 1];
/**< SSID */
t_u8 max_len; /**< Maximum length of SSID */
} __attribute__ ((packed))
wlan_ioctl_user_scan_ssid;
typedef struct {
/** Flag set to keep the previous scan table intact */
t_u8 keep_previous_scan; /* Do not erase the existing scan results */
/** BSS mode to be sent in the firmware command */
t_u8 bss_mode;
/** Configure the number of probe requests for active chan scans */
t_u8 num_probes;
/** Reserved */
t_u8 reserved;
/** BSSID filter sent in the firmware command to limit the results */
t_u8 specific_bssid[ETH_ALEN];
/** SSID filter list used in the to limit the scan results */
wlan_ioctl_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH];
/** Variable number (fixed maximum) of channels to scan up */
wlan_ioctl_user_scan_chan chan_list[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
} __attribute__ ((packed))
wlan_ioctl_user_scan_cfg;
/** IEEE IE header */
typedef struct _IEEEtypes_Header_t {
/** Element ID */
t_u8 element_id;
/** Length */
t_u8 len;
} __attribute__ ((packed))
IEEEtypes_Header_t, *pIEEEtypes_Header_t;
/** HT Capabilities IE */
typedef struct _IEEEtypes_HTCap_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** HTCap struct */
HTCap_t ht_cap;
} __attribute__ ((packed))
IEEEtypes_HTCap_t, *pIEEEtypes_HTCap_t;
/** HT Information IE */
typedef struct _IEEEtypes_HTInfo_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** HTInfo struct */
HTInfo_t ht_info;
} __attribute__ ((packed))
IEEEtypes_HTInfo_t, *pIEEEtypes_HTInfo_t;
/** 20/40 BSS Coexistence IE */
typedef struct _IEEEtypes_2040BSSCo_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** BSSCo2040_t struct */
BSSCo2040_t bss_co_2040;
} __attribute__ ((packed))
IEEEtypes_2040BSSCo_t, *pIEEEtypes_2040BSSCo_t;
/** Extended Capabilities IE */
typedef struct _IEEEtypes_ExtCap_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** ExtCap_t struct */
ExtCap_t ext_cap;
} __attribute__ ((packed))
IEEEtypes_ExtCap_t, *pIEEEtypes_ExtCap_t;
/** Overlapping BSS Scan Parameters IE */
typedef struct _IEEEtypes_OverlapBSSScanParam_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** OBSSScanParam_t struct */
OBSSScanParam_t obss_scan_param;
} __attribute__ ((packed))
IEEEtypes_OverlapBSSScanParam_t, *pIEEEtypes_OverlapBSSScanParam_t;
typedef struct _wlan_get_scan_table_fixed {
/** BSSID of this network */
t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
/** Channel this beacon/probe response was detected */
t_u8 channel;
/** RSSI for the received packet */
t_u8 rssi;
/** TSF value from the firmware at packet reception */
t_u64 network_tsf;
} wlan_get_scan_table_fixed;
/**
* Structure passed in the wlan_ioctl_get_scan_table_info for each
* BSS returned in the WLAN_GET_SCAN_RESP IOCTL
*/
typedef struct _wlan_ioctl_get_scan_table_entry {
/**
* Fixed field length included in the response.
*
* Length value is included so future fixed fields can be added to the
* response without breaking backwards compatibility. Use the length
* to find the offset for the bssInfoLength field, not a sizeof() calc.
*/
t_u32 fixed_field_length;
/**
* Length of the BSS Information (probe resp or beacon) that
* follows starting at bssInfoBuffer
*/
t_u32 bss_info_length;
/**
* Always present, fixed length data fields for the BSS
*/
wlan_get_scan_table_fixed fixed_fields;
/*
* Probe response or beacon scanned for the BSS.
*
* Field layout:
* - TSF 8 octets
* - Beacon Interval 2 octets
* - Capability Info 2 octets
*
* - IEEE Infomation Elements; variable number & length per 802.11 spec
*/
/* t_u8 bss_info_buffer[1]; */
} wlan_ioctl_get_scan_table_entry;
/**
* Sructure to retrieve the scan table
*/
typedef struct {
/**
* - Zero based scan entry to start retrieval in command request
* - Number of scans entries returned in command response
*/
t_u32 scan_number;
/**
* Buffer marker for multiple wlan_ioctl_get_scan_table_entry structures.
* Each struct is padded to the nearest 32 bit boundary.
*/
t_u8 scan_table_entry_buf[1];
} wlan_ioctl_get_scan_table_info;
/* Define general hostcmd data structure */
/** HostCmd_DS_GEN */
typedef struct _HostCmd_DS_GEN {
/** Command */
t_u16 command;
/** Size */
t_u16 size;
/** Sequence number */
t_u16 seq_num;
/** Result */
t_u16 result;
} __attribute__ ((packed))
HostCmd_DS_GEN;
/** Size of HostCmd_DS_GEN */
#define S_DS_GEN sizeof(HostCmd_DS_GEN)
/** TLV related data structures*/
/** MrvlIEtypesHeader_t */
typedef struct _MrvlIEtypesHeader {
/** Header type */
t_u16 type;
/** Header length */
t_u16 len;
} __attribute__ ((packed))
MrvlIEtypesHeader_t;
/** _MrvlIETypes_2040BssIntolerantChannelReport_t */
typedef struct _MrvlIETypes_2040BssIntolerantChannelReport_t {
/** Header */
IEEEtypes_Header_t header;
/** regulatory class */
t_u8 reg_class;
/** channel numbers for legacy AP */
t_u8 chan_num[1];
} __attribute__ ((packed))
MrvlIETypes_2040BssIntolerantChannelReport_t;
/** MrvlIETypes_2040COEX_t */
typedef struct _MrvlIETypes_2040COEX_t {
/** Header */
IEEEtypes_Header_t header;
/** 2040 coex element */
t_u8 coex_elem;
} __attribute__ ((packed))
MrvlIETypes_2040COEX_t;
typedef struct _HostCmd_DS_CMD_11N_2040COEX {
/** 2040 coex element */
MrvlIETypes_2040COEX_t coex;
/** 2040 BSS intolerant channel report*/
MrvlIETypes_2040BssIntolerantChannelReport_t chan_intol_report;
} __attribute__ ((packed))
HostCmd_DS_CMD_11N_2040COEX;
/** Maximum number of channel per regulatory class */
#define MAX_CHAN 20
typedef struct _class_chan_t {
/** Regulatory class */
t_u8 reg_class;
/** Channel numbers */
t_u8 channels[MAX_CHAN];
/** Total number of channels */
t_u8 total_chan;
} class_chan_t;
typedef struct _region_class_chan_t {
/** Regulatory domain */
int reg_domain;
/** Channel numbers */
class_chan_t *class_chan_list;
/** Number of class channel table entry */
int num_class_chan_entry;
} region_class_chan_t;
int process_host_cmd_resp(char *cmd_name, t_u8 *buf);
void prepare_coex_cmd_buff(t_u8 *buf, t_u8 *chan_list, t_u8 num_of_chan,
t_u8 reg_class, t_u8 is_intol_ap_present);
int invoke_coex_command(void);
#endif /* _COEX_MISC_H_ */

View file

@ -0,0 +1,48 @@
#
# File : mlanconfig/Makefile
#
# Copyright 2014-2020 NXP
# Path to the top directory of the mlandriver distribution
PATH_TO_TOP = ../..
# Determine how we should copy things to the install directory
ABSPATH := $(filter /%, $(INSTALLDIR))
RELPATH := $(filter-out /%, $(INSTALLDIR))
INSTALLPATH := $(ABSPATH)
ifeq ($(strip $(INSTALLPATH)),)
INSTALLPATH := $(PATH_TO_TOP)/$(RELPATH)
endif
# Override CFLAGS for application sources, remove __ kernel namespace defines
CFLAGS := $(filter-out -D__%, $(ccflags-y))
# remove KERNEL include dir
CFLAGS := $(filter-out -I$(KERNELDIR)%, $(CFLAGS))
#
# List of application executables to create
#
libobjs:= mlanconfig.o mlanhostcmd.o mlanmisc.o
exectarget=mlanconfig
TARGETS := $(exectarget)
#
# Make target rules
#
# All rule compiles list of TARGETS using builtin program target from src rule
all :
$(exectarget): $(libobjs)
$(CC) $(CFLAGS) $(libobjs) -o $(exectarget)
# Update any needed TARGETS and then copy to the install path
build install: $(TARGETS)
@cp -rf config $(INSTALLPATH)
clean:
@rm -f $(exectarget)
@rm -f *.o
distclean: clean
@rm -f *~ core
@rm -f tags

View file

@ -0,0 +1,49 @@
#Band config
[Band]
# band config, 1: 2.4G, 2: 5G
02
[/Band]
# HE Capability
[HECap]
# ID
ff 00
# Length
1a 00
# he capability id
23
# HE MAC capability info
01 00 00 82 00 08
# HE PHY capability info
04 70 7e c9 fd 01 a0 0e 03 3d 00
# Tx Rx HE-MCS NSS support
fa ff fa ff
# PPE Thresholds (optional)
# PE: 16 us
e1 ff c7 71
[/HECap]
####### UAP HE cap ############
#Band config
#[Band]
# band config, 1: 2.4G, 2: 5G
#02
#[/Band]
# HE Capability
#[HECap]
# ID
#ff 00
# Length
#1a 00
# he capability id
#23
# HE MAC capability info
#00 00 00 00 00 00
# Enable PPE Threshold
#04 20 0e c9 fe 0b a0 0e 01 20 00
# Tx Rx HE-MCS NSS support
#fa ff fa ff
# PPE Thresholds (optional)
# PE: 16 us
#e1 ff c7 71
#[/HECap]

View file

@ -0,0 +1,21 @@
# File : 11n_2040coex.conf
######################### 20/40 Coex command ##################
2040coex={
CmdCode=0x00e9 # do NOT change this line
2040CoexTlvType:1=0x48
2040CoexTlvLen:1={
2040CoexElement:1=0x04
}
2040BssIntlChanTlvType:1=0x49
2040BssIntlChanTlvLen:1={
RegulatoryDomain:1=32 # USA: 32 (1-7), 33 (5-11)
ChannelNum:1=1
ChannelNum:1=2
# ...
}
}
##################################################################

View file

@ -0,0 +1,54 @@
# File : auto_tx.conf
######################### Auto-TX command ##################
auto_tx_get={
CmdCode=0x0082 # do NOT change this line
Action:2=0 # GET
}
auto_tx_unreg={
CmdCode=0x0082 # do NOT change this line
Action:2=1 # SET
}
nat_keep_alive={
CmdCode=0x0082 # do NOT change this line
Action:2=1 # SET
AutoTxTlvType:2=0x0118
AutoTxTlvLength:2={ # 58 = 6 + 52 (FrameLen)
Interval:2=2 # 1 - 3600 seconds
Priority:1=7 # Priority, ignored if non-WMM
Reserved:1=0
FrameLength:2={ # 52 = 6 (DA) + 6 (SA) + 2 + 38 (Length)
DestMacAddr:6='0x00,0x40,0xf4,0xbf,0x24,0xee'
SrcMacAddr:6='0x00,0x00,0x00,0x00,0x00,0x00'
Length:2='0x00,38' # 38 = 8 (SNAP hdr) + 29 (IP) + 1 (padding)
DSAP:1=0xaa # SNAP header
SSAP:1=0xaa
Ctrl:1=0x03
SNAP_OUI:3='0x00,0x00,0x00'
SNAP_PID:2='0x08,0x00' # IP Packet
IPv4:1=0x45
IP_TOS:1=0x00
IP_LEN:2='0x00,29' # IP hdr 20 + payload 9 = 29
IP_ID:2=0xefbe
IP_Flag_FragOffset:2=0x0000
IP_TTL:1=128
IP_Prot:1=17 # UDP protocol
IPhdr_cksum:2=0xc5f9 # may need re-calculation if changed
IPsrcAddr:4='192,168,0,201' # 192.168.0.201
IPdstAddr:4='192,168,0,1' # 192.168.0.1
UDPsrcPort:2='0x11,0x94' # 4500
UDPdstPort:2='0x11,0x94' # 4500
UDPlength:2='0x00,9' # UDP hdr 8 + payload 1 = 9
UDPcksum:2=0x985b # may need re-calculation if changed
UDPpayload:1=0xff
padding:1=0 # MAC Padding for 32bit alignment, set to 0
}
}
}
######################### Auto-TX command ##################

View file

@ -0,0 +1,16 @@
# File : band_steering_cfg.conf
######################### band steering configure command ##################
band_steering_cfg={
CmdCode=0x026f # do NOT change this line
Action:1=7 # Action = BIT0|BIT1|BIT2,
# BIT0: State take effect
# BIT1: or this bit if want change Block2gPrbReq
# BIT2: OR this bit if want change MaxBtmReqAllowed
State:1 = 1 # 0: disable Band steering, 1: enable bandsteering
Block2gPrbReq:1=5 # 0~15, the number of probe requests to block before allowing response for the STA
MaxBtmReqAllowed:1=3 # 0~15,max bss_transition requests to station
}

View file

@ -0,0 +1,157 @@
# File : bg_scan.conf
######################### BG Scan Configuration command ##################
########### Sample configuration for Get BG Scan Configuration #####################
#bgscfg={
# CmdCode=0x006b # do NOT change this line
# Action:1=0 # 0- Get, 1- Set
# ConfigType:1=0 # 0- normal BG Scan config, 1-PPS or UAPSD BG Scan config
# Enable:1=1 # 0- Disable, 1-Enable
# BssType:1=0 # 1 - Infrastructure,2 - IBSS,3 - Any
# ChannelsPerScan:1=0 # Number of Channel to scan at one scan; maximum 14
# Reserved1:3=0
# ScanInterval:4=0 # Interval between consecutive scan (in milliseconds)
# Reserved2:4=0
# ReportConditions:4=0 # bit0 - SSID match
# bit1 - SNR above SNR threshold
# bit2 - RSSI above RSSI threshold
# bit31 - All channels scanned at least once
# Reserved3:2=0
#}
########### SET BG Scan Configuration #####################
bgscfg={
CmdCode=0x006b # do NOT change this line
Action:1=1 # 0- Get, 1- Set
ConfigType:1=0 # 0- normal BG Scan config, 1-PPS or UAPSD BG Scan config
Enable:1=1 # 0- Disable, 1-Enable
BssType:1=3 # 1 - Infrastructure,2 - IBSS,3 - Any
ChannelsPerScan:1=14 # Number of Channel to scan at one scan; maximum 14
Reserved1:3=0
ScanInterval:4=1000 # Interval between consecutive scan (in milliseconds)
Reserved2:4=0
ReportConditions:4=1 # bit0 - SSID match
# bit1 - SNR above SNR threshold
# bit2 - RSSI above RSSI threshold
# bit31 - All channels scanned at least once
Reserved3:2=0
# SSID parameter set:
#
# MaxSSIDLen entries:
#
# 1. MaxSSIDLen:1=0x00 - to denote match AP name exactly,
# generate SSID specific probes
# 2. MaxSSIDLen:1=maxlen - to denote AP name will be use to base match the
# SSID and SSID's max length is 'maxlen',
# do not generate SSID specific probes
# 3. MaxSSIDLen:1=wildcard match char ('*' or '?')
# - to denote wildcard AP name will be use to match the SSID
# 4. MaxSSIDLen:1=0xff - to denote unix pattern matching
#
# SSID entries:
#
# SSID="AP_NAME" - to mention the SSID to match
# SSID Examples:
#
#
# Match SSID name "NXPAP" exactly, generate SSID specific probes
#
SSIDHeaderType:2=0x0112
SSIDHeaderLen:2={
MaxSSIDLen:1=0x00
SSID:9="NXPAP"
}
#
# NXPAP will be use to base match the SSID and SSID's max length is 12
#
# SSIDHeaderType:2=0x0112
# SSIDHeaderLen:2={
# MaxSSIDLen:1=0x0c
# SSID:9="NXPAP"
# }
#
# Match "NXPAP*" where '*' is a single char
#
# SSIDHeaderType:2=0x0112
# SSIDHeaderLen:2={
# MaxSSIDLen:1='*'
# SSID:10="NXPAP*"
# }
#
# Match "Mar?ell*" with unix pattern matching
#
# SSIDHeaderType:2=0x0112
# SSIDHeaderLen:2={
# MaxSSIDLen:1=0xff # For unix pattern matching
# SSID:8="Mar?ell*"
# }
# Number Probe requests to be sent for broadcast and
# for each SSID specific scan required.
#
# If any SSID in the list has a non-zero modifier (wildcard match char,
# unix pattern match, maxlen), "Numprobes" of broadcast probe requests
# will be transmitted once per channel and the results matched against
# all entries.
#
# Set to 0 to use global scan probes setting
#
ProbeHeaderType:2=0x0102
ProbeHeaderLen:2={
NumProbes:2=2
}
# ChannelList contains the channels to scan
# The ChannelList should be specified in the form of
#
# RadioType, ChanNumber, ScanType, MinScanTime, ScanTime;
#
# RadioType - 0 [B/G Band], 1 [A Band]
# ScanType - 2 [Active], 3 [Passive]
#
ChannHeaderType:2=0x0101
ChannHeaderLen:2={
Chan1_RadioType:1=0
Chan1_ChanNumber:1=10
Chan1_ScanType:1=2
Chan1_MinScanTime:2=10
Chan1_ScanTime:2=100
Chan2_RadioType:1=0
Chan2_ChanNumber:1=6
Chan2_ScanType:1=3
Chan2_MinScanTime:2=10
Chan2_ScanTime:2=100
}
# SNR threshold used when ReportConditions bit1 is set
SNRHeaderType:2=0x0105
SNRHeaderLen:2={
SNRValue:1=40 #SNR Thereshold Value
SNRFreq:1=0
}
# RSSI threshold used when ReportConditions bit2 is set
#
# Threshold is absolute value and match value would
# therefore be less than or equal to trigger a report
RSSIHeaderType:2=0x0104
RSSIHeaderLen:2={
RSSIValue:1=50 #RSSI Thereshold Value
RSSIFreq:1=0
}
# StartLaterValue: 0 - BGScan start immediately
# 1 - BGScan will start later after "Scan Interval"
StartLaterHeaderType:2=0x011e
StartLaterHeaderLen:2={
StartLaterValue:2=0
}
}
######################### BG Scan Configuration command ##################

View file

@ -0,0 +1,88 @@
# File : bg_scan_wifidirect.conf
######################### BG Scan Configuration command ##################
########### SET BG Scan Configuration #####################
bgscfg={
CmdCode=0x006b # do NOT change this line
Action:1=1 # 0- Get, 1- Set
ConfigType:1=0 # 0- normal BG Scan config, 1-PPS or UAPSD BG Scan config
Enable:1=1 # 0- Disable, 1-Enable
BssType:1=3 # 1 - Infrastructure,2 - IBSS,3 - Any
ChannelsPerScan:1=3 # Number of Channel to scan at one scan; maximum 14
Reserved1:3=0
ScanInterval:4=1000 # Interval between consecutive scan (in milliseconds)
StoreCondition:4=1 # 1 - SSID match (bit 0)
# 2 - SSID match AND SNR above SNR threshold (bit 1)
ReportConditions:4=1 # 1 - SSID match (bit 0)
# 2 - SSID match AND SNR above SNR threshold (bit 1)
Reserved3:2=0
# SSID parameter set:
#
SSIDHeaderType:2=0x0112
SSIDHeaderLen:2={
MaxSSIDLen:1=0x00
SSID:7="DIRECT-"
}
# Number Probe requests to be sent for broadcast and
# for each SSID specific scan required.
#
# If any SSID in the list has a non-zero modifier (wildcard match char,
# unix pattern match, maxlen), "Numprobes" of broadcast probe requests
# will be transmitted once per channel and the results matched against
# all entries.
#
# Set to 0 to use global scan probes setting
#
ProbeHeaderType:2=0x0102
ProbeHeaderLen:2={
NumProbes:2=2
}
# ChannelList contains the channels to scan
# The ChannelList should be specified in the form of
#
# RadioType, ChanNumber, ScanType, MinScanTime, ScanTime;
#
# RadioType - 0 [B/G Band], 1 [A Band]
# ScanType - 2 [Active], 3 [Passive]
#
ChannHeaderType:2=0x0101
ChannHeaderLen:2={
Chan1_RadioType:1=0
Chan1_ChanNumber:1=1
Chan1_ScanType:1=2
Chan1_MinScanTime:2=10
Chan1_ScanTime:2=100
Chan2_RadioType:1=0
Chan2_ChanNumber:1=6
Chan2_ScanType:1=2
Chan2_MinScanTime:2=10
Chan2_ScanTime:2=100
Chan3_RadioType:1=0
Chan3_ChanNumber:1=11
Chan3_ScanType:1=2
Chan3_MinScanTime:2=10
Chan3_ScanTime:2=100
}
# SNR threshold to match, when StoreCondition
# or ReportConditions been set to 2
SNRHeaderType:2=0x0105
SNRHeaderLen:2={
SNRValue:1=40 #SNR Thereshold Value
SNRFreq:1=0
}
# StartLaterValue: 0 - BGScan start immediately
# 1 - BGScan will start later after "Scan Interval"
StartLaterHeaderType:2=0x011e
StartLaterHeaderLen:2={
StartLaterValue:2=0
}
}
######################### BG Scan Configuration command ##################

View file

@ -0,0 +1,58 @@
# File : crypto_test.conf
######################### crypto_test command configuration ##################
# support algorithm:1-RC4, 2-AES, 3-AES_KEY_WRAP,4-AES-CCM
crypto_test={
CmdCode=0x0078 # do NOT change this line
#EncDec: 0-Decrypt, 1-Encrypt
EncDec:2=0
#Algorithm: 1-RC4, 2-AES, 3-AES_KEY_WRAP
Algorithm:2=1
#KeyIVLength: Length of KeyIV (bytes)
KeyIVLength:2=8
#KeyIV: Key IV
KeyIV:32='0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11'
#KeyLength: Length of Key (bytes)
KeyLength:2=16
#Key: Key
Key:32='0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22'
#DataType: DataType
DataType:2=0x0111
#DataLength: Data Length
DataLength:2={
#Data: Data
Data:8='0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33'
}
}
#####Sample crypto_test command configuration for AES-CCM algorithm #########
#crypto_test={
# CmdCode=0x0078 # do NOT change this line
# #EncDec: 0-Decrypt, 1-Encrypt
# EncDec:2=1
# #Algorithm: 4-AES-CCM
# Algorithm:2=4
# #KeyLength: Length of Key (bytes)
# KeyLength:2=16
# #Key: Key
# Key:32='0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22'
# #NonceLength: Length of Nonce (bytes)
# NonceLength:2=10
# #Nonce: Nonce
# Nonce:14='0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11'
# #AADLength: Length of AAD (bytes)
# AADLength:2=12
# #AAD: AAD
# AAD:32='0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33'
# #DataType: DataType
# DataType:2=0x0111
# #DataLength: Data Length
# DataLength:2={
# #Data: Data
# Data:8='0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33'
# }
#}
######################### End of crypto_test configuration command ##################

View file

@ -0,0 +1,51 @@
#CW_MODE settings configuration
#
CW_MODE={
#Mode of operation 0: Disable current Tx Mode, 1: Continuous Tx Packet, 2: Continuous Wave/Tone
Mode=1
#Channel number
Channel=6
#channel Info
#bit [3:0] - channel offset 0: no secondary channel, 1: secondary channel above, 2: reserved, 3: secondary channel below
#bit [4:7] - channel band 0: 2.4G, 1: 5G, 2: 4G, 3: reserved
Chaninfo=0x00
#Tx power for Cont Tx in dbm
TxPower=12
# Packet Length for Cont Tx
# legacy rates: upto 2312, HT/VHT rates: upto 8K
PktLength=2048
#RateInfo for Cont Tx
RateInfo=0x0000
#rateInfo = 0x0732 : format = VHT, Bandwidth = 80MHz, datarate/MCS index = MCS7
#rateInfo = 0x0000 : format = legacy, Bandwidth = 20MHz, datarate/MCS index = 1Mbps
#rateInfo = 0x0521 : format = HT, Bandwidth = 40MHz, datarate/MCS index = MCS5
#rateInfo = 0x4521 : format = HT, Bandwidth = 40MHz, datarate/MCS index = MCS5, NSS = 1
#rateInfo = 0x8921 : format = HT, Bandwidth = 40MHz, datarate/MCS index = MCS9, NSS = 2
#bit [1:0] - Format 0: legacy, 1: 11n (HT), 2: 11ac (VHT)
#bit 2 - STBC (Not used for Cont Tx test)
#bit 3 - Beamforming (Not used for Cont Tx test)
#bit [5:4] - Bandwidth 0: 20MHz, 2: 40MHz, 3: 80MHz
#bit [7:6] - reserved
#bit [13:8] - index : data rate or MCS
#bit [15:14]- NSS (Used for 2x2 chips). Used in FW only for 2x2 chips.
#<index> can take following values.
#If <format> is 0 (LG), #If <format> is 1 (HT) #If <format> is 2 (VHT)
# NSS = 1 NSS = 1 or 2
# 0 1 Mbps 0 MCS0 0 MCS0
# 1 2 Mbps 1 MCS1 1 MCS1
# 2 5.5 Mbps 2 MCS2 2 MCS2
# 3 11 Mbps 3 MCS3 3 MCS3
# 5 6 Mbps 4 MCS4 4 MCS4
# 6 9 Mbps 5 MCS5 5 MCS5
# 7 12 Mbps 6 MCS6 6 MCS6
# 8 18 Mbps 7 MCS7 7 MCS7
# Used only for NSS = 2
# 9 24 Mbps 8 MCS8
# 10 36 Mbps 9 MCS9
# 11 48 Mbps 10 MCS10
# 12 54 Mbps 11 MCS11
# 12 MCS12
# 13 MCS13
# 14 MCS14
# 15 MCS15
}

View file

@ -0,0 +1,89 @@
#
# File: debug.conf
# 11ax configuration commands
#
enable_thermal_mgmt={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x113 # THERMAL_MANAGEMENT
Value:1=1 # 1 -- ENABLE;
}
disable_thermal_mgmt={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x113 # THERMAL_MANAGEMENT
Value:1=0 # 0 -- DISABLE;
}
get_thermal_mgmt={
CmdCode=0x008b # do NOT change this line
Action:2=0 # 0 - GET
SUBID:2=0x113 # THERMAL_MANAGEMENT
Value:1=0 # 1 -- ENABLE;
# 0 -- DISABLE;
}
stop_su={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x101 # DOT11AX_ULOFDMA
Value:4=1 # 1 -- stop_su;
# 0 -- resume su;
}
start_su={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x101 # DOT11AX_ULOFDMA
Value:4=0 # 1 -- stop_su;
# 0 -- resume su;
}
stop_forceRTS={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x104 # DOT11AX_ULOFDMA
Value:1=0 # 1 -- stop forceRTS;
# 0 -- start forceRTS;
}
start_forceRTS={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x104 # DOT11AX_ULOFDMA
Value:1=1 # 1 -- start forceRTS;
# 0 -- stop forceRTS;
}
set_nonampdu_txctrl_watermark={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x116 # NON_AMPDU_TX_CTRL
non_ampdu_tx_water_mark.TlvType:2=0x101
non_ampdu_tx_water_mark.TlvLength:2={
non_ampdu_tx_high_water_mark:1=0x20
non_ampdu_tx_low_water_mark:1=0x8
}
}
enable_nonampdu_txctrl={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x116 # NON_AMPDU_TX_CTRL
non_ampdu_tx_ctrl.TlvType:2=0x102
non_ampdu_tx_ctrl.TlvLength:2={
non_ampdu_tx_ctrl:1=0x1
}
}
disable_nonampdu_txctrl={
CmdCode=0x008b # do NOT change this line
Action:2=1 # 1 - SET
SUBID:2=0x116 # NON_AMPDU_TX_CTRL
non_ampdu_tx_ctrl.TlvType:2=0x102
non_ampdu_tx_ctrl.TlvLength:2={
non_ampdu_tx_ctrl:1=0x0
}
}

View file

@ -0,0 +1,29 @@
# File : ed_mac_ctrl_V2_8887.conf
#
# ed_mac_ctrl_v2 is used for 88W8897, 88W8887, 88W8797, 88W8782, 88W8787
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V2_8887.conf ed_mac_ctrl_v2
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v2={
CmdCode=0x0130 #Command code, DO NOT change this line
ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band
# 1 - enable EU adaptivity for 2.4GHz band
ed_ctrl_2g.offset:2=0x0 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_2g.on_period:2=0x12 #DO NOT Change this line
ed_ctrl_2g.off_period:2=0x0 #DO NOT Change this line
ed_ctrl_2g.bitmap:2=0x1 #DO NOT Change this line
ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band
# 1 - enable EU adaptivity for 5GHz band
ed_ctrl_5g.offset:2=0x6 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_5g.on_period:2=0x12 #DO NOT Change this line
ed_ctrl_5g.off_period:2=0x0 #DO NOT Change this line
ed_ctrl_5g.bitmap:2=0x1 #DO NOT Change this line
}

View file

@ -0,0 +1,29 @@
# File : ed_mac_ctrl_V2_8897.conf
#
# ed_mac_ctrl_v2 is used for 88W8897, 88W8887, 88W8797, 88W8782, 88W8787
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V2_8897.conf ed_mac_ctrl_v2
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v2={
CmdCode=0x0130 #Command code, DO NOT change this line
ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band
# 1 - enable EU adaptivity for 2.4GHz band
ed_ctrl_2g.offset:2=0x0 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_2g.on_period:2=0x12 #DO NOT Change this line
ed_ctrl_2g.off_period:2=0x0 #DO NOT Change this line
ed_ctrl_2g.bitmap:2=0x1 #DO NOT Change this line
ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band
# 1 - enable EU adaptivity for 5GHz band
ed_ctrl_5g.offset:2=0x4 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_5g.on_period:2=0x12 #DO NOT Change this line
ed_ctrl_5g.off_period:2=0x0 #DO NOT Change this line
ed_ctrl_5g.bitmap:2=0x1 #DO NOT Change this line
}

View file

@ -0,0 +1,23 @@
# File : ed_mac_ctrl_V3_8977.conf
#
# ed_mac_ctrl_v3 is used for 88W8997, 88W8987, 88W8977
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_8977.conf ed_mac_ctrl_v3
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v3={
CmdCode=0x0130 #Command code, DO NOT change this line
ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band
# 1 - enable EU adaptivity for 2.4GHz band
ed_ctrl_2g.offset:2=0x9 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band
# 1 - enable EU adaptivity for 5GHz band
ed_ctrl_5g.offset:2=0xC # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line
}

View file

@ -0,0 +1,23 @@
# File : ed_mac_ctrl_V3_8978.conf
#
# ed_mac_ctrl_v3 is used for 88W8997, 88W8987, 88W8977, 88W8978
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_8978.conf ed_mac_ctrl_v3
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v3={
CmdCode=0x0130 #Command code, DO NOT change this line
ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band
# 1 - enable EU adaptivity for 2.4GHz band
ed_ctrl_2g.offset:2=0x9 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band
# 1 - enable EU adaptivity for 5GHz band
ed_ctrl_5g.offset:2=0xC # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line
}

View file

@ -0,0 +1,23 @@
# File : ed_mac_ctrl_V3_8987.conf
#
# ed_mac_ctrl_v3 is used for 88W8997, 88W8987, 88W8977
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_8987.conf ed_mac_ctrl_v3
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v3={
CmdCode=0x0130 #Command code, DO NOT change this line
ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band
# 1 - enable EU adaptivity for 2.4GHz band
ed_ctrl_2g.offset:2=0x6 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band
# 1 - enable EU adaptivity for 5GHz band
ed_ctrl_5g.offset:2=0x6 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line
}

View file

@ -0,0 +1,23 @@
# File : ed_mac_ctrl_V3_8997.conf
#
# ed_mac_ctrl_v3 is used for 88W8997, 88W8987, 88W8977
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_8997.conf ed_mac_ctrl_v3
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v3={
CmdCode=0x0130 #Command code, DO NOT change this line
ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band
# 1 - enable EU adaptivity for 2.4GHz band
ed_ctrl_2g.offset:2=0x0 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band
# 1 - enable EU adaptivity for 5GHz band
ed_ctrl_5g.offset:2=0x4 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_txq_lock:4=0xFF #DO NOT Change this line
}

View file

@ -0,0 +1,23 @@
# File : ed_mac_ctrl_V3_909x.conf
#
# ed_mac_ctrl_v3 is used for 88W9098, 88W9097
# ./mlanutl mlan0 hostcmd config/ed_mac_ctrl_V3_909x.conf ed_mac_ctrl_v3
#
## Set Energy Detect Threshold for EU Adaptivity test
ed_mac_ctrl_v3={
CmdCode=0x0130 #Command code, DO NOT change this line
ed_ctrl_2g.enable:2=0x1 # 0 - disable EU adaptivity for 2.4GHz band
# 1 - enable EU adaptivity for 2.4GHz band
ed_ctrl_2g.offset:2=0x5 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_5g.enable:2=0x1 # 0 - disable EU adaptivity for 5GHz band
# 1 - enable EU adaptivity for 5GHz band
ed_ctrl_5g.offset:2=0x5 # 0 - Default Energy Detect threshold
#offset value range: 0x80 to 0x7F
ed_ctrl_txq_lock:4=0x1e00FF #DO NOT Change this line
}

View file

@ -0,0 +1,14 @@
# File : init_cfg.conf
# MAC address (interface: address)
mac_addr=mlan0: 00:50:43:20:12:34
mac_addr=mmlan0: 00:50:43:20:42:64
mac_addr=uap0: 00:50:43:20:12:35
mac_addr=muap0: 00:50:43:20:42:65
mac_addr=wfd0: 00:50:43:20:12:36
mac_addr=mwfd0: 00:40:43:20:42:66
# Register (type, offset, value)
# type 1:MAC/SOC, 2:BBP, 3:RF, 5:CAU
#wlan_reg=1,0xA794,0x55FF55FF

View file

@ -0,0 +1,167 @@
# File : mef.conf
######################### MEF Configuration command ##################
mefcfg={
#Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
Criteria=2 # Unicast frames are received during hostsleepmode
NumEntries=1 # Number of activated MEF entries
#mef_entry_0: example filters to match TCP destination port 80 send by 192.168.0.88 pkt or magic pkt.
mef_entry_0={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=3 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 || Filter_2
#Byte comparison filter's type is 0x41,Decimal comparison filter's type is 0x42,
#Bit comparison filter's type is 0x43
#Filter_0 is decimal comparison filter, it always with type=0x42
#Decimal filter always has type, pattern, offset, numbyte 4 field
#Filter_0 will match rx pkt with TCP destination port 80
Filter_0={
type=0x42 # decimal comparison filter
pattern=80 # 80 is the decimal constant to be compared
offset=44 # 44 is the byte offset of the field in RX pkt to be compare
numbyte=2 # 2 is the number of bytes of the field
}
#Filter_1 is Byte comparison filter, it always with type=0x41
#Byte filter always has type, byte, repeat, offset 4 filed
#Filter_1 will match rx pkt send by IP address 192.168.0.88
Filter_1={
type=0x41 # Byte comparison filter
repeat=1 # 1 copies of 'c0:a8:00:58'
byte=c0:a8:00:58 # 'c0:a8:00:58' is the byte sequence constant with each byte
# in hex format, with ':' as delimiter between two byte.
offset=34 # 34 is the byte offset of the equal length field of rx'd pkt.
}
#Filter_2 is Magic packet, it will looking for 16 contiguous copies of '00:50:43:20:01:02' from
# the rx pkt's offset 14
Filter_2={
type=0x41 # Byte comparison filter
repeat=16 # 16 copies of '00:50:43:20:01:02'
byte=00:50:43:20:01:02 # '00:50:43:20:01:02' is the byte sequence constant
offset=14 # 14 is the byte offset of the equal length field of rx'd pkt.
}
}
}
#--------------------------examples for MEF filters--------------------------------
# example: filters to match ARP packet with protocol addr 192.168.0.104
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 && Filter_1 && Filter_2
# #Filter_0 looking for rx pkt with DA is broadcast address
# Filter_0={
# type=0x41
# repeat=6
# byte=ff
# offset=0
# }
# #Filter_1 looking for rx pkt with EtherType is 0x0806(ARP)
# Filter_1={
# type=0x41
# repeat=1
# byte=08:06
# offset=20
# }
# #Filter_2 looking for rx pkt with ARP target protocol addr 192.168.0.104
# Filter_2={
# type=0x41
# repeat=1
# byte=c0:a8:00:68
# offset=46
# }
# }
#-------------------------------------------------------------------------------------
# example: filter to check if the destination MAC address is unicast pkt
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0
# #Filter_0 is Bit comparison filter, it always with type=0x43
# #Byte filter always has type, byte, mask, offset 4 filed
# #"byte" is the byte sequence constant with each byte in hex format, with ':' as delimiter between two byte
# #"mask" is also with each byte in hex format, with ':' as delimiter between two byte
# #"byte" should has the same length as "mask"
# #Filter_0 will check if the destination MAC address is unicast pkt
# Filter_0={
# type=0x43 #Bit comparison filter
# byte=00 #00 is the 1-byte sequence constant
# offset=0 #0 is the byte offset of the rx pkt
# mask=01 #1 is the 1-byte mask
# }
# }
#--------------------------------------------------------------------------------------------------
# example: Disable MEF filters
# mefcfg={
# #Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
# Criteria=2 # Unicast frames are received during hostsleepmode
# NumEntries=0 # Number of activated MEF entries
# }
#--------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4 # Test Mode
# action=16 # Invoke Test
# filter_num=0
# }
# }
#-----------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4
# action=0
# filter_num=1
# RPN=Filter_0
# Filter_0={
# type=0x44 # test filter
# repeat=2 # 2 copies of 'BE:EF'
# byte=BE:EF # 'BE:EF' is the byte sequence constant
# offset=18 # 18 is the byte offset of the equal length field of rx'd pkt.
# dest=00:50:43:20:5a:82 # '00:50:43:20:5a:82' is the byte sequence constant
# }
# }
# }
#----------------------------------------------------------------------------------------------------
#example: Filter broadcast/ipv4 multicast/ipv6 multicast packets in non hostsleep mode
#mefcfg={
# Criteria=9 # broadcast and multicast frames
# NumEntries=1 # Number of activated MEF entries
# mef_entry_0={
# mode=2 # non HostSleep mode
# action=0 # discard and not wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 || Filter_1 || Filter_2
# Filter_0={ # IPV4 multicast
# type=0x41 # byte comparison filter
# byte=01:00:5e # 01:00:5e is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# Filter_1={ # broadcast packet check
# type=0x41 # Byte comparison filter
# repeat=6 # 6 copies of 'ff', means broadcast
# byte=ff # 'ff'(0xff) is the byte sequence constant with each byte
# # in hex format, with ':' as delimiter between two byte.
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# }
# Filter_2={ # IPV6 multicast
# type=0x41 # byte comparison filter
# byte=33:33 # 33:33 is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# }
#}
#------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,204 @@
# File : mef_mdns.conf
######################### MEF Configuration command ##################
mefcfg={
#Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
Criteria=8 # Multicast frames are received during hostsleepmode
NumEntries=2 # Number of activated MEF entries
#mef_entry_0: example filters to match WS-Discovery pkt for IPv4.
mef_entry_0={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=08:00
offset=20
}
#Filter_1 will match dest multicast IPv4 address 224.0.0.251
Filter_1={
type=0x41
repeat=1
byte=e0:00:00:fb
offset=38
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=31
numbyte=1
}
#Filter_3 will match UDP port 5353
Filter_3={
type=0x42
pattern=5353
offset=44
numbyte=2
}
}
#mef_entry_1: example filters to match WS-Discovery pkt for IPv6.
mef_entry_1={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=86:dd
offset=20
}
#Filter_1 will match dest multicast IPv6 address FF02::FB
Filter_1={
type=0x41
repeat=1
byte=ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:fb
offset=46
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=28
numbyte=1
}
#Filter_3 will match UDP port 5353
Filter_3={
type=0x42
pattern=5353
offset=64
numbyte=2
}
}
}
#--------------------------examples for MEF filters--------------------------------
# example: filters to match ARP packet with protocol addr 192.168.0.104
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 && Filter_1 && Filter_2
# #Filter_0 looking for rx pkt with DA is broadcast address
# Filter_0={
# type=0x41
# repeat=6
# byte=ff
# offset=0
# }
# #Filter_1 looking for rx pkt with EtherType is 0x0806(ARP)
# Filter_1={
# type=0x41
# repeat=1
# byte=08:06
# offset=20
# }
# #Filter_2 looking for rx pkt with ARP target protocol addr 192.168.0.104
# Filter_2={
# type=0x41
# repeat=1
# byte=c0:a8:00:68
# offset=46
# }
# }
#-------------------------------------------------------------------------------------
# example: filter to check if the destination MAC address is unicast pkt
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0
# #Filter_0 is Bit comparison filter, it always with type=0x43
# #Byte filter always has type, byte, mask, offset 4 filed
# #"byte" is the byte sequence constant with each byte in hex format, with ':' as delimiter between two byte
# #"mask" is also with each byte in hex format, with ':' as delimiter between two byte
# #"byte" should has the same length as "mask"
# #Filter_0 will check if the destination MAC address is unicast pkt
# Filter_0={
# type=0x43 #Bit comparison filter
# byte=00 #00 is the 1-byte sequence constant
# offset=0 #0 is the byte offset of the rx pkt
# mask=01 #1 is the 1-byte mask
# }
# }
#--------------------------------------------------------------------------------------------------
# example: Disable MEF filters
# mefcfg={
# #Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
# Criteria=2 # Unicast frames are received during hostsleepmode
# NumEntries=0 # Number of activated MEF entries
# }
#--------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4 # Test Mode
# action=16 # Invoke Test
# filter_num=0
# }
# }
#-----------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4
# action=0
# filter_num=1
# RPN=Filter_0
# Filter_0={
# type=0x44 # test filter
# repeat=2 # 2 copies of 'BE:EF'
# byte=BE:EF # 'BE:EF' is the byte sequence constant
# offset=18 # 18 is the byte offset of the equal length field of rx'd pkt.
# dest=00:50:43:20:5a:82 # '00:50:43:20:5a:82' is the byte sequence constant
# }
# }
# }
#----------------------------------------------------------------------------------------------------
#example: Filter broadcast/ipv4 multicast/ipv6 multicast packets in non hostsleep mode
#mefcfg={
# Criteria=9 # broadcast and multicast frames
# NumEntries=1 # Number of activated MEF entries
# mef_entry_0={
# mode=2 # non HostSleep mode
# action=0 # discard and not wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 || Filter_1 || Filter_2
# Filter_0={ # IPV4 multicast
# type=0x41 # byte comparison filter
# byte=01:00:5e # 01:00:5e is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# Filter_1={ # broadcast packet check
# type=0x41 # Byte comparison filter
# repeat=6 # 6 copies of 'ff', means broadcast
# byte=ff # 'ff'(0xff) is the byte sequence constant with each byte
# # in hex format, with ':' as delimiter between two byte.
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# }
# Filter_2={ # IPV6 multicast
# type=0x41 # byte comparison filter
# byte=33:33 # 33:33 is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# }
#}
#------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,204 @@
# File : mef_ws_discovery.conf
######################### MEF Configuration command ##################
mefcfg={
#Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
Criteria=8 # Multicast frames are received during hostsleepmode
NumEntries=2 # Number of activated MEF entries
#mef_entry_0: example filters to match WS-Discovery pkt for IPv4.
mef_entry_0={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=08:00
offset=20
}
#Filter_1 will match dest multicast IPv4 address 239.255.255.250
Filter_1={
type=0x41
repeat=1
byte=ef:ff:ff:fa
offset=38
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=31
numbyte=1
}
#Filter_3 will match UDP port 3702
Filter_3={
type=0x42
pattern=3702
offset=44
numbyte=2
}
}
#mef_entry_1: example filters to match WS-Discovery pkt for IPv6.
mef_entry_1={
#mode: bit0--hostsleep mode, bit1--non hostsleep mode
mode=1 # HostSleep mode
#action: 0--discard and not wake host, 1--discard and wake host 3--allow and wake host
action=3 # Allow and Wake host
filter_num=4 # Number of filter
#RPN only support "&&" and "||" operator,space can not be removed between operator.
RPN=Filter_0 && Filter_1 && Filter_2 && Filter_3
#Filter_0 will match IPv4 protocol packet
Filter_0={
type=0x41
repeat=1
byte=86:dd
offset=20
}
#Filter_1 will match dest multicast IPv6 address FF02::C
Filter_1={
type=0x41
repeat=1
byte=ff:02:00:00:00:00:00:00:00:00:00:00:00:00:00:0c
offset=46
}
#Filter_2 will match UDP packet
Filter_2={
type=0x42
pattern=17
offset=28
numbyte=1
}
#Filter_3 will match UDP port 3702
Filter_3={
type=0x42
pattern=3702
offset=64
numbyte=2
}
}
}
#--------------------------examples for MEF filters--------------------------------
# example: filters to match ARP packet with protocol addr 192.168.0.104
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 && Filter_1 && Filter_2
# #Filter_0 looking for rx pkt with DA is broadcast address
# Filter_0={
# type=0x41
# repeat=6
# byte=ff
# offset=0
# }
# #Filter_1 looking for rx pkt with EtherType is 0x0806(ARP)
# Filter_1={
# type=0x41
# repeat=1
# byte=08:06
# offset=20
# }
# #Filter_2 looking for rx pkt with ARP target protocol addr 192.168.0.104
# Filter_2={
# type=0x41
# repeat=1
# byte=c0:a8:00:68
# offset=46
# }
# }
#-------------------------------------------------------------------------------------
# example: filter to check if the destination MAC address is unicast pkt
# mef_entry_0={
# mode=1 # HostSleep mode
# action=3 # Allow and Wake host
# filter_num=3 # Number of filter
# RPN=Filter_0
# #Filter_0 is Bit comparison filter, it always with type=0x43
# #Byte filter always has type, byte, mask, offset 4 filed
# #"byte" is the byte sequence constant with each byte in hex format, with ':' as delimiter between two byte
# #"mask" is also with each byte in hex format, with ':' as delimiter between two byte
# #"byte" should has the same length as "mask"
# #Filter_0 will check if the destination MAC address is unicast pkt
# Filter_0={
# type=0x43 #Bit comparison filter
# byte=00 #00 is the 1-byte sequence constant
# offset=0 #0 is the byte offset of the rx pkt
# mask=01 #1 is the 1-byte mask
# }
# }
#--------------------------------------------------------------------------------------------------
# example: Disable MEF filters
# mefcfg={
# #Criteria: bit0-broadcast, bit1-unicast, bit3-multicast
# Criteria=2 # Unicast frames are received during hostsleepmode
# NumEntries=0 # Number of activated MEF entries
# }
#--------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4 # Test Mode
# action=16 # Invoke Test
# filter_num=0
# }
# }
#-----------------------------------------------------------------------------------------------------
# example: Test MEF filters
# mefcfg={
# Criteria=1
# NumEntries=1
# mef_entry_0={
# mode=4
# action=0
# filter_num=1
# RPN=Filter_0
# Filter_0={
# type=0x44 # test filter
# repeat=2 # 2 copies of 'BE:EF'
# byte=BE:EF # 'BE:EF' is the byte sequence constant
# offset=18 # 18 is the byte offset of the equal length field of rx'd pkt.
# dest=00:50:43:20:5a:82 # '00:50:43:20:5a:82' is the byte sequence constant
# }
# }
# }
#----------------------------------------------------------------------------------------------------
#example: Filter broadcast/ipv4 multicast/ipv6 multicast packets in non hostsleep mode
#mefcfg={
# Criteria=9 # broadcast and multicast frames
# NumEntries=1 # Number of activated MEF entries
# mef_entry_0={
# mode=2 # non HostSleep mode
# action=0 # discard and not wake host
# filter_num=3 # Number of filter
# RPN=Filter_0 || Filter_1 || Filter_2
# Filter_0={ # IPV4 multicast
# type=0x41 # byte comparison filter
# byte=01:00:5e # 01:00:5e is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# Filter_1={ # broadcast packet check
# type=0x41 # Byte comparison filter
# repeat=6 # 6 copies of 'ff', means broadcast
# byte=ff # 'ff'(0xff) is the byte sequence constant with each byte
# # in hex format, with ':' as delimiter between two byte.
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# }
# Filter_2={ # IPV6 multicast
# type=0x41 # byte comparison filter
# byte=33:33 # 33:33 is the byte constant to be compared
# offset=0 # 0 is the byte offset of the equal length field of rx'd pkt.
# repeat=1 #
# }
# }
#}
#------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,17 @@
#File : memory/register update
# memory/register update file
mem_set={
CmdCode=0x0086 #do NOT change this line
Action:2=1 # 1 - SET
Rsrvd:2=0
Addr:4=0x8000a584 # memory/register address
Value:4=0x16161669 #Value
}
mem_get={
CmdCode=0x0086 #do NOT change this line
Action:2=0 # 1 - SET
Rsrvd:2=0
Addr:4=0x8000a584 # memory/register address
Result:4=0
}

View file

@ -0,0 +1,30 @@
# Format of the packet data to be sent.
# Update the TxControl value for TxPD, else zero is sent.
# all packet data is written under "Data" block
PktType=0x00 # should be zero for MGMT frames
PktSubType=0x05
# Assoc Request 0
# Assoc Response 1
# Re-Assoc Request 2
# Re-Assoc Response 3
# Probe Request 4
# Probe Response 5
# Beacon 8
# Atim 9
# Dis-assoc 10
# Auth 11
# Deauth 12
# Action Frame 13
FromDS=0
ToDS=0
Addr1=00:50:43:27:B0:41 # Destination address
Addr2=00:50:43:21:0F:84 # Source address
Addr3=00:50:43:21:0F:84 # BSSID
Data=0x01,0x01,0x00,0x0c,0x00,0x58,0x02,0x40
SeqNum=0
FragNum=0

View file

@ -0,0 +1,15 @@
##############management frame filter to wake up host ###########
##### support two entries currently ######
mgmtfilter={
entry_num=1
entry_0={
action=1 # discard and wakeup host
type=0x1 # p2p frames
frame_mask=0x7 # Go neg req & rsp & cfm frame
}
# entry_1={
# action=0 # discard and not wakeup host
# type=0xff # management frames
# frame_mask=0x3 # assoc req & rsp frame
# }
}

View file

@ -0,0 +1,7 @@
07 01 03 3A 80 00 3A 00 ff ff 00 17 03 00 07 03
09 00 0e 10 16 02 19 25 1a 04 1c ff 32 5e 33 15
35 29 36 17 4b 74 4c 64 4d 3b 50 27 61 d6 62 98
6b ae 6f 5b 77 f2 79 ff 7f 2d
07 01 12 16 c0 00 ff ff ff ff 00 05 03 10 32 5c
33 1a 6b a2 7f 20

View file

@ -0,0 +1,29 @@
# File : pad_cfg.conf
## Get CFG data for PAD OR
pad_cfg_get={
CmdCode=0x008f # do NOT change this line
Action:2=0 # 0 - GET
Type:2=5 # 5 - optimized pad reg
CfgLen:2={
}
}
## Set CFG data for PAD OR
#pad_cfg_set={
# CmdCode=0x008f # do NOT change this line
# Action:2=1 # 1 - SET
# Type:2=5 # 5 - optimized pad reg
# CfgLen:2={ # 9 entries for W8787
# CFG1:4=0x00000000 # SDIO in sleep
# CFG2:4=0x55550004 # GPIO in sleep
# CFG3:4=0x00000001
# CFG4:4=0x00000000 # RFCTRL in sleep
# CFG5:4=0x00000000
# CFG6:4=0x0E001800 # GPIO/RFCTRL in power down
# CFG7:4=0x249A0000
# CFG8:4=0x000000D2
# CFG9:4=0x00000000
# }
#}

View file

@ -0,0 +1,15 @@
# File : requesttpc.conf
######################### requesttpc command configuration ##################
requesttpc={
CmdCode=0x0060 # do NOT change this line
#DestMac: Destination STA address
DestMac:6='0x02,0x04,0x0e,0x06,0x01,0x12'
#RateIndex: IEEE Rate index to send request
RateIndex:1=22
#Timeout: Response timeout in ms
Timeout:2=10
}
######################### End of requesttpc command configuration ##################

View file

@ -0,0 +1,211 @@
# File : robust_btc.conf
######################### Robust Coex command ###############
mode_get={
CmdCode=0x00e0 # do NOT change this line
Action:2=0 # GET
RSVD:2=0
# Robust Coex Mode TLV
RobustCoexTlvType:2=0x0160
RobustCoexTlvLength:2={
Enable:1=0x00 # Read-back Coex mode(s)
Reserved:3=0
}
}
mode_timeshare={
CmdCode=0x00e0 # do NOT change this line
Action:2=1 # SET
RSVD:2=0
# Robust Coex Mode TLV
RobustCoexTlvType:2=0x0160
RobustCoexTlvLength:2={
# All the modes below are mutually exclusive of each other;
Enable:1=0x01 # Bit0: Enable 2x2 or 1x1 Time Distribute(TMD)
# Robust Coex(RBC) mode, when uAP bss start,
# uAP TMD RBC scheme is enabled,
# STA TMD RBC scheme is disabled.
Reserved:3=0
}
}
mode_spatial={
CmdCode=0x00e0 # do NOT change this line
Action:2=1 # SET
RSVD:2=0
# Robust Coex Mode TLV
RobustCoexTlvType:2=0x0160
RobustCoexTlvLength:2={
# All the modes below are mutually exclusive of each other;
Enable:1=0x82 # Bit1: Enable 1x1 SMPS Spatial RBC Mode, e.g. 0x02
# Bit7: Enable uAP+STA SMPS RBC Mode,
# when uAP bss start, uAP SMPS RBC scheme enable,
# must combined with BIT1 or BIT2, e.g. 0x82, 0x84.
Reserved:3=0
}
}
mode_none={
CmdCode=0x00e0 # do NOT change this line
Action:2=1 # SET
RSVD:2=0
# Robust Coex Mode TLV
RobustCoexTlvType:2=0x0160
RobustCoexTlvLength:2={
Enable:1=0 # Concurrent Coex mode. Used for chips which has
# separate antenna for BT
Reserved:3=0
}
}
mode_2={
CmdCode=0x00e0 # do NOT change this line
Action:2=1 # SET
RSVD:2=0
# Robust Coex Mode TLV
RobustCoexTlvType:2=0x0160
RobustCoexTlvLength:2={
Enable:1=0x20 # Concurrent Coex mode with Tx power control and Rx De-sense.
# Used for chips which has separate antenna for BT
Reserved:3=0
}
}
gpio_cfg={
CmdCode=0x00e0 # do NOT change this line
Action:2=1 # SET
RSVD:2=0
# Robust Coex Mode TLV
RobustCoexTlvType:2=0x021B
RobustCoexTlvLength:2={
Enable:1=0x1 # enable GPIO cfg for external bt request
gpionum:1=4 # gpio 4
gpiopolarity:1=1 # Polarity High
}
}
external_coex_config={
CmdCode=0x00e0
Action:2=1 //0x0 get, 0x1 set
RSVD:2=0
RobustCoexTlvType:2=0x0238 //TLV ID
RobustCoexTlvLength:2={
Enabled:1=0x01 // 0x00 disable, 0x01 enalbe
ExtHighInputPriority:1=0x02 // Input priority: 0x00 Input Low Priority, 0x01 Input Medium Priority, 0x02 Input High Priority
ExtLowInputPriority:1=0x02
ExtPriGPIONum:1=0x06; // Input Priority signal GPIO pin number
ExtPriGPIOPolarity:1=0x01; // Polarity: 0x00 Active Low, 0x01 Active High
ExtReqGPIONum:1=0x07; // Input Request signal GPIO pin number
ExtReqGPIOPolarity:1=0x01; // Polarity: 0x00 Active Low, 0x01 Active High
ExtGrntGPIONum:1=0x05; // Output Grant signal GPIO pin number
ExtGrntGPIOPolarity:1=0x01; // Polarity: 0x00 Active Low, 0x01 Active High
}
}
#In Station generic case
#BT time is set as BTTime
#Wlan time is set as Wlan Time
generictime={
CmdCode=0x00e0
Action:2=1
RSVD:2=0
RobustCoexTlvType:2=0x0390
RobustCoexTlvLength:2={
Enable:2=0x01
BtTime:2=10000 #(10ms) BTTime must be less than 65535
WlanTime:2=40000 #(40ms) WlanTime must be less than 65535
}
}
#In Station A2DP case
#BT time is set as BTTime
#Wlan time is set as Wlan Time
a2dptime={
CmdCode=0x00e0
Action:2=1
RSVD:2=0
RobustCoexTlvType:2=0x0391
RobustCoexTlvLength:2={
Enable:2=0x01
BtTime:2=10000 #(10ms) BTTime must be less than 65535
WlanTime:2=39500 #(39.5ms) WlanTime must be less than 65535
}
}
#In Station inquiry case
#BT time is set as BTTime
#Wlan time is set as Wlan Time
inquirytime={
CmdCode=0x00e0
Action:2=1
RSVD:2=0
RobustCoexTlvType:2=0x0392
RobustCoexTlvLength:2={
Enable:2=0x01
BtTime:2=21215 #(21.215ms) BTTime must be less than 65535
WlanTime:2=11000 #(11ms) WlanTime must be less than 65535
}
}
#In Ap generic case
#BT time is BTTimeBusy when BT has traffic
#BT time is BTTimeIdle when BT is idle
#Wlan time is WlanTimeBusy when Wlan has traffic
#Wlan time is WlanTimeIdle when Wlan is idle
ap_generictime={
CmdCode=0x00e0
Action:2=1
RSVD:2=0
RobustCoexTlvType:2=0x0393
RobustCoexTlvLength:2={
Enable:2=0x01
BtTime_MAX:2=23000 #(23ms) BTTime(BT Busy) must be less than 28767
BtTime_MIN:2=6500 #(6.5ms) BTTime(BT Idle) must be less than 28767
WlanTime_MAX:2=18000 #(18ms) WlanTime(Wlan Busy) must be less than 32767
WlanTime_MIN:2=5750 #(5.75ms) WlanTime(Wlan Idle) must be less than 32767
}
}
#In Ap A2DP case
#BT time is change from BTTimeMax to BTTimeMin
#Wlan time is change from WlanTimeMax to WlanTimeMin
ap_a2dptime={
CmdCode=0x00e0
Action:2=1
RSVD:2=0
RobustCoexTlvType:2=0x0394
RobustCoexTlvLength:2={
Enable:2=0x01
BtTimebusy:2=23000 #(23ms) Maximum BTTime must be less than 32767
BtTimeidle:2=6500 #(6.5ms) Minimum BTTime must be less than 32767
WlanTimebusy:2=18000 #(18ms) Maximum WlanTime must be less than 32767
WlanTimeidle:2=5750 #(5.75ms) Minimum WlanTime must be less than 32767
}
}
#In Ap inquiry case
#BT time is set as BTTime
#Wlan time is set as Wlan Time
ap_inquirytime={
CmdCode=0x00e0
Action:2=1
RSVD:2=0
RobustCoexTlvType:2=0x0395
RobustCoexTlvLength:2={
Enable:2=0x01
BtTime:2=28750 #(28.75ms) BTTime must less than 32767
WlanTime:2=20000 #(20ms) WlanTime must be less than 32767
}
}
######################### Robust Coex command ###############

View file

@ -0,0 +1,674 @@
# File: rutxpower_limit.conf
## Get CFG data for RU based Tx power limit
rutxpowerlimit_cfg_get={
CmdCode=0x026d #do not change this line
Action:2=0 #0 - GET
SubID:2=0x117 #RU POWER
}
## Set CFG data for RU based Tx power limit
##
## TLVStartFreq: Starting Frequency of the band for this channel
## 2407, 2414 or 2400 for 2.4 GHz
## 5000
## 4000
## TLVChanWidth: Channel Width
## 20 40 80
## TLVChanNum : Channel Number
## TLVPwr[] : Power Limit in dBm (RU=26,52,106,242,484,996)
## range from -64dBm to +63dBm in steps of 1dBm
##
rutxpowerlimit_cfg_set={
CmdCode=0x026d #do not change this line
Action:2=1 #1 - SET
SubID:2=0x117 #RU POWER
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=1
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=2
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=3
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=4
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=5
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=6
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=7
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=8
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=9
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=10
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=11
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=12
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=2407
TlvChanWidth:1=20
TlvChanNum:1=13
TlvPwr:6='-1,2,5,8,0,0'
}
}
rutxpowerlimit_5g_cfg_set={
CmdCode=0x026d #do not change this line
Action:2=1 #1 - SET
SubID:2=0x117 #RU POWER
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=36
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=40
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=44
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=48
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=52
TlvPwr:6='-2,1,4,7,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=56
TlvPwr:6='-2,1,4,7,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=60
TlvPwr:6='-2,1,4,7,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=64
TlvPwr:6='-2,1,4,7,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=100
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=104
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=108
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=112
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=116
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=120
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=124
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=128
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=132
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=136
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=140
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=144
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=149
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=153
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=157
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=161
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=20
TlvChanNum:1=165
TlvPwr:6='-1,2,5,8,0,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=36
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=40
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=44
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=48
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=52
TlvPwr:6='-5,-2,1,4,7,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=56
TlvPwr:6='-5,-2,1,4,7,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=60
TlvPwr:6='-5,-2,1,4,7,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=64
TlvPwr:6='-5,-2,1,4,7,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=100
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=104
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=108
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=112
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=116
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=120
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=124
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=128
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=132
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=136
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=149
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=153
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=157
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=40
TlvChanNum:1=161
TlvPwr:6='-4,-1,2,5,8,0'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=36
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=40
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=44
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=48
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=52
TlvPwr:6='-8,-5,-2,1,4,7'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=56
TlvPwr:6='-8,-5,-2,1,4,7'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=60
TlvPwr:6='-8,-5,-2,1,4,7'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=64
TlvPwr:6='-8,-5,-2,1,4,7'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=100
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=104
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=108
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=112
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=116
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=120
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=124
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=128
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=149
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=153
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=157
TlvPwr:6='-7,-4,-1,2,5,8'
}
PwrVal.TlvType:2=0x0244
PwrVal.TlvLength:2={
TLVStartFreq:2=5000
TlvChanWidth:1=80
TlvChanNum:1=161
TlvPwr:6='-7,-4,-1,2,5,8'
}
}

View file

@ -0,0 +1,27 @@
# File : sdio_pulldown.conf
######################### SDIO Pulldown command ###############
sdio_pulldown_get={
CmdCode=0x0093 # do NOT change this line
Action:2=0 # GET
PullUpDelay:2=0
PullDownDelay:2=0
}
sdio_pulldown_set={
CmdCode=0x0093 # do NOT change this line
Action:2=1 # SET
PullUpDelay:2=0
PullDownDelay:2=0
}
sdio_pulldown_disable={
CmdCode=0x0093 # do NOT change this line
Action:2=1 # SET
PullUpDelay:2=0xffff
PullDownDelay:2=0xffff
}
######################### SDIO Pulldown command ###############

View file

@ -0,0 +1,62 @@
# File : small_debug.conf
######################### DBG Config command ###############
small_debug_enable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x06 # dbgs_cfg_t
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x81 # one entry global enable
# dbgs_t
En_Mask:2=0x0000 # en_mask_id
BaseId:2=0x0000 # base_id
}
small_debug_disable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x00
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x00
}
######################### DBG Get Trace Memory ###############
# Disable Air and Host destinations to disable dbgs_drain
# Enable only the Power save ID - Host interface is a course enable - not on specific event
trace_enable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x00 # dbgs_cfg_t - don't drain debug
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x02 # 2 entry
# dbgs_t
En_Mask:2=0x5fff # en_mask_id - enable single ID=0x80
BaseId:2=0x0020 # base_id
En_Mask:2=0x5fff # en_mask_id - enable single ID=0x80
BaseId:2=0x0021 # base_id
}
get_trace={
CmdCode=0x008c # do NOT change this line
startAddress:4=0x02 # read trace memeory - not a generic memory read
len:2=0x0000 # First read=0 - for next reads use the returned next start
}
trace_disable={
CmdCode=0x008b # do NOT change this line
Dst:1=0x00 # dbgs_cfg_t - don't drain debug
Air_Chan:1=0x00
RSVD:1=0
Num_Entries:1=0x01 # one entry
# dbgs_t
En_Mask:2=0x0000 # en_mask_id
BaseId:2=0x0000 # base_id
}

View file

@ -0,0 +1,124 @@
# File : smc.conf
smc_get={
CmdCode=0x012d #do not change this
Action:2=0 # GET
}
smc_set={
CmdCode=0x012d #do not change this
Action:2=1 # SET
# SSID
SSIDHeaderType:2=0x0000
SSIDHeaderLen:2={
SSID:10="NXP_SMC_1"
}
# Beacon Period.
# This should be smaller than than MinScanTime.
BeaconHeaderType:2=0x012c
BeaconHeaderLen:2={
beaconPeriod:2=30
}
# Channel list.
# ChanNumber, MinScanTime and ScanTime are mandatory.
# MinScanTime is minimum dwelling time for ChanNumber channel.
# ScanTime is maximum dwelling time for ChanNumber channel.
ChannHeaderType:2=0x0101
ChannHeaderLen:2={
# Following four line define one channel.
# Please add similar four lines with different channel number for new channel.
Chan1_RadioType:1=0
Chan1_ChanNumber:1=1
Chan1_ScanType:1=2
Chan1_MinScanTime:2=40
Chan1_ScanTime:2=200
Chan2_RadioType:1=0
Chan2_ChanNumber:1=6
Chan2_ScanType:1=3
Chan2_MinScanTime:2=40
Chan2_ScanTime:2=200
Chan3_RadioType:1=0
Chan3_ChanNumber:1=9
Chan3_ScanType:1=2
Chan3_MinScanTime:2=40
Chan3_ScanTime:2=100
Chan2_RadioType:1=0
Chan2_ChanNumber:1=11
Chan2_ScanType:1=3
Chan2_MinScanTime:2=40
Chan2_ScanTime:2=200
}
#Custom IE
#Currently max size of custom IE supported is 50 bytes.
#
# CustomHeaderType:2=0x010a
# CustomHeaderLen:2={
# start:1=0xdd
# start:1=0x10
# start:1=0x00
# start:1=0x01
# start:1=0x02
# start:1=0x03
# start:1=0x04
# start:1=0x05
# start:1=0x06
# start:1=0x07
# start:1=0x08
# start:1=0x09
# start:1=0x0a
# start:1=0x0b
# start:1=0x0c
# start:1=0x0d
# start:1=0x0e
# start:1=0x0f
# }
#Multicast mac filtering address
#All the multicast packets from starting mac address to ending mac address would
#be captured and sent to the host.
MACHeaderType:2=0x01cc
MACHeaderLen:2={
#Staring Multicast mac address
start:1=0x01
start:1=0x00
start:1=0x5e
start:1=0x00
start:1=0x00
start:1=0x01
#Ending Multicast mac address
end:1=0x01
end:1=0x00
end:1=0x5e
end:1=0x7f
end:1=0xff
end:1=0xff
#FilterType
# 1 for RX AP frames
# 2 for RX STA frames
# 3 for both
Filter:2=0x3
}
}
smc_start={
CmdCode=0x012d #do not change this
Action:2=2 # START
}
smc_stop={
CmdCode=0x012d #do not change this
Action:2=3 # STOP
}

View file

@ -0,0 +1,13 @@
# File ssu.conf
ssu_params_cfg={
nskip=3 #0-3; # of FFT samples to skip
nsel=2 #0-3: # of FFT samples selected to dump
adcdownsample=1 #0-3: Down sample ADC input for buffering
mask_adc_pkt=1 #0-1: Mask out ADC Data from spectral packet
out_16bits=1 #0-1: Enable 16-Bit FFT output data precision in spectral packet
spec_pwr_enable=1 #0-1: Enable power spectrum in dB for spectral packet
rate_reduction=1 #0-1: Enable spectral packet rae reduction in DB output format
n_pkt_avg=6 #0-7: Number of spectral packets over which spectral data is to be averaged.
}

View file

@ -0,0 +1,103 @@
# File : subevent.conf
######################### Subscribe Events command ##################
subevent_get={
CmdCode=0x0075 # do NOT change this line
Action:2=0 # GET
Events:2=0
}
subevent_set={
CmdCode=0x0075 # do NOT change this line
Action:2=1 # SET
Events:2=0xbc8 # bit0 - Beacon RSSI_LOW
# bit1 - Beacon SNR_LOW
# bit2 - FAILED_COUNT
# bit3 - Beacon Missed
# bit4 - Beacon RSSI_HIGH
# bit5 - Beacon SNR_HIGH
# bit6 - Data RSSI_LOW
# bit7 - Data SNR_LOW
# bit8 - Data RSSI_HIGH
# bit9 - Data SNR_HIGH
# bit10 - LINK_QUALITY
# bit11 - PRE_BCN_LOST
# bit12-15 - Reserved
LowRssiTlvType:2=0x0104
LowRssiTlvLength:2={
Threshold:1=70
ReportingFreq:1=0
}
LowSnrTlvType:2=0x0105
LowSnrTlvLength:2={
Threshold:1=56
ReportingFreq:1=0
}
FailedCountTlvType:2=0x0106
FailedCountTlvLength:2={
Threshold:1=5
ReportingFreq:1=0
}
BeaconMissTlvType:2=0x0107
BeaconMissTlvLength:2={
BeaconMissed:1=60
Reserved:1=0
}
HighRssiTlvType:2=0x0116
HighRssiTlvLength:2={
Threshold:1=40
ReportingFreq:1=0
}
HighSnrTlvType:2=0x0117
HighSnrTlvLength:2={
Threshold:1=86
ReportingFreq:1=0
}
DataLowRssiTlvType:2=0x0126
DataLowRssiTlvLength:2={
Threshold:1=10
ReportingFreq:1=0
}
DataLowSnrTlvType:2=0x0127
DataLowSnrTlvLength:2={
Threshold:1=66
ReportingFreq:1=0
}
DataHighRssiTlvType:2=0x0128
DataHighRssiTlvLength:2={
Threshold:1=50
ReportingFreq:1=0
}
DataHighSnrTlvType:2=0x0129
DataHighSnrTlvLength:2={
Threshold:1=96
ReportingFreq:1=1
}
LinkQualityTlvType:2=0x0124
LinkQualityTlvType:2={
LinkSNRThreshold:2=0x0056
LinkSNRFrequency:2=0x0003
MinRateVal:2=0x0014
MinRateFreq:2=0x0003
TxLatencyVal:4=0x00C8
TxLatencyThreshold:4=0x0003
}
PreBcnLostTlvType:2=0x0149
PreBcnLostTlvLength:2={
PreBeaconCnt:1=30
Reserved:1=0
}
}
######################### Subscribe Events command ##################

View file

@ -0,0 +1,100 @@
# TSPEC contents for TID=0, UserPriority = 6
[tspec0]
# Element ID
dd
# Length
3d
# OUI
00 50 f2
# OUI Type
02
# OUI SubType
02
# Version
01
# TSInfo
e0 34 00
# Nominal MSDU Size
d0 80
# Maximum MSDU Size
d0 00
# Min Service Interval
20 4e 00 00
# Max Service Interval
20 4e 00 00
# Inactivity Interval
80 96 98 00
# Suspension Interval
ff ff ff ff
# Service Start Time
00 00 00 00
# Minimum Data Rate
00 45 01 00
# Mean Data Rate
00 45 01 00
# Peak Data Rate
00 45 01 00
# Max Burst Size
00 00 00 00
# Delay Bound
00 00 00 00
# Min PHY Rate
00 1b b7 00
# Surplus Bandwidth Allowance
00 30
# Medium Time
00 00
# Extra Data Bytes
[/tspec0]
# TSPEC contents for TID=1, UserPriority = 4
[tspec1]
# Element ID
dd
# Length
3d
# OUI
00 50 f2
# OUI Type
02
# OUI SubType
02
# Version
01
# TSInfo
e3 20 00
# Nominal MSDU Size
96 00
# Maximum MSDU Size
dc 05
# Min Service Interval
00 00 00 00
# Max Service Interval
00 00 00 00
# Inactivity Interval
00 00 00 00
# Suspension Interval
ff ff ff ff
# Service Start Time
00 00 00 00
# Minimum Data Rate
a0 00 00 00
# Mean Data Rate
a0 00 00 00
# Peak Data Rate
a0 00 00 00
# Max Burst Size
00 00 00 00
# Delay Bound
00 00 00 00
# Min PHY Rate
80 8d 5b 00
# Surplus Bandwidth Allowance
00 30
# Medium Time
00 00
# Extra Data Bytes
dd 04 00 50 43 ff
[/tspec1]

View file

@ -0,0 +1,12 @@
#File : turbo_mode.conf
## WMM turbo mode config command
turbo_mode_set={
CmdCode=0x0016 # do NOT change this line
Action:2=1 # 1 - SET
OID:2=0x27 # OID_WMM_TURBO_MODE
Size:2=1
Value:1=3 # 1 -- Enable turbo_mode_1;
# 2 -- Enable turbo_mode_2;
# 3 -- Enable turbo_mode_3;
# otherwise, disable turbo_mode
}

View file

@ -0,0 +1,58 @@
#protocol
Protocol=0x88dc
# configure data rate in unit of 0.5Mbps
# 0 - auto rate determined by firmware
# Any other data rate except these data rates will
# be overwritten by default data rate.
# datarate index, unit in 0.5Mbps
# Index | 20MHz | 10MHz
# 12 | 6Mbps | 3Mbps
# 18 | 9Mbps | 4.5Mbps
# 24 | 12Mbps | 6Mbps
# 36 | 18Mbps | 9Mbps
# 48 | 24Mbps | 12Mbps
# 72 | 36Mbps | 18Mbps
# 96 | 48Mbps | 24Mbps
# 108 | 54Mbps | 27.5Mbps
Datarate=12
# configure Channel for the packet
# 0 - the channel set during the enable would be used
Channel=0
# configure Bandwith (only for 11p)
# 0: auto bandwith setting by firmware
# bit4: 1 use bit[3:0] bandwith setting
# bit[3:0]:
# 0 - 5MHz
# 1 - 10MHz
# 2 - 20MHz
# 3 - 40MHz
# 4 - 80MHz
Bandwidth=0x00
# configure power settings
# bit[7] host tx power control flag
# 0x0: use fw setting for tx power
# 0x1: value specified in bit[6] and bit[5:0] are valid
# bit[6] sign of the power specified in bit[5:0]
# 0x0: power specified in bit[5:0] is postive (+)
# 0x1: power specified in bit[5:0] is negative (-)
# bit[5:0] power to be used for transmission (in dBm)
Power=0x00
# configure Priority of the packet
# 1,2 - BK
# 0,3 - BE
# 4,5 - VI
# 6,7 - VO
Priority=0
# configure tx retry time
Retry_limit=0
# Destination MAC Address
Addr=00:50:43:22:0f:b0
Data=0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x8,0x9,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x8,0x9,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x8,0x9,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19

View file

@ -0,0 +1,617 @@
# File : txpwrlimit_cfg.conf
## Get CFG data for Tx power limitation
txpwrlimit_2g_cfg_get={
CmdCode=0x00fb # do NOT change this line
Action:2=0 # 0 - GET
SubBand:2=0x00 # 0x00 2G subband (2.4G: channel 1-14)
# 0x10 5G subband0 (5G: channel 36,40,44,48,
# 52,56,60,64)
# 0x11 5G subband1 (5G: channel 100,104,108,112,
# 116,120,124,128,
# 132,136,140,144)
# 0x12 5G subband2 (5G: channel 149,153,157,161,165,172)
# 0x13 5G subband3 (5G: channel 183,184,185,187,188,
# 189, 192,196;
# 5G: channel 7,8,11,12,16,34)
}
txpwrlimit_5g_cfg_get_sub0={
CmdCode=0x00fb # do NOT change this line
Action:2=0 # 0 - GET
SubBand:2=0x10 # 0x00 2G subband (2.4G: channel 1-14)
# 0x10 5G subband0 (5G: channel 36,40,44,48,
# 52,56,60,64)
# 0x11 5G subband1 (5G: channel 100,104,108,112,
# 116,120,124,128,
# 132,136,140,144)
# 0x12 5G subband2 (5G: channel 149,153,157,161,165,172)
# 0x13 5G subband3 (5G: channel 183,184,185,187,188,
# 189, 192,196;
# 5G: channel 7,8,11,12,16,34)
}
txpwrlimit_5g_cfg_get_sub1={
CmdCode=0x00fb # do NOT change this line
Action:2=0 # 0 - GET
SubBand:2=0x11 # 0x00 2G subband (2.4G: channel 1-14)
# 0x10 5G subband0 (5G: channel 36,40,44,48,
# 52,56,60,64)
# 0x11 5G subband1 (5G: channel 100,104,108,112,
# 116,120,124,128,
# 132,136,140,144)
# 0x12 5G subband2 (5G: channel 149,153,157,161,165,172)
# 0x13 5G subband3 (5G: channel 183,184,185,187,188,
# 189, 192,196;
# 5G: channel 7,8,11,12,16,34)
}
txpwrlimit_5g_cfg_get_sub2={
CmdCode=0x00fb # do NOT change this line
Action:2=0 # 0 - GET
SubBand:2=0x12 # 0x00 2G subband (2.4G: channel 1-14)
# 0x10 5G subband0 (5G: channel 36,40,44,48,
# 52,56,60,64)
# 0x11 5G subband1 (5G: channel 100,104,108,112,
# 116,120,124,128,
# 132,136,140,144)
# 0x12 5G subband2 (5G: channel 149,153,157,161,165,172)
# 0x13 5G subband3 (5G: channel 183,184,185,187,188,
# 189, 192,196;
# 5G: channel 7,8,11,12,16,34)
}
txpwrlimit_5g_cfg_get_sub3={
CmdCode=0x00fb # do NOT change this line
Action:2=0 # 0 - GET
SubBand:2=0x13 # 0x00 2G subband (2.4G: channel 1-14)
# 0x10 5G subband0 (5G: channel 36,40,44,48,
# 52,56,60,64)
# 0x11 5G subband1 (5G: channel 100,104,108,112,
# 116,120,124,128,
# 132,136,140,144)
# 0x12 5G subband2 (5G: channel 149,153,157,161,165,172)
# 0x13 5G subband3 (5G: channel 183,184,185,187,188,
# 189, 192,196;
# 5G: channel 7,8,11,12,16,34)
}
## Set CFG data for Tx power limitation
##
## TLVStartFreq: Starting Frequency of the band for this channel
## 2407, 2414 or 2400 for 2.4 GHz
## 5000
## 4000
## TLVChanWidth: Channel Width
## 20
## TLVChanNum : Channel Number
## TLVPwr[] : ModulationGroup
## 0: CCK (1,2,5.5,11 Mbps)
## 1: OFDM (6,9,12,18 Mbps)
## 2: OFDM (24,36 Mbps)
## 3: OFDM (48,54 Mbps)
## 4: HT20 (MCS0,1,2)
## 5: HT20 (MCS3,4)
## 6: HT20 (MCS5,6,7)
## 7: HT40 (MCS0,1,2)
## 8: HT40 (MCS3,4)
## 9: HT40 (MCS5,6,7)
## 10: HT2_20 (MCS8,9,10)
## 11: HT2_20 (MCS11,12)
## 12: HT2_20 (MCS13,14,15)
## 13: HT2_40 (MCS8,9,10)
## 14: HT2_40 (MCS11,12)
## 15: HT2_40 (MCS13,14,15)
## 16: VHT_QAM256 (MCS8)
## 17: VHT_40_QAM256 (MCS8,9)
## 18: VHT_80_PSK (MCS0,1,2)
## 19: VHT_80_QAM16 (MCS3,4)
## 20: VHT_80_QAM64 (MCS5,6,7)
## 21: VHT_80_QAM256 (MCS8,9)
## 22: VHT2_20_QAM256 (MCS8,9)
## 23: VHT2_40_QAM256 (MCS8,9)
## 24: VHT2_80_PSK (MCS0, 1, 2)
## 25: VHT2_80_QAM16 (MCS3,4)
## 26: VHT2_80_QAM64 (MCS5,6,7)
## 27: VHT2_80_QAM256 (MCS8,9)
## 28: HE_20_QAM256 (MCS8,9)
## 29: HE_20_QAM1024 (MCS10,11)
## 30: HE_40_QAM1024 (MCS10,11)
## 31: HE_80_QAM1024 (MCS10,11)
## 32: HE2_20_QAM256 (MCS8,9)
## 33: HE2_20_QAM1024 (MCS10,11)
## 34: HE2_40_QAM1024 (MCS10,11)
## 35: HE2_80_QAM1024 (MCS10,11)
## Power Limit in dBm
##
## Note: For KF, add VHT 20/40/80 1SS/2SS mod group.
## 2G subband0 Tx power limit CFG
txpwrlimit_2g_cfg_set={
CmdCode=0x00fb # do NOT change this line
Action:2=1 # 1 - SET
SubBand:2=0 # do NOT use this member in set cmd
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=1
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=2
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=3
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=4
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=5
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=6
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=7
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=8
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=9
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=10
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=11
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=12
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=13
TLVPwr:32='0,17,1,15,2,15,3,13,4,15,5,15,6,13,7,15,8,15,9,13,10,15,11,15,12,15,13,15,14,15,15,15'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=2407
TLVChanWidth:1=20
TLVChanNum:1=14
TLVPwr:32='0,12,1,12,2,12,3,12,4,12,5,12,6,12,7,12,8,12,9,12,10,12,11,12,12,12,13,12,14,12,15,12'
}
}
## 5G subband1 Tx power limit CFG
txpwrlimit_5g_cfg_set_sub0={
CmdCode=0x00fb # do NOT change this line
Action:2=1 # 1 - SET
SubBand:2=0 # do NOT use this member in set cmd
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=36
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,18,10,20,11,20,12,18,13,20,14,20,15,18,16,17,17,17,18,20,19,19,20,17,21,16,22,17,23,17,24,20,25,19,26,17,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=40
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,18,10,20,11,20,12,18,13,20,14,20,15,18,16,17,17,17,18,20,19,19,20,17,21,16,22,17,23,17,24,20,25,19,26,17,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=44
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,18,10,20,11,20,12,18,13,20,14,20,15,18,16,18,17,17,18,20,19,19,20,17,21,16,22,18,23,17,24,20,25,19,26,17,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=48
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,18,10,20,11,20,12,18,13,20,14,20,15,18,16,18,17,17,18,20,19,19,20,17,21,16,22,18,23,17,24,20,25,19,26,17,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=52
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,19,10,20,11,20,12,18,13,20,14,20,15,19,16,18,17,17,18,19,19,19,20,18,21,17,22,18,23,17,24,19,25,19,26,18,27,17,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=56
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,19,10,20,11,20,12,18,13,20,14,20,15,19,16,18,17,17,18,19,19,19,20,18,21,17,22,18,23,17,24,19,25,19,26,18,27,17,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=60
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,19,10,20,11,20,12,18,13,20,14,20,15,19,16,18,17,17,18,19,19,19,20,18,21,17,22,18,23,17,24,19,25,19,26,18,27,17,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=64
TLVPwr:72='0,0,1,20,2,20,3,19,4,20,5,20,6,18,7,20,8,20,9,19,10,20,11,20,12,18,13,20,14,20,15,19,16,18,17,17,18,19,19,19,20,18,21,17,22,18,23,17,24,19,25,19,26,18,27,17,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
}
## 5G subband2 Tx power limit CFG
txpwrlimit_5g_cfg_set_sub1={
CmdCode=0x00fb # do NOT change this line
Action:2=1 # 1 - SET
SubBand:2=0 # do NOT use this member in set cmd
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=100
TLVPwr:72='0,0,1,20,2,20,3,20,4,18,5,18,6,19,7,18,8,18,9,18,10,18,11,18,12,19,13,18,14,18,15,18,16,18,17,16,18,18,19,19,20,18,21,16,22,18,23,16,24,18,25,19,26,18,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=104
TLVPwr:72='0,0,1,20,2,20,3,20,4,18,5,18,6,18,7,18,8,18,9,18,10,18,11,18,12,18,13,18,14,18,15,18,16,18,17,16,18,18,19,19,20,18,21,16,22,18,23,16,24,18,25,19,26,18,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=108
TLVPwr:72='0,0,1,20,2,20,3,20,4,18,5,18,6,19,7,18,8,18,9,17,10,18,11,18,12,19,13,18,14,18,15,17,16,18,17,16,18,18,19,19,20,18,21,16,22,18,23,16,24,18,25,19,26,18,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=112
TLVPwr:72='0,0,1,20,2,20,3,20,4,18,5,18,6,19,7,18,8,18,9,17,10,18,11,18,12,19,13,18,14,18,15,17,16,17,17,16,18,18,19,19,20,18,21,16,22,17,23,16,24,18,25,19,26,18,27,16,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=116
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,18,9,17,10,18,11,18,12,18,13,18,14,18,15,17,16,16,17,15,18,18,19,18,20,17,21,15,22,16,23,15,24,18,25,18,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=120
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,18,9,17,10,18,11,18,12,18,13,18,14,18,15,17,16,17,17,15,18,18,19,18,20,17,21,15,22,17,23,15,24,18,25,18,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=124
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,18,9,18,10,18,11,18,12,18,13,18,14,18,15,18,16,17,17,15,18,18,19,18,20,17,21,15,22,17,23,15,24,18,25,18,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=128
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,18,9,18,10,18,11,18,12,18,13,18,14,18,15,18,16,17,17,15,18,18,19,18,20,17,21,15,22,17,23,15,24,18,25,18,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=132
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,17,9,18,10,18,11,18,12,18,13,18,14,17,15,18,16,16,17,15,18,18,19,18,20,18,21,15,22,16,23,15,24,18,25,18,26,18,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=136
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,17,9,18,10,18,11,18,12,18,13,18,14,17,15,18,16,17,17,15,18,18,19,18,20,18,21,15,22,17,23,15,24,18,25,18,26,18,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=140
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,17,9,17,10,18,11,18,12,18,13,18,14,17,15,17,16,18,17,16,18,18,19,18,20,18,21,15,22,18,23,16,24,18,25,18,26,18,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=144
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,18,6,18,7,18,8,17,9,17,10,18,11,18,12,18,13,18,14,17,15,17,16,18,17,16,18,18,19,18,20,18,21,15,22,18,23,16,24,18,25,18,26,18,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
}
## 5G subband3 Tx power limit CFG
txpwrlimit_5g_cfg_set_sub2={
CmdCode=0x00fb # do NOT change this line
Action:2=1 # 1 - SET
SubBand:2=0 # do NOT use this member in set cmd
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=149
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,18,7,18,8,18,9,18,10,18,11,19,12,18,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=153
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=157
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=161
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=165
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
}
## 5G subband4 Tx power limit CFG
txpwrlimit_5g_cfg_set_sub3={
CmdCode=0x00fb # do NOT change this line
Action:2=1 # 1 - SET
SubBand:2=0 # do NOT use this in set cmd
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=183
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=184
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=185
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=187
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=188
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=189
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=192
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=4000
TLVChanWidth:1=20
TLVChanNum:1=196
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=7
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=8
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=11
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=12
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=16
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
ChanTRPC.TlvType:2=0x0189
ChanTRPC.TlvLength:2={
TLVStartFreq:2=5000
TLVChanWidth:1=20
TLVChanNum:1=34
TLVPwr:72='0,0,1,20,2,20,3,19,4,18,5,19,6,19,7,18,8,18,9,18,10,18,11,19,12,19,13,18,14,18,15,18,16,17,17,17,18,18,19,19,20,17,21,15,22,17,23,17,24,18,25,19,26,17,27,15,28,5,29,5,30,5,31,5,32,5,33,5,34,5,35,5'
}
}

View file

@ -0,0 +1,172 @@
# File : txrate_cfg.conf
## Tx Rate Configuration command
txrate_cfg_get={
CmdCode=0x00d6 # do NOT change this line
Action:2=0 # 0 - GET
Index:2=0 # do NOT change this line
TxRateScope.TlvType:2=0x0153
TxRateScope.TlvLength:2={
}
}
txrate_cfg_set_bg={
CmdCode=0x00d6 # do NOT change this line
Action:2=1 # 1 - SET
Index:2=0 # do NOT change this line
TxRateScope.TlvType:2=0x0153
TxRateScope.TlvLength:2={
################# TXRATE SCOPE ######################
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 1 Mbps
# 1 2 Mbps
# 2 5.5 Mbps
# 3 11 Mbps
# 4 Reserved
HRDSSS.RateScope:2=0x0000
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 6 Mbps
# 1 9 Mbps
# 2 12 Mbps
# 3 18 Mbps
# 4 24 Mbps
# 5 36 Mbps
# 6 48 Mbps
# 7 54 Mbps
OFDM.RateScope:2=0x0080
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 MCS0
# 1 MCS1
# 2 MCS2
# 3 MCS3
# 4 MCS4
# 5 MCS5
# 6 MCS6
# 7 MCS7
# 32 MCS32
HT.RateScopeDword0:4=0x00000000
HT.RateScopeDword1:4=0x00000000
HT.RateScopeDword2:4=0x00000000
HT.RateScopeDword3:4=0x00000000
}
TxRateDrop.TlvType:2=0x0151
TxRateDrop.TlvLength:2={
RateDrop.Mode:4=0x00000001
}
}
txrate_cfg_set_bgn={
CmdCode=0x00d6 # do NOT change this line
Action:2=1 # 1 - SET
Index:2=0 # do NOT change this line
TxRateScope.TlvType:2=0x0153
TxRateScope.TlvLength:2={
################# TXRATE SCOPE ######################
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 1 Mbps
# 1 2 Mbps
# 2 5.5 Mbps
# 3 11 Mbps
# 4 Reserved
HRDSSS.RateScope:2=0x0000
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 6 Mbps
# 1 9 Mbps
# 2 12 Mbps
# 3 18 Mbps
# 4 24 Mbps
# 5 36 Mbps
# 6 48 Mbps
# 7 54 Mbps
OFDM.RateScope:2=0x0000
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit Data rate
# 0 MCS0
# 1 MCS1
# 2 MCS2
# 3 MCS3
# 4 MCS4
# 5 MCS5
# 6 MCS6
# 7 MCS7
# 32 MCS32
HT.RateScopeDword0:4=0x00000080
HT.RateScopeDword1:4=0x00000000
HT.RateScopeDword2:4=0x00000000
HT.RateScopeDword3:4=0x00000000
}
TxRateDrop.TlvType:2=0x0151
TxRateDrop.TlvLength:2={
RateDrop.Mode:4=0x00000001
}
}
########supported BasicRate setting###########
basic_rate_get={
CmdCode=0x00d6 # do NOT change this line
Action:2=0 # 0 - GET
Index:2=0 # do NOT change this line
TlvType:2=0x21a
TlvLength:2={
}
}
basic_rate_set={
CmdCode=0x00d6 # do NOT change this line
Action:2=1 # 1 - SET
Index:2=0 # do NOT change this line
TlvType:2=0x21a
TlvLength:2={
BasicRateSupport:2=0x000f #defalt value
# The following table shows the bitmap of the rates:
# (bit 0 is the least significant bit)
# Bit BasicRateSupport
# 0 DBPSK1Mbps
# 1 DQPSK2Mbps
# 2 CCK5_5Mbps
# 3 CCK11Mbps
# 4 Not used.
# 5 OFDM6Mbps
# 6 OFDM9Mbps
# 7 OFDM12Mbps
# 8 OFDM18Mbps
# 9 OFDM24Mbps
# 10 OFDM36Mbps
# 11 OFDM48Mbps
# 12 OFDM54Mbps
# 13-15 Reserved
#note: value0x0 represents no setting value
#For example:
#BasicRateSupport:2=0x3 set supported BasicRate to DBPSK1Mbps, DQPSK2Mbps
#BasicRateSupport:2=0x180 set supported BasicRate to OFDM18Mbps, OFDM12Mbps
}
}

View file

@ -0,0 +1,179 @@
# Not matter how many spaces or tabs are inserted in a line,
# components and ending format must be exactly same as given
# example:
#
# <card_type>[_<block_id>] = {
# key=value
# }
#
# card_type : 8XXX (mandatory)
# block_id : configuration block id (optional )
# key : module parameter name
# value : value for module parameter
# for string value, no need to add ""
#
# card_type supported: 8887/8897/8997/8977/8987/9098
# block_id: support same chipset with
# different module parameter.
# For example to support mutiple SD8997 cards, usr can
# specify the configuration block id number [0 - 9], if not
# specified, it is taken as 0 by default.
#
# debug related module parameters could not be set via module
# configure file, ex. drvdbg could not be set in this file
#
# line started with "#" will be ignored
# refer to the USB8997_1 for parameters that could be set in
# this configuration file, and set the corresponding value
# according to your real needs
SD8997 = {
cfg80211_wext=0xf
wfd_name=p2p
max_vir_bss=1
cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
drv_mode=7
}
#SD8997_1 = {
# cfg80211_wext=0xf
# wfd_name=wfd0
# max_vir_bss=1
# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
# drv_mode=5
#}
#SD8887 = {
# cfg80211_wext=0xf
# wfd_name=p2p
# max_vir_bss=1
# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
# drv_mode=7
#}
#SD8897 = {
# cfg80211_wext=0xf
# wfd_name=p2p
# max_vir_bss=1
# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
# drv_mode=7
#}
#SD8977 = {
# cfg80211_wext=0xf
# wfd_name=p2p
# max_vir_bss=1
# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
# drv_mode=7
#}
#SD8987 = {
# cfg80211_wext=0xf
# wfd_name=p2p
# max_vir_bss=1
# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
# drv_mode=7
#}
USB8997 = {
cfg80211_wext=0xf
wfd_name=p2p
max_vir_bss=1
cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
drv_mode=7
}
PCIE8997 = {
cfg80211_wext=0xf
wfd_name=p2p
max_vir_bss=1
cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
drv_mode=7
}
PCIE9098_0 = {
cfg80211_wext=0xf
wfd_name=p2p
max_vir_bss=1
cal_data_cfg=none
drv_mode=7
mac_addr=00:50:43:20:12:34
}
PCIE9098_1 = {
cfg80211_wext=0xf
wfd_name=p2p
max_vir_bss=1
cal_data_cfg=none
drv_mode=7
mac_addr=00:50:43:20:52:56
}
#USB8997 = {
# hw_test=0
# fw_name="nxp/usbusb8997_combo_v4.bin"
# req_fw_nowait=1
# fw_reload=3
# fw_serial=1
# fw_region=0
# mac_addr=00:50:43:22:1e:3d
# mfg_mode=0
# drv_mode=0x5
# max_sta_bss=1
# sta_name=wlan
# max_uap_bss=1
# uap_name=uap
# wfd_name=p2p
# max_vir_bss=1
# max_mpl_bss=1
# nan_name=nan
# max_nan_bss=1
# max_11p_bss=1
# auto_ds=0
# ps_mode=1
# max_tx_buf=4096
# intmode=0
# gpiopin=0
# pm_keep_power=0
# shutdown_hs=1
# cfg_11d=1
# start_11ai_scan=0
# oob_mode=0
# sdio_pd=1
# cal_data_cfg=nxp/WlanCalData_ext_8997_QFN_TB.conf
# txpwrtlimit_cfg=nxp/txpwr_limit.conf
# cntry_txpwrt=0
# init_hostcmd_cfg=nxp/init_hostcmd_cfg.conf
# minicard_pwrup=0
# cfg80211_wext=0xf
# skip_fwdnld=0
# wq_sched_prio=0
# wq_sched_policy=0
# rx_work=1
# aggrctrl=1
# usb_aggr=1
# pcie_int_mode=1
# low_power_mode_enable=1
# wakelock_timeout=10
# dev_cap_mask=0xffffffff
# sdio_rx_aggr=1
# pmic=1
# antcfg=0
# uap_oper_ctrl=0
# hs_wake_interval=400
# indication_gpio=0xff
# disconnect_on_suspend=0
# hs_mimo_switch=1
# indrstcfg=0xffffffff
# fixed_beacon_buffer=0
# GoAgeoutTime=0
# gtk_rekey_offload=1
# multi_dtim=0
# inact_tmo=0
# usb_fw_option=1
# napi=1
# dfs_offload=1
# cfg80211_drcs=1
# drcs_chantime_mode=0
# reg_alpha2=US
#}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,254 @@
/** @file mlanconfig.h
*
* @brief This file contains definitions for application
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
11/26/2008: initial version
************************************************************************/
#ifndef _MLANCONFIG_H_
#define _MLANCONFIG_H_
/** Include header files */
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <linux/if.h>
#include <linux/wireless.h>
#include <sys/types.h>
#include <linux/if_ether.h>
#include <time.h>
#if (BYTE_ORDER == LITTLE_ENDIAN)
#undef BIG_ENDIAN_SUPPORT
#endif
/** Type definition: boolean */
typedef enum { FALSE, TRUE } boolean;
/**
* This macro specifies the attribute pack used for structure packing
*/
#ifndef __ATTRIB_PACK__
#define __ATTRIB_PACK__ __attribute__((packed))
#endif
/** 16 bits byte swap */
#define swap_byte_16(x) \
((t_u16)((((t_u16)(x) & 0x00ffU) << 8) | \
(((t_u16)(x) & 0xff00U) >> 8)))
/** 32 bits byte swap */
#define swap_byte_32(x) \
((t_u32)((((t_u32)(x) & 0x000000ffUL) << 24) | \
(((t_u32)(x) & 0x0000ff00UL) << 8) | \
(((t_u32)(x) & 0x00ff0000UL) >> 8) | \
(((t_u32)(x) & 0xff000000UL) >> 24)))
/** Convert to correct endian format */
#ifdef BIG_ENDIAN_SUPPORT
/** CPU to little-endian convert for 16-bit */
#define cpu_to_le16(x) swap_byte_16(x)
/** CPU to little-endian convert for 32-bit */
#define cpu_to_le32(x) swap_byte_32(x)
/** Little-endian to CPU convert for 16-bit */
#define le16_to_cpu(x) swap_byte_16(x)
/** Little-endian to CPU convert for 32-bit */
#define le32_to_cpu(x) swap_byte_32(x)
#else
/** Do nothing */
#define cpu_to_le16(x) (x)
/** Do nothing */
#define cpu_to_le32(x) (x)
/** Do nothing */
#define le16_to_cpu(x) (x)
/** Do nothing */
#define le32_to_cpu(x) (x)
#endif
/** Character, 1 byte */
typedef char t_s8;
/** Unsigned character, 1 byte */
typedef unsigned char t_u8;
/** Short integer */
typedef signed short t_s16;
/** Unsigned short integer */
typedef unsigned short t_u16;
/** Integer */
typedef signed int t_s32;
/** Unsigned integer */
typedef unsigned int t_u32;
/** Long long integer */
typedef signed long long t_s64;
/** Unsigned long long integer */
typedef unsigned long long t_u64;
/** Void pointer (4-bytes) */
typedef void t_void;
/** Success */
#define MLAN_STATUS_SUCCESS (0)
/** Failure */
#define MLAN_STATUS_FAILURE (-1)
t_s8 *mlan_config_get_line(FILE * fp, t_s8 *s, t_s32 size, int *line);
int get_priv_ioctl(char *ioctl_name, int *ioctl_val, int *subioctl_val);
int fparse_for_hex(FILE * fp, t_u8 *dst);
/**
* Hex or Decimal to Integer
* @param num string to convert into decimal or hex
*/
#define A2HEXDECIMAL(num) \
(strncasecmp("0x", (num), 2)?(unsigned int) strtoll((num),NULL,0):a2hex((num)))
/** Convert character to integer */
#define CHAR2INT(x) (((x) >= 'A') ? ((x) - 'A' + 10) : ((x) - '0'))
/** Convert TLV header from little endian format to CPU format */
#define endian_convert_tlv_header_in(x) \
{ \
(x)->tag = le16_to_cpu((x)->tag); \
(x)->length = le16_to_cpu((x)->length); \
}
/** Convert TLV header to little endian format from CPU format */
#define endian_convert_tlv_header_out(x) \
{ \
(x)->tag = cpu_to_le16((x)->tag); \
(x)->length = cpu_to_le16((x)->length); \
}
/** Private command ID to pass custom IE list */
#define CUSTOM_IE_CFG (SIOCDEVPRIVATE + 13)
/* TLV Definitions */
/** TLV header */
#define TLVHEADER /** Tag */ \
t_u16 tag; \
/** Length */ \
t_u16 length
/** Maximum IE buffer length */
#define MAX_IE_BUFFER_LEN 256
/** TLV: Management IE list */
#define MRVL_MGMT_IE_LIST_TLV_ID (PROPRIETARY_TLV_BASE_ID + 0x69) //0x0169
/** TLV: Max Management IE */
#define MRVL_MAX_MGMT_IE_TLV_ID (PROPRIETARY_TLV_BASE_ID + 0xaa) //0x01aa
/** custom IE info */
typedef struct _custom_ie_info {
/** size of buffer */
t_u16 buf_size;
/** no of buffers of buf_size */
t_u16 buf_count;
} __ATTRIB_PACK__ custom_ie_info;
/** TLV buffer : custom IE */
typedef struct _tlvbuf_max_mgmt_ie {
/** Header */
TLVHEADER;
/** No of tuples */
t_u16 count;
/** custom IE info tuples */
custom_ie_info info[];
} __ATTRIB_PACK__ tlvbuf_max_mgmt_ie;
/** custom IE */
typedef struct _custom_ie {
/** IE Index */
t_u16 ie_index;
/** Mgmt Subtype Mask */
t_u16 mgmt_subtype_mask;
/** IE Length */
t_u16 ie_length;
/** IE buffer */
t_u8 ie_buffer[];
} __ATTRIB_PACK__ custom_ie;
/** TLV buffer : custom IE */
typedef struct _tlvbuf_custom_ie {
/** Header */
TLVHEADER;
/** custom IE data */
custom_ie ie_data[];
} __ATTRIB_PACK__ tlvbuf_custom_ie;
/** Maximum length of lines in configuration file */
#define MAX_CONFIG_LINE 1024
/** Ethernet address length */
#define ETH_ALEN 6
/** MAC BROADCAST */
#define MAC_BROADCAST 0x1FF
/** MAC MULTICAST */
#define MAC_MULTICAST 0x1FE
/** pkt_header */
typedef struct _pkt_header {
/** pkt_len */
t_u32 pkt_len;
/** pkt_type */
t_u32 TxPktType;
/** tx control */
t_u32 TxControl;
} pkt_header;
/** wlan_802_11_header packet from FW with length */
typedef struct _wlan_mgmt_frame_tx {
/** Packet Length */
t_u16 frm_len;
/** Frame Control */
t_u16 frm_ctl;
/** Duration ID */
t_u16 duration_id;
/** Address1 */
t_u8 addr1[ETH_ALEN];
/** Address2 */
t_u8 addr2[ETH_ALEN];
/** Address3 */
t_u8 addr3[ETH_ALEN];
/** Sequence Control */
t_u16 seq_ctl;
/** Address4 */
t_u8 addr4[ETH_ALEN];
/** Frame payload */
t_u8 payload[];
} __ATTRIB_PACK__ wlan_mgmt_frame_tx;
/** frame tx ioctl number */
#define FRAME_TX_IOCTL (SIOCDEVPRIVATE + 12)
extern t_s32 sockfd; /**< socket */
extern t_s8 dev_name[IFNAMSIZ + 1]; /**< device name */
#endif /* _MLANCONFIG_H_ */

View file

@ -0,0 +1,928 @@
/** @file mlanhostcmd.c
*
* @brief This file contains mlanconfig helper functions
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
11/26/2008: initial version
************************************************************************/
#include "mlanconfig.h"
#include "mlanhostcmd.h"
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief get hostcmd data
*
* @param ln A pointer to line number
* @param buf A pointer to hostcmd data
* @param size A pointer to the return size of hostcmd buffer
* @return MLAN_STATUS_SUCCESS
*/
static int
mlan_get_hostcmd_data(FILE * fp, int *ln, t_u8 *buf, t_u16 *size)
{
t_s32 errors = 0, i;
t_s8 line[512], *pos, *pos1, *pos2, *pos3;
t_u16 len;
while ((pos = mlan_config_get_line(fp, line, sizeof(line), ln))) {
(*ln)++;
if (strcmp(pos, "}") == 0) {
break;
}
pos1 = strchr(pos, ':');
if (pos1 == NULL) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos1++ = '\0';
pos2 = strchr(pos1, '=');
if (pos2 == NULL) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos2++ = '\0';
len = a2hex_or_atoi(pos1);
if (len < 1 || len > MRVDRV_SIZE_OF_CMD_BUFFER) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*size += len;
if (*pos2 == '"') {
pos2++;
if ((pos3 = strchr(pos2, '"')) == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = '\0';
memset(buf, 0, len);
memmove(buf, pos2, MIN(strlen(pos2), len));
buf += len;
} else if (*pos2 == '\'') {
pos2++;
if ((pos3 = strchr(pos2, '\'')) == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = ',';
for (i = 0; i < len; i++) {
if ((pos3 = strchr(pos2, ',')) != NULL) {
*pos3 = '\0';
*buf++ = (t_u8)a2hex_or_atoi(pos2);
pos2 = pos3 + 1;
} else
*buf++ = 0;
}
} else if (*pos2 == '{') {
t_u16 tlvlen = 0, tmp_tlvlen;
mlan_get_hostcmd_data(fp, ln, buf + len, &tlvlen);
tmp_tlvlen = tlvlen;
while (len--) {
*buf++ = (t_u8)(tmp_tlvlen & 0xff);
tmp_tlvlen >>= 8;
}
*size += tlvlen;
buf += tlvlen;
} else {
t_u32 value = a2hex_or_atoi(pos2);
while (len--) {
*buf++ = (t_u8)(value & 0xff);
value >>= 8;
}
}
}
return MLAN_STATUS_SUCCESS;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief convert char to hex integer
*
* @param chr char to convert
* @return hex integer or 0
*/
int
hexval(t_s32 chr)
{
if (chr >= '0' && chr <= '9')
return chr - '0';
if (chr >= 'A' && chr <= 'F')
return chr - 'A' + 10;
if (chr >= 'a' && chr <= 'f')
return chr - 'a' + 10;
return 0;
}
/**
* @brief Hump hex data
*
* @param prompt A pointer prompt buffer
* @param p A pointer to data buffer
* @param len the len of data buffer
* @param delim delim char
* @return hex integer
*/
t_void
hexdump(t_s8 *prompt, t_void *p, t_s32 len, t_s8 delim)
{
t_s32 i;
t_u8 *s = p;
if (prompt) {
printf("%s: len=%d\n", prompt, (int)len);
}
for (i = 0; i < len; i++) {
if (i != len - 1)
printf("%02x%c", *s++, delim);
else
printf("%02x\n", *s);
if ((i + 1) % 16 == 0)
printf("\n");
}
printf("\n");
}
/**
* @brief convert char to hex integer
*
* @param chr char
* @return hex integer
*/
t_u8
hexc2bin(t_s8 chr)
{
if (chr >= '0' && chr <= '9')
chr -= '0';
else if (chr >= 'A' && chr <= 'F')
chr -= ('A' - 10);
else if (chr >= 'a' && chr <= 'f')
chr -= ('a' - 10);
return chr;
}
/**
* @brief convert string to hex integer
*
* @param s A pointer string buffer
* @return hex integer
*/
t_u32
a2hex(t_s8 *s)
{
t_u32 val = 0;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s && isxdigit(*s)) {
val = (val << 4) + hexc2bin(*s++);
}
return val;
}
/*
* @brief convert String to integer
*
* @param value A pointer to string
* @return integer
*/
t_u32
a2hex_or_atoi(t_s8 *value)
{
if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) {
return a2hex(value + 2);
} else if (isdigit(*value)) {
return atoi(value);
} else {
return *value;
}
}
/**
* @brief convert string to hex
*
* @param ptr A pointer to data buffer
* @param chr A pointer to return integer
* @return A pointer to next data field
*/
t_s8 *
convert2hex(t_s8 *ptr, t_u8 *chr)
{
t_u8 val;
for (val = 0; *ptr && isxdigit(*ptr); ptr++) {
val = (val * 16) + hexval(*ptr);
}
*chr = val;
return ptr;
}
/**
* @brief Check the Hex String
* @param s A pointer to the string
* @return MLAN_STATUS_SUCCESS --HexString, MLAN_STATUS_FAILURE --not HexString
*/
int
ishexstring(t_s8 *s)
{
int ret = MLAN_STATUS_FAILURE;
t_s32 tmp;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s) {
tmp = toupper(*s);
if (((tmp >= 'A') && (tmp <= 'F')) ||
((tmp >= '0') && (tmp <= '9'))) {
ret = MLAN_STATUS_SUCCESS;
} else {
ret = MLAN_STATUS_FAILURE;
break;
}
s++;
}
return ret;
}
/**
* @brief Convert String to Integer
* @param buf A pointer to the string
* @return Integer
*/
int
atoval(t_s8 *buf)
{
if (!strncasecmp(buf, "0x", 2))
return a2hex(buf + 2);
else if (!ishexstring(buf))
return a2hex(buf);
else
return atoi(buf);
}
/**
* @brief Prepare host-command buffer
* @param fp File handler
* @param cmd_name Command name
* @param buf A pointer to comand buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf)
{
t_s8 line[256], cmdname[256], *pos, cmdcode[10];
HostCmd_DS_GEN *hostcmd;
int ln = 0;
int cmdname_found = 0, cmdcode_found = 0;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
hostcmd->command = 0xffff;
snprintf(cmdname, sizeof(cmdname), "%s={", cmd_name);
cmdname_found = 0;
while ((pos = mlan_config_get_line(fp, line, sizeof(line), &ln))) {
if (strcmp(pos, cmdname) == 0) {
t_u16 len = 0;
cmdname_found = 1;
snprintf(cmdcode, sizeof(cmdcode), "CmdCode=");
cmdcode_found = 0;
while ((pos =
mlan_config_get_line(fp, line, sizeof(line),
&ln))) {
if (strncmp(pos, cmdcode, strlen(cmdcode)) == 0) {
cmdcode_found = 1;
hostcmd->command =
a2hex_or_atoi(pos +
strlen(cmdcode));
hostcmd->size = S_DS_GEN;
mlan_get_hostcmd_data(fp, &ln,
buf +
hostcmd->size,
&len);
hostcmd->size += len;
break;
}
}
if (!cmdcode_found) {
fprintf(stderr,
"mlanconfig: CmdCode not found in conf file\n");
return MLAN_STATUS_FAILURE;
}
break;
}
}
if (!cmdname_found) {
fprintf(stderr,
"mlanconfig: cmdname '%s' is not found in conf file\n",
cmd_name);
return MLAN_STATUS_FAILURE;
}
hostcmd->seq_num = 0;
hostcmd->result = 0;
hostcmd->command = cpu_to_le16(hostcmd->command);
hostcmd->size = cpu_to_le16(hostcmd->size);
return MLAN_STATUS_SUCCESS;
}
/** Config data header length */
#define CFG_DATA_HEADER_LEN 6
/**
* @brief Prepare cfg-data buffer
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param fp File handler
* @param buf A pointer to comand buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_cfg_data_buffer(int argc, char *argv[], FILE * fp, t_u8 *buf)
{
int ln = 0, type;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_802_11_CFG_DATA *pcfg_data;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
hostcmd->command = cpu_to_le16(HostCmd_CMD_CFG_DATA);
pcfg_data = (HostCmd_DS_802_11_CFG_DATA *)(buf + S_DS_GEN);
pcfg_data->action =
(argc == 4) ? HostCmd_ACT_GEN_GET : HostCmd_ACT_GEN_SET;
type = atoi(argv[3]);
if ((type < 1) || (type > 2)) {
fprintf(stderr, "mlanconfig: Invalid register type\n");
return MLAN_STATUS_FAILURE;
} else {
pcfg_data->type = type;
}
if (argc == 5) {
ln = fparse_for_hex(fp, pcfg_data->data);
}
pcfg_data->data_len = ln;
hostcmd->size =
cpu_to_le16(pcfg_data->data_len + S_DS_GEN +
CFG_DATA_HEADER_LEN);
pcfg_data->data_len = cpu_to_le16(pcfg_data->data_len);
pcfg_data->type = cpu_to_le16(pcfg_data->type);
pcfg_data->action = cpu_to_le16(pcfg_data->action);
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}
/**
* @brief Process host_cmd response
* @param buf A pointer to the response buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_host_cmd_resp(t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd = (HostCmd_DS_GEN *)buf;
int ret = MLAN_STATUS_SUCCESS;
hostcmd->command = le16_to_cpu(hostcmd->command);
hostcmd->size = le16_to_cpu(hostcmd->size);
hostcmd->seq_num = le16_to_cpu(hostcmd->seq_num);
hostcmd->result = le16_to_cpu(hostcmd->result);
hostcmd->command &= ~HostCmd_RET_BIT;
if (!hostcmd->result) {
switch (hostcmd->command) {
case HostCmd_CMD_CFG_DATA:
{
HostCmd_DS_802_11_CFG_DATA *pstcfgData =
(HostCmd_DS_802_11_CFG_DATA *)(buf +
S_DS_GEN);
pstcfgData->data_len =
le16_to_cpu(pstcfgData->data_len);
pstcfgData->action =
le16_to_cpu(pstcfgData->action);
if (pstcfgData->action == HostCmd_ACT_GEN_GET) {
hexdump("cfgdata", pstcfgData->data,
pstcfgData->data_len, ' ');
}
break;
}
case HostCmd_CMD_802_11_TPC_ADAPT_REQ:
{
mlan_ioctl_11h_tpc_resp *tpcIoctlResp =
(mlan_ioctl_11h_tpc_resp *)(buf +
S_DS_GEN);
if (tpcIoctlResp->status_code == 0) {
printf("tpcrequest: txPower(%d), linkMargin(%d), rssi(%d)\n", tpcIoctlResp->tx_power, tpcIoctlResp->link_margin, tpcIoctlResp->rssi);
} else {
printf("tpcrequest: failure, status = %d\n", tpcIoctlResp->status_code);
}
break;
}
case HostCmd_CMD_802_11_CRYPTO:
{
t_u16 alg =
le16_to_cpu((t_u16)
*(buf + S_DS_GEN +
sizeof(t_u16)));
if (alg == CIPHER_TEST_AES_CCM ||
alg == CIPHER_TEST_GCMP) {
HostCmd_DS_802_11_CRYPTO_AES_CCM
*cmd_aes_ccm =
(HostCmd_DS_802_11_CRYPTO_AES_CCM
*)(buf + S_DS_GEN);
cmd_aes_ccm->encdec
=
le16_to_cpu(cmd_aes_ccm->
encdec);
cmd_aes_ccm->algorithm =
le16_to_cpu(cmd_aes_ccm->
algorithm);
cmd_aes_ccm->key_length =
le16_to_cpu(cmd_aes_ccm->
key_length);
cmd_aes_ccm->nonce_length =
le16_to_cpu(cmd_aes_ccm->
nonce_length);
cmd_aes_ccm->AAD_length =
le16_to_cpu(cmd_aes_ccm->
AAD_length);
cmd_aes_ccm->data.header.type =
le16_to_cpu(cmd_aes_ccm->data.
header.type);
cmd_aes_ccm->data.header.len =
le16_to_cpu(cmd_aes_ccm->data.
header.len);
printf("crypto_result: encdec=%d algorithm=%d, KeyLen=%d," " NonceLen=%d,AADLen=%d,dataLen=%d\n", cmd_aes_ccm->encdec, cmd_aes_ccm->algorithm, cmd_aes_ccm->key_length, cmd_aes_ccm->nonce_length, cmd_aes_ccm->AAD_length, cmd_aes_ccm->data.header.len);
hexdump("Key", cmd_aes_ccm->key,
cmd_aes_ccm->key_length, ' ');
hexdump("Nonce", cmd_aes_ccm->nonce,
cmd_aes_ccm->nonce_length, ' ');
hexdump("AAD", cmd_aes_ccm->AAD,
cmd_aes_ccm->AAD_length, ' ');
hexdump("Data", cmd_aes_ccm->data.data,
cmd_aes_ccm->data.header.len,
' ');
} else if (alg == CIPHER_TEST_WAPI) {
HostCmd_DS_802_11_CRYPTO_WAPI *cmd_wapi
=
(HostCmd_DS_802_11_CRYPTO_WAPI
*) (buf + S_DS_GEN);
cmd_wapi->encdec
= le16_to_cpu(cmd_wapi->encdec);
cmd_wapi->algorithm
=
le16_to_cpu(cmd_wapi->
algorithm);
cmd_wapi->key_length =
le16_to_cpu(cmd_wapi->
key_length);
cmd_wapi->nonce_length =
le16_to_cpu(cmd_wapi->
nonce_length);
cmd_wapi->AAD_length =
le16_to_cpu(cmd_wapi->
AAD_length);
printf("crypto_result: encdec=%d algorithm=%d, KeyLen=%d," " NonceLen=%d,AADLen=%d,dataLen=%d\n", cmd_wapi->encdec, cmd_wapi->algorithm, cmd_wapi->key_length, cmd_wapi->nonce_length, cmd_wapi->AAD_length, cmd_wapi->data_length);
hexdump("Key", cmd_wapi->key,
cmd_wapi->key_length, ' ');
hexdump("Nonce", cmd_wapi->nonce,
cmd_wapi->nonce_length, ' ');
hexdump("AAD", cmd_wapi->AAD,
cmd_wapi->AAD_length, ' ');
} else {
HostCmd_DS_802_11_CRYPTO *cmd =
(HostCmd_DS_802_11_CRYPTO *)(buf
+
S_DS_GEN);
cmd->encdec = le16_to_cpu(cmd->encdec);
cmd->algorithm =
le16_to_cpu(cmd->algorithm);
cmd->key_IV_length =
le16_to_cpu(cmd->key_IV_length);
cmd->key_length =
le16_to_cpu(cmd->key_length);
cmd->data.header.type =
le16_to_cpu(cmd->data.header.
type);
cmd->data.header.len =
le16_to_cpu(cmd->data.header.
len);
printf("crypto_result: encdec=%d algorithm=%d,KeyIVLen=%d," " KeyLen=%d,dataLen=%d\n", cmd->encdec, cmd->algorithm, cmd->key_IV_length, cmd->key_length, cmd->data.header.len);
hexdump("KeyIV", cmd->keyIV,
cmd->key_IV_length, ' ');
hexdump("Key", cmd->key,
cmd->key_length, ' ');
hexdump("Data", cmd->data.data,
cmd->data.header.len, ' ');
}
break;
}
case HostCmd_CMD_802_11_AUTO_TX:
{
HostCmd_DS_802_11_AUTO_TX *at =
(HostCmd_DS_802_11_AUTO_TX *)(buf +
S_DS_GEN);
if (le16_to_cpu(at->action) ==
HostCmd_ACT_GEN_GET) {
if (S_DS_GEN + sizeof(at->action) ==
hostcmd->size) {
printf("auto_tx not configured\n");
} else {
MrvlIEtypesHeader_t *header =
&at->auto_tx.header;
header->type =
le16_to_cpu(header->
type);
header->len =
le16_to_cpu(header->
len);
if ((S_DS_GEN +
sizeof(at->action)
+
sizeof(MrvlIEtypesHeader_t)
+ header->len ==
hostcmd->size) &&
(header->type ==
TLV_TYPE_AUTO_TX)) {
AutoTx_MacFrame_t *atmf
=
&at->auto_tx.
auto_tx_mac_frame;
printf("Interval: %d second(s)\n", le16_to_cpu(atmf->interval));
printf("Priority: %#x\n", atmf->priority);
printf("Frame Length: %d\n", le16_to_cpu(atmf->frame_len));
printf("Dest Mac Address: " "%02x:%02x:%02x:%02x:%02x:%02x\n", atmf->dest_mac_addr[0], atmf->dest_mac_addr[1], atmf->dest_mac_addr[2], atmf->dest_mac_addr[3], atmf->dest_mac_addr[4], atmf->dest_mac_addr[5]);
printf("Src Mac Address: " "%02x:%02x:%02x:%02x:%02x:%02x\n", atmf->src_mac_addr[0], atmf->src_mac_addr[1], atmf->src_mac_addr[2], atmf->src_mac_addr[3], atmf->src_mac_addr[4], atmf->src_mac_addr[5]);
hexdump("Frame Payload",
atmf->payload,
le16_to_cpu
(atmf->
frame_len)
-
MLAN_MAC_ADDR_LENGTH
* 2, ' ');
} else {
printf("incorrect auto_tx command response\n");
}
}
}
break;
}
case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
{
HostCmd_DS_802_11_SUBSCRIBE_EVENT *se =
(HostCmd_DS_802_11_SUBSCRIBE_EVENT
*)(buf + S_DS_GEN);
if (le16_to_cpu(se->action) ==
HostCmd_ACT_GEN_GET) {
int len =
S_DS_GEN +
sizeof
(HostCmd_DS_802_11_SUBSCRIBE_EVENT);
printf("\nEvent\t\tValue\tFreq\tsubscribed\n\n");
while (len < hostcmd->size) {
MrvlIEtypesHeader_t *header =
(MrvlIEtypesHeader_t
*)(buf + len);
switch (le16_to_cpu
(header->type)) {
case TLV_TYPE_RSSI_LOW:
{
MrvlIEtypes_RssiThreshold_t
*low_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Beacon Low RSSI\t%d\t%d\t%s\n", low_rssi->RSSI_value, low_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0001) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_LOW:
{
MrvlIEtypes_SnrThreshold_t
*low_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Beacon Low SNR\t%d\t%d\t%s\n", low_snr->SNR_value, low_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0002) ? "yes" : "no");
break;
}
case TLV_TYPE_FAILCOUNT:
{
MrvlIEtypes_FailureCount_t
*failure_count
=
(MrvlIEtypes_FailureCount_t
*)(buf
+
len);
printf("Failure Count\t%d\t%d\t%s\n", failure_count->fail_value, failure_count->fail_freq, (le16_to_cpu(se->events) & 0x0004) ? "yes" : "no");
break;
}
case TLV_TYPE_BCNMISS:
{
MrvlIEtypes_BeaconsMissed_t
*bcn_missed
=
(MrvlIEtypes_BeaconsMissed_t
*)(buf
+
len);
printf("Beacon Missed\t%d\tN/A\t%s\n", bcn_missed->beacon_missed, (le16_to_cpu(se->events) & 0x0008) ? "yes" : "no");
break;
}
case TLV_TYPE_RSSI_HIGH:
{
MrvlIEtypes_RssiThreshold_t
*high_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Bcn High RSSI\t%d\t%d\t%s\n", high_rssi->RSSI_value, high_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0010) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_HIGH:
{
MrvlIEtypes_SnrThreshold_t
*high_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Beacon High SNR\t%d\t%d\t%s\n", high_snr->SNR_value, high_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0020) ? "yes" : "no");
break;
}
case TLV_TYPE_RSSI_LOW_DATA:
{
MrvlIEtypes_RssiThreshold_t
*low_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Data Low RSSI\t%d\t%d\t%s\n", low_rssi->RSSI_value, low_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0040) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_LOW_DATA:
{
MrvlIEtypes_SnrThreshold_t
*low_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Data Low SNR\t%d\t%d\t%s\n", low_snr->SNR_value, low_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0080) ? "yes" : "no");
break;
}
case TLV_TYPE_RSSI_HIGH_DATA:
{
MrvlIEtypes_RssiThreshold_t
*high_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Data High RSSI\t%d\t%d\t%s\n", high_rssi->RSSI_value, high_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0100) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_HIGH_DATA:
{
MrvlIEtypes_SnrThreshold_t
*high_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Data High SNR\t%d\t%d\t%s\n", high_snr->SNR_value, high_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0200) ? "yes" : "no");
break;
}
case TLV_TYPE_LINK_QUALITY:
{
MrvlIEtypes_LinkQuality_t
*link_qual
=
(MrvlIEtypes_LinkQuality_t
*)(buf
+
len);
printf("Link Quality Parameters:\n");
printf("------------------------\n");
printf("Link Quality Event Subscribed\t%s\n", (le16_to_cpu(se->events) & 0x0400) ? "yes" : "no");
printf("Link SNR Threshold = %d\n", le16_to_cpu(link_qual->link_SNR_thrs));
printf("Link SNR Frequency = %d\n", le16_to_cpu(link_qual->link_SNR_freq));
printf("Min Rate Value = %d\n", le16_to_cpu(link_qual->min_rate_val));
printf("Min Rate Frequency = %d\n", le16_to_cpu(link_qual->min_rate_freq));
printf("Tx Latency Value = %d\n", le32_to_cpu(link_qual->tx_latency_val));
printf("Tx Latency Threshold = %d\n", le32_to_cpu(link_qual->tx_latency_thrs));
break;
}
case TLV_TYPE_PRE_BEACON_LOST:
{
MrvlIEtypes_PreBeaconLost_t
*pre_bcn_lost
=
(MrvlIEtypes_PreBeaconLost_t
*)(buf
+
len);
printf("------------------------\n");
printf("Pre-Beacon Lost Event Subscribed\t%s\n", (le16_to_cpu(se->events) & 0x0800) ? "yes" : "no");
printf("Pre-Beacon Lost: %d\n", pre_bcn_lost->pre_beacon_lost);
break;
}
default:
printf("Unknown subscribed event TLV Type=%#x," " Len=%d\n", le16_to_cpu(header->type), le16_to_cpu(header->len));
break;
}
len += (sizeof
(MrvlIEtypesHeader_t)
+
le16_to_cpu(header->
len));
}
}
break;
}
case HostCmd_CMD_MAC_REG_ACCESS:
case HostCmd_CMD_BBP_REG_ACCESS:
case HostCmd_CMD_RF_REG_ACCESS:
case HostCmd_CMD_CAU_REG_ACCESS:
{
HostCmd_DS_REG *preg =
(HostCmd_DS_REG *)(buf + S_DS_GEN);
preg->action = le16_to_cpu(preg->action);
if (preg->action == HostCmd_ACT_GEN_GET) {
preg->value = le32_to_cpu(preg->value);
printf("value = 0x%08x\n", preg->value);
}
break;
}
case HostCmd_CMD_MEM_ACCESS:
{
HostCmd_DS_MEM *pmem =
(HostCmd_DS_MEM *)(buf + S_DS_GEN);
pmem->action = le16_to_cpu(pmem->action);
if (pmem->action == HostCmd_ACT_GEN_GET) {
pmem->value = le32_to_cpu(pmem->value);
printf("value = 0x%08x\n", pmem->value);
}
break;
}
default:
printf("HOSTCMD_RESP: CmdCode=%#04x, Size=%#04x,"
" SeqNum=%#04x, Result=%#04x\n",
hostcmd->command, hostcmd->size,
hostcmd->seq_num, hostcmd->result);
hexdump("payload",
(t_void *)(buf + S_DS_GEN),
hostcmd->size - S_DS_GEN, ' ');
break;
}
} else {
printf("HOSTCMD failed: CmdCode=%#04x, Size=%#04x,"
" SeqNum=%#04x, Result=%#04x\n",
hostcmd->command, hostcmd->size,
hostcmd->seq_num, hostcmd->result);
}
return ret;
}
/**
* @brief Prepare the hostcmd for register access
* @param type Register type
* @param offset Register offset
* @param value Pointer to value (NULL for read)
* @param buf Pointer to hostcmd buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REG *preg;
hostcmd = (HostCmd_DS_GEN *)buf;
switch (type) {
case 1:
hostcmd->command = cpu_to_le16(HostCmd_CMD_MAC_REG_ACCESS);
break;
case 2:
hostcmd->command = cpu_to_le16(HostCmd_CMD_BBP_REG_ACCESS);
break;
case 3:
hostcmd->command = cpu_to_le16(HostCmd_CMD_RF_REG_ACCESS);
break;
case 5:
hostcmd->command = cpu_to_le16(HostCmd_CMD_CAU_REG_ACCESS);
break;
default:
printf("Invalid register set specified\n");
return -EINVAL;
}
preg = (HostCmd_DS_REG *)(buf + S_DS_GEN);
preg->action = (value) ? HostCmd_ACT_GEN_SET : HostCmd_ACT_GEN_GET;
preg->action = cpu_to_le16(preg->action);
preg->offset = cpu_to_le16((t_u16)offset);
if (value)
preg->value = cpu_to_le32(*value);
else
preg->value = 0;
hostcmd->size = cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_REG));
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}

View file

@ -0,0 +1,390 @@
/** @file mlanhostcmd.h
*
* @brief This file contains command structures for mlanconfig application
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
11/26/2008: initial version
************************************************************************/
#ifndef _MLANHOSTCMD_H_
#define _MLANHOSTCMD_H_
/** Find number of elements */
#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
/** MLAN MAC Address Length */
#define MLAN_MAC_ADDR_LENGTH (6)
/** Size of command buffer */
#define MRVDRV_SIZE_OF_CMD_BUFFER (3 * 1024)
/** Command RET code, MSB is set to 1 */
#define HostCmd_RET_BIT 0x8000
/** General purpose action : Get */
#define HostCmd_ACT_GEN_GET 0x0000
/** General purpose action : Set */
#define HostCmd_ACT_GEN_SET 0x0001
/** General purpose action : Clear */
#define HostCmd_ACT_GEN_CLEAR 0x0004
/** General purpose action : Remove */
#define HostCmd_ACT_GEN_REMOVE 0x0004
/** Host Command ID : Memory access */
#define HostCmd_CMD_MEM_ACCESS 0x0086
/** Pre-Authenticate - 11r only */
#define HostCmd_CMD_802_11_AUTHENTICATE 0x0011
/** Read/Write Mac register */
#define HostCmd_CMD_MAC_REG_ACCESS 0x0019
/** Read/Write BBP register */
#define HostCmd_CMD_BBP_REG_ACCESS 0x001a
/** Read/Write RF register */
#define HostCmd_CMD_RF_REG_ACCESS 0x001b
/** Get TX Power data */
#define HostCmd_CMD_802_11_RF_TX_POWER 0x001e
/** Get the current TSF */
#define HostCmd_CMD_GET_TSF 0x0080
/** Host Command ID : CAU register access */
#define HostCmd_CMD_CAU_REG_ACCESS 0x00ed
/** Host Command ID : 802.11 BG scan configuration */
#define HostCmd_CMD_802_11_BG_SCAN_CONFIG 0x006b
/** Host Command ID : Configuration data */
#define HostCmd_CMD_CFG_DATA 0x008f
/** Host Command ID : 802.11 TPC adapt req */
#define HostCmd_CMD_802_11_TPC_ADAPT_REQ 0x0060
/** Host Command ID : 802.11 crypto */
#define HostCmd_CMD_802_11_CRYPTO 0x0078
/** Host Command ID : 802.11 auto Tx */
#define HostCmd_CMD_802_11_AUTO_TX 0x0082
/** Host Command ID : 802.11 subscribe event */
#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075
#ifdef OPCHAN
/** Host Command ID : Operating channel config */
#define HostCmd_CMD_OPCHAN_CONFIG 0x00f8
/** Host Command ID : Opchan channel group config */
#define HostCmd_CMD_OPCHAN_CHANGROUP_CONFIG 0x00f9
#endif
/** Host Command ID : Channel TRPC config */
#define HostCmd_CMD_CHAN_TRPC_CONFIG 0x00fb
/** TLV type ID definition */
#define PROPRIETARY_TLV_BASE_ID 0x0100
/** TLV type : Beacon RSSI low */
#define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 0x04) //0x0104
/** TLV type : Beacon SNR low */
#define TLV_TYPE_SNR_LOW (PROPRIETARY_TLV_BASE_ID + 0x05) //0x0105
/** TLV type : Fail count */
#define TLV_TYPE_FAILCOUNT (PROPRIETARY_TLV_BASE_ID + 0x06) //0x0106
/** TLV type : BCN miss */
#define TLV_TYPE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 0x07) //0x0107
/** TLV type : Beacon RSSI high */
#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 0x16) //0x0116
/** TLV type : Beacon SNR high */
#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 0x17) //0x0117
/** TLV type : Auto Tx */
#define TLV_TYPE_AUTO_TX (PROPRIETARY_TLV_BASE_ID + 0x18) //0x0118
/** TLV type :Link Quality */
#define TLV_TYPE_LINK_QUALITY (PROPRIETARY_TLV_BASE_ID + 0x24) //0x0124
/** TLV type : Data RSSI low */
#define TLV_TYPE_RSSI_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x26) //0x0126
/** TLV type : Data SNR low */
#define TLV_TYPE_SNR_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x27) //0x0127
/** TLV type : Data RSSI high */
#define TLV_TYPE_RSSI_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x28) //0x0128
/** TLV type : Data SNR high */
#define TLV_TYPE_SNR_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x29) //0x0129
/** TLV type: Pre-Beacon Lost */
#define TLV_TYPE_PRE_BEACON_LOST (PROPRIETARY_TLV_BASE_ID + 0x49) //0x0149
#ifdef OPCHAN
/** TLV type : Operating channel control description */
#define TLV_TYPE_OPCHAN_CONTROL_DESC (PROPRIETARY_TLV_BASE_ID + 0x79) //0x0179
/** TLV type : Operating channel group control */
#define TLV_TYPE_OPCHAN_CHANGRP_CTRL (PROPRIETARY_TLV_BASE_ID + 0x7a) //0x017a
#endif
/** TLV type : Channel TRPC */
#define TLV_TYPE_CHAN_TRPC (PROPRIETARY_TLV_BASE_ID + 0x89) //0x0189
/* Define general hostcmd data structure */
/** HostCmd_DS_GEN */
typedef struct MAPP_HostCmd_DS_GEN {
/** Command */
t_u16 command;
/** Size */
t_u16 size;
/** Sequence number */
t_u16 seq_num;
/** Result */
t_u16 result;
} __ATTRIB_PACK__ HostCmd_DS_GEN;
typedef struct _HostCmd_DS_MEF_CFG {
/** Criteria */
t_u32 Criteria;
/** Number of entries */
t_u16 NumEntries;
} __ATTRIB_PACK__ HostCmd_DS_MEF_CFG;
typedef struct _MEF_CFG_DATA {
/** Size */
t_u16 size;
/** Data */
HostCmd_DS_MEF_CFG data;
} __ATTRIB_PACK__ MEF_CFG_DATA;
/** Size of HostCmd_DS_GEN */
#define S_DS_GEN sizeof(HostCmd_DS_GEN)
/** HostCmd_DS_REG */
typedef struct MAPP_HostCmd_DS_REG {
/** Read or write */
t_u16 action;
/** Register offset */
t_u16 offset;
/** Value */
t_u32 value;
} __ATTRIB_PACK__ HostCmd_DS_REG;
/** HostCmd_DS_MEM */
typedef struct MAPP_HostCmd_DS_MEM {
/** Read or write */
t_u16 action;
/** Reserved */
t_u16 reserved;
/** Address */
t_u32 addr;
/** Value */
t_u32 value;
} __ATTRIB_PACK__ HostCmd_DS_MEM;
/** HostCmd_DS_802_11_CFG_DATA */
typedef struct MAPP_HostCmd_DS_802_11_CFG_DATA {
/** Action */
t_u16 action;
/** Type */
t_u16 type;
/** Data length */
t_u16 data_len;
/** Data */
t_u8 data[1];
} __ATTRIB_PACK__ HostCmd_DS_802_11_CFG_DATA;
/** mlan_ioctl_11h_tpc_resp */
typedef struct {
int status_code;
/**< Firmware command result status code */
int tx_power;/**< Reported TX Power from the TPC Report */
int link_margin;
/**< Reported Link margin from the TPC Report */
int rssi; /**< RSSI of the received TPC Report frame */
} __ATTRIB_PACK__ mlan_ioctl_11h_tpc_resp;
/** MrvlIEtypesHeader_t */
typedef struct MrvlIEtypesHeader {
/** Header type */
t_u16 type;
/** Header length */
t_u16 len;
} __ATTRIB_PACK__ MrvlIEtypesHeader_t;
/** MrvlIEtypes_Data_t */
typedef struct MrvlIEtypes_Data_t {
/** Header */
MrvlIEtypesHeader_t header;
/** Data */
t_u8 data[1];
} __ATTRIB_PACK__ MrvlIEtypes_Data_t;
/** HostCmd_DS_802_11_CRYPTO */
typedef struct MAPP_HostCmd_DS_802_11_CRYPTO {
t_u16 encdec; /**< Decrypt=0, Encrypt=1 */
t_u16 algorithm; /**< RC4=1 AES=2 , AES_KEY_WRAP=3 */
t_u16 key_IV_length;/**< Length of Key IV (bytes) */
t_u8 keyIV[32]; /**< Key IV */
t_u16 key_length; /**< Length of Key (bytes) */
t_u8 key[32]; /**< Key */
MrvlIEtypes_Data_t data; /**< Plain text if encdec=Encrypt, Ciphertext data if encdec=Decrypt*/
} __ATTRIB_PACK__ HostCmd_DS_802_11_CRYPTO;
/** HostCmd_DS_802_11_CRYPTO_AES_CCM */
typedef struct MAPP_HostCmd_DS_802_11_CRYPTO_AES_CCM {
t_u16 encdec; /**< Decrypt=0, Encrypt=1 */
t_u16 algorithm; /**< AES_CCM=4 */
t_u16 key_length; /**< Length of Key (bytes) */
t_u8 key[32]; /**< Key */
t_u16 nonce_length;/**< Length of Nonce (bytes) */
t_u8 nonce[14]; /**< Nonce */
t_u16 AAD_length; /**< Length of AAD (bytes) */
t_u8 AAD[32]; /**< AAD */
MrvlIEtypes_Data_t data; /**< Plain text if encdec=Encrypt, Ciphertext data if encdec=Decrypt*/
} __ATTRIB_PACK__ HostCmd_DS_802_11_CRYPTO_AES_CCM;
/** HostCmd_DS_802_11_CRYPTO_WAPI */
typedef struct MAPP_HostCmd_DS_802_11_CRYPTO_WAPI {
t_u16 encdec; /**< Decrypt=0, Encrypt=1 */
t_u16 algorithm; /**< WAPI =5 */
t_u16 key_length; /**< Length of Key (bytes) */
t_u8 key[32]; /**< Key */
t_u16 nonce_length;/**< Length of Nonce (bytes) */
t_u8 nonce[16]; /**< Nonce */
t_u16 AAD_length; /**< Length of AAD (bytes) */
t_u8 AAD[48]; /**< AAD */
t_u16 data_length; /**< Length of data (bytes) */
} __ATTRIB_PACK__ HostCmd_DS_802_11_CRYPTO_WAPI;
/** WAPI cipher test */
#define CIPHER_TEST_WAPI (5)
/** AES CCM cipher test */
#define CIPHER_TEST_AES_CCM (4)
/** GCMP cipher test */
#define CIPHER_TEST_GCMP (6)
/** AutoTx_MacFrame_t */
typedef struct AutoTx_MacFrame {
t_u16 interval; /**< in seconds */
t_u8 priority; /**< User Priority: 0~7, ignored if non-WMM */
t_u8 reserved; /**< set to 0 */
t_u16 frame_len; /**< Length of MAC frame payload */
t_u8 dest_mac_addr[MLAN_MAC_ADDR_LENGTH]; /**< Destination MAC address */
t_u8 src_mac_addr[MLAN_MAC_ADDR_LENGTH]; /**< Source MAC address */
t_u8 payload[]; /**< Payload */
} __ATTRIB_PACK__ AutoTx_MacFrame_t;
/** MrvlIEtypes_AutoTx_t */
typedef struct MrvlIEtypes_AutoTx {
MrvlIEtypesHeader_t header; /**< Header */
AutoTx_MacFrame_t auto_tx_mac_frame; /**< Auto Tx MAC frame */
} __ATTRIB_PACK__ MrvlIEtypes_AutoTx_t;
/** HostCmd_DS_802_11_AUTO_TX */
typedef struct MAPP_HostCmd_DS_802_11_AUTO_TX {
/** Action */
t_u16 action; /* 0 = ACT_GET; 1 = ACT_SET; */
MrvlIEtypes_AutoTx_t auto_tx; /**< Auto Tx */
} __ATTRIB_PACK__ HostCmd_DS_802_11_AUTO_TX;
/** HostCmd_DS_802_11_SUBSCRIBE_EVENT */
typedef struct MAPP_HostCmd_DS_802_11_SUBSCRIBE_EVENT {
/** Action */
t_u16 action;
/** Events */
t_u16 events;
} __ATTRIB_PACK__ HostCmd_DS_802_11_SUBSCRIBE_EVENT;
/** MrvlIEtypes_RssiParamSet_t */
typedef struct MrvlIEtypes_RssiThreshold {
/** Header */
MrvlIEtypesHeader_t header;
/** RSSI value */
t_u8 RSSI_value;
/** RSSI frequency */
t_u8 RSSI_freq;
} __ATTRIB_PACK__ MrvlIEtypes_RssiThreshold_t;
/** MrvlIEtypes_SnrThreshold_t */
typedef struct MrvlIEtypes_SnrThreshold {
/** Header */
MrvlIEtypesHeader_t header;
/** SNR value */
t_u8 SNR_value;
/** SNR frequency */
t_u8 SNR_freq;
} __ATTRIB_PACK__ MrvlIEtypes_SnrThreshold_t;
/** MrvlIEtypes_FailureCount_t */
typedef struct MrvlIEtypes_FailureCount {
/** Header */
MrvlIEtypesHeader_t header;
/** Failure value */
t_u8 fail_value;
/** Failure frequency */
t_u8 fail_freq;
} __ATTRIB_PACK__ MrvlIEtypes_FailureCount_t;
/** MrvlIEtypes_BeaconsMissed_t */
typedef struct MrvlIEtypes_BeaconsMissed {
/** Header */
MrvlIEtypesHeader_t header;
/** Number of beacons missed */
t_u8 beacon_missed;
/** Reserved */
t_u8 reserved;
} __ATTRIB_PACK__ MrvlIEtypes_BeaconsMissed_t;
/** MrvlIEtypes_LinkQuality_t */
typedef struct MrvlIEtypes_LinkQuality {
/** Header */
MrvlIEtypesHeader_t header;
/** Link SNR threshold */
t_u16 link_SNR_thrs;
/** Link SNR frequency */
t_u16 link_SNR_freq;
/** Minimum rate value */
t_u16 min_rate_val;
/** Minimum rate frequency */
t_u16 min_rate_freq;
/** Tx latency value */
t_u32 tx_latency_val;
/** Tx latency threshold */
t_u32 tx_latency_thrs;
} __ATTRIB_PACK__ MrvlIEtypes_LinkQuality_t;
/** MrvlIEtypes_PreBeaconLost_t */
typedef struct MrvlIEtypes_PreBeaconLost {
/** Header */
MrvlIEtypesHeader_t header;
/** Pre-Beacon Lost */
t_u8 pre_beacon_lost;
/** Reserved */
t_u8 reserved;
} __ATTRIB_PACK__ MrvlIEtypes_PreBeaconLost_t;
/* String helper functions */
/** Convert char to hex integer */
int hexval(t_s32 chr);
/** Convert char to hex integer */
t_u8 hexc2bin(t_s8 chr);
/** Convert string to hex integer */
t_u32 a2hex(t_s8 *s);
/** Check the Hex String */
int ishexstring(t_s8 *s);
/** Convert String to integer */
t_u32 a2hex_or_atoi(t_s8 *value);
/** Convert String to Integer */
int atoval(t_s8 *buf);
/** Hump hex data */
void hexdump(t_s8 *prompt, void *p, t_s32 len, t_s8 delim);
/** Convert String to Hex */
t_s8 *convert2hex(t_s8 *ptr, t_u8 *chr);
int process_host_cmd_resp(t_u8 *buf);
int prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf);
int prepare_cfg_data_buffer(int argc, char *argv[], FILE * fp, t_u8 *buf);
int prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf);
#endif /* _MLANHOSTCMD_H_ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,710 @@
/** @file mlanmisc.h
*
* @brief This file contains command definitions for application
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
03/10/2009: initial version
************************************************************************/
#ifndef _MLANMISC_H_
#define _MLANMISC_H_
/** Maximum size of IEEE Information Elements */
#define IEEE_MAX_IE_SIZE 256
/** Maximum scan response buffer size */
#define SCAN_RESP_BUF_SIZE 2000
#ifdef FALSE
#undef FALSE
#endif
#ifdef TRUE
#undef TRUE
#endif
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
#ifndef MAX
/** Find maximum value */
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif /* MAX */
/** Type enumeration of WMM AC_QUEUES */
typedef enum _mlan_wmm_ac_e {
WMM_AC_BK,
WMM_AC_BE,
WMM_AC_VI,
WMM_AC_VO
} __ATTRIB_PACK__ mlan_wmm_ac_e;
/** Maximum length of SSID */
#define MRVDRV_MAX_SSID_LENGTH 32
/** Enumeration for scan mode */
enum {
MLAN_SCAN_MODE_UNCHANGED = 0,
MLAN_SCAN_MODE_BSS,
MLAN_SCAN_MODE_IBSS,
MLAN_SCAN_MODE_ANY
};
/** Enumeration for scan type */
enum {
MLAN_SCAN_TYPE_UNCHANGED = 0,
MLAN_SCAN_TYPE_ACTIVE,
MLAN_SCAN_TYPE_PASSIVE
};
/** Length of ethernet address */
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
/** Maximum length of SSID list */
#define MRVDRV_MAX_SSID_LIST_LENGTH 10
/** Maximum number of channels that can be sent in a setuserscan ioctl */
#define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
/** IEEE Type definitions */
typedef enum _IEEEtypes_ElementId_e {
SSID = 0,
SUPPORTED_RATES = 1,
FH_PARAM_SET = 2,
DS_PARAM_SET = 3,
CF_PARAM_SET = 4,
IBSS_PARAM_SET = 6,
COUNTRY_INFO = 7,
POWER_CONSTRAINT = 32,
POWER_CAPABILITY = 33,
TPC_REQUEST = 34,
TPC_REPORT = 35,
SUPPORTED_CHANNELS = 36,
CHANNEL_SWITCH_ANN = 37,
QUIET = 40,
IBSS_DFS = 41,
HT_CAPABILITY = 45,
HT_OPERATION = 61,
BSSCO_2040 = 72,
OVERLAPBSSSCANPARAM = 74,
EXT_CAPABILITY = 127,
VHT_CAPABILITY = 191,
VHT_OPERATION = 192,
EXT_BSS_LOAD = 193,
BW_CHANNEL_SWITCH = 194,
VHT_TX_POWER_ENV = 195,
EXT_POWER_CONSTR = 196,
AID_INFO = 197,
QUIET_CHAN = 198,
ERP_INFO = 42,
EXTENDED_SUPPORTED_RATES = 50,
VENDOR_SPECIFIC_221 = 221,
WMM_IE = VENDOR_SPECIFIC_221,
WPS_IE = VENDOR_SPECIFIC_221,
WPA_IE = VENDOR_SPECIFIC_221,
RSN_IE = 48,
} __ATTRIB_PACK__ IEEEtypes_ElementId_e;
/** Capability Bit Map*/
#ifdef BIG_ENDIAN_SUPPORT
typedef struct _IEEEtypes_CapInfo_t {
t_u8 rsrvd1:2;
t_u8 dsss_ofdm:1;
t_u8 rsvrd2:2;
t_u8 short_slot_time:1;
t_u8 rsrvd3:1;
t_u8 spectrum_mgmt:1;
t_u8 chan_agility:1;
t_u8 pbcc:1;
t_u8 short_preamble:1;
t_u8 privacy:1;
t_u8 cf_poll_rqst:1;
t_u8 cf_pollable:1;
t_u8 ibss:1;
t_u8 ess:1;
} __ATTRIB_PACK__ IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t;
#else
typedef struct _IEEEtypes_CapInfo_t {
/** Capability Bit Map : ESS */
t_u8 ess:1;
/** Capability Bit Map : IBSS */
t_u8 ibss:1;
/** Capability Bit Map : CF pollable */
t_u8 cf_pollable:1;
/** Capability Bit Map : CF poll request */
t_u8 cf_poll_rqst:1;
/** Capability Bit Map : privacy */
t_u8 privacy:1;
/** Capability Bit Map : Short preamble */
t_u8 short_preamble:1;
/** Capability Bit Map : PBCC */
t_u8 pbcc:1;
/** Capability Bit Map : Channel agility */
t_u8 chan_agility:1;
/** Capability Bit Map : Spectrum management */
t_u8 spectrum_mgmt:1;
/** Capability Bit Map : Reserved */
t_u8 rsrvd3:1;
/** Capability Bit Map : Short slot time */
t_u8 short_slot_time:1;
/** Capability Bit Map : APSD */
t_u8 apsd:1;
/** Capability Bit Map : Reserved */
t_u8 rsvrd2:1;
/** Capability Bit Map : DSS OFDM */
t_u8 dsss_ofdm:1;
/** Capability Bit Map : Reserved */
t_u8 rsrvd1:2;
} __ATTRIB_PACK__ IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t;
#endif /* BIG_ENDIAN_SUPPORT */
/** IEEE IE header */
typedef struct _IEEEtypes_Header_t {
/** Element ID */
t_u8 element_id;
/** Length */
t_u8 len;
} __ATTRIB_PACK__ IEEEtypes_Header_t, *pIEEEtypes_Header_t;
/** IEEE IE header */
#define IEEE_HEADER_LEN sizeof(IEEEtypes_Header_t)
/** Vendor specific IE header */
typedef struct _IEEEtypes_VendorHeader_t {
/** Element ID */
t_u8 element_id;
/** Length */
t_u8 len;
/** OUI */
t_u8 oui[3];
/** OUI type */
t_u8 oui_type;
/** OUI subtype */
t_u8 oui_subtype;
/** Version */
t_u8 version;
} __ATTRIB_PACK__ IEEEtypes_VendorHeader_t, *pIEEEtypes_VendorHeader_t;
/** Vendor specific IE */
typedef struct _IEEEtypes_VendorSpecific_t {
/** Vendor specific IE header */
IEEEtypes_VendorHeader_t vend_hdr;
/** IE Max - size of previous fields */
t_u8 data[IEEE_MAX_IE_SIZE - sizeof(IEEEtypes_VendorHeader_t)];
} __ATTRIB_PACK__ IEEEtypes_VendorSpecific_t, *pIEEEtypes_VendorSpecific_t;
/** IEEE IE */
typedef struct _IEEEtypes_Generic_t {
/** Generic IE header */
IEEEtypes_Header_t ieee_hdr;
/** IE Max - size of previous fields */
t_u8 data[IEEE_MAX_IE_SIZE - sizeof(IEEEtypes_Header_t)];
} __ATTRIB_PACK__ IEEEtypes_Generic_t, *pIEEEtypes_Generic_t;
/** Size of a TSPEC. Used to allocate necessary buffer space in commands */
#define WMM_TSPEC_SIZE 63
/** Maximum number of AC QOS queues available in the driver/firmware */
#define MAX_AC_QUEUES 4
/** Maximum number of User Priorities */
#define MAX_USER_PRIORITIES 8
/** Extra IE bytes allocated in messages for appended IEs after a TSPEC */
#define WMM_ADDTS_EXTRA_IE_BYTES 256
/**
* @brief Enumeration for the command result from an ADDTS or DELTS command
*/
typedef enum {
TSPEC_RESULT_SUCCESS = 0,
TSPEC_RESULT_EXEC_FAILURE = 1,
TSPEC_RESULT_TIMEOUT = 2,
TSPEC_RESULT_DATA_INVALID = 3,
} __ATTRIB_PACK__ mlan_wmm_tspec_result_e;
/**
* @brief Enumeration for the action field in the Queue configure command
*/
typedef enum {
WMM_QUEUE_CONFIG_ACTION_GET = 0,
WMM_QUEUE_CONFIG_ACTION_SET = 1,
WMM_QUEUE_CONFIG_ACTION_DEFAULT = 2,
WMM_QUEUE_CONFIG_ACTION_MAX
} __ATTRIB_PACK__ mlan_wmm_queue_config_action_e;
/**
* @brief Enumeration for the action field in the queue stats command
*/
typedef enum {
WMM_STATS_ACTION_START = 0,
WMM_STATS_ACTION_STOP = 1,
WMM_STATS_ACTION_GET_CLR = 2,
WMM_STATS_ACTION_SET_CFG = 3, /* Not currently used */
WMM_STATS_ACTION_GET_CFG = 4, /* Not currently used */
WMM_STATS_ACTION_MAX
} __ATTRIB_PACK__ mlan_wmm_stats_action_e;
/** Data structure of WMM QoS information */
typedef struct _IEEEtypes_WmmQosInfo_t {
#ifdef BIG_ENDIAN_SUPPORT
/** QoS UAPSD */
t_u8 qos_uapsd:1;
/** Reserved */
t_u8 reserved:3;
/** Parameter set count */
t_u8 para_set_count:4;
#else
/** Parameter set count */
t_u8 para_set_count:4;
/** Reserved */
t_u8 reserved:3;
/** QoS UAPSD */
t_u8 qos_uapsd:1;
#endif
} __ATTRIB_PACK__ IEEEtypes_WmmQosInfo_t, *pIEEEtypes_WmmQosInfo_t;
/** Data structure of WMM Aci/Aifsn */
typedef struct _IEEEtypes_WmmAciAifsn_t {
#ifdef BIG_ENDIAN_SUPPORT
/** Reserved */
t_u8 reserved:1;
/** Aci */
t_u8 aci:2;
/** Acm */
t_u8 acm:1;
/** Aifsn */
t_u8 aifsn:4;
#else
/** Aifsn */
t_u8 aifsn:4;
/** Acm */
t_u8 acm:1;
/** Aci */
t_u8 aci:2;
/** Reserved */
t_u8 reserved:1;
#endif
} __ATTRIB_PACK__ IEEEtypes_WmmAciAifsn_t, *pIEEEtypes_WmmAciAifsn_t;
/** Data structure of WMM ECW */
typedef struct _IEEEtypes_WmmEcw_t {
#ifdef BIG_ENDIAN_SUPPORT
/** Maximum Ecw */
t_u8 ecw_max:4;
/** Minimum Ecw */
t_u8 ecw_min:4;
#else
/** Minimum Ecw */
t_u8 ecw_min:4;
/** Maximum Ecw */
t_u8 ecw_max:4;
#endif
} __ATTRIB_PACK__ IEEEtypes_WmmEcw_t, *pIEEEtypes_WmmEcw_t;
/** Data structure of WMM AC parameters */
typedef struct _IEEEtypes_WmmAcParameters_t {
IEEEtypes_WmmAciAifsn_t aci_aifsn; /**< AciAifSn */
IEEEtypes_WmmEcw_t ecw; /**< Ecw */
t_u16 tx_op_limit; /**< Tx op limit */
} __ATTRIB_PACK__ IEEEtypes_WmmAcParameters_t, *pIEEEtypes_WmmAcParameters_t;
/** Data structure of WMM Info IE */
typedef struct _IEEEtypes_WmmInfo_t {
/**
* WMM Info IE - Vendor Specific Header:
* element_id [221/0xdd]
* Len [7]
* Oui [00:50:f2]
* OuiType [2]
* OuiSubType [0]
* Version [1]
*/
IEEEtypes_VendorHeader_t vend_hdr;
/** QoS information */
IEEEtypes_WmmQosInfo_t qos_info;
} __ATTRIB_PACK__ IEEEtypes_WmmInfo_t, *pIEEEtypes_WmmInfo_t;
/** Data structure of WMM parameter IE */
typedef struct _IEEEtypes_WmmParameter_t {
/**
* WMM Parameter IE - Vendor Specific Header:
* element_id [221/0xdd]
* Len [24]
* Oui [00:50:f2]
* OuiType [2]
* OuiSubType [1]
* Version [1]
*/
IEEEtypes_VendorHeader_t vend_hdr;
/** QoS information */
IEEEtypes_WmmQosInfo_t qos_info;
/** Reserved */
t_u8 reserved;
/** AC Parameters Record WMM_AC_BE, WMM_AC_BK, WMM_AC_VI, WMM_AC_VO */
IEEEtypes_WmmAcParameters_t ac_params[MAX_AC_QUEUES];
} __ATTRIB_PACK__ IEEEtypes_WmmParameter_t, *pIEEEtypes_WmmParameter_t;
/**
* @brief IOCTL structure to send an ADDTS request and retrieve the response.
*
* IOCTL structure from the application layer relayed to firmware to
* instigate an ADDTS management frame with an appropriate TSPEC IE as well
* as any additional IEs appended in the ADDTS Action frame.
*
* @sa wlan_wmm_addts_req_ioctl
*/
typedef struct {
mlan_wmm_tspec_result_e commandResult;
/**< Firmware execution result */
t_u32 timeout_ms; /**< Timeout value in milliseconds */
t_u8 ieeeStatusCode; /**< IEEE status code */
t_u32 ieDataLen;
t_u8 ieData[WMM_TSPEC_SIZE
/**< TSPEC to send in the ADDTS */
+ WMM_ADDTS_EXTRA_IE_BYTES];
/**< ADDTS extra IE buf */
} wlan_ioctl_wmm_addts_req_t;
/**
* @brief IOCTL structure to send a DELTS request.
*
* IOCTL structure from the application layer relayed to firmware to
* instigate an DELTS management frame with an appropriate TSPEC IE.
*
* @sa wlan_wmm_delts_req_ioctl
*/
typedef struct {
mlan_wmm_tspec_result_e commandResult;
/**< Firmware execution result */
t_u8 ieeeReasonCode; /**< IEEE reason code sent, unused for WMM */
t_u32 ieDataLen;
t_u8 ieData[WMM_TSPEC_SIZE];
/**< TSPEC to send in the DELTS */
} wlan_ioctl_wmm_delts_req_t;
/**
* @brief IOCTL structure to configure a specific AC Queue's parameters
*
* IOCTL structure from the application layer relayed to firmware to
* get, set, or default the WMM AC queue parameters.
*
* - msduLifetimeExpiry is ignored if set to 0 on a set command
*
* @sa wlan_wmm_queue_config_ioctl
*/
typedef struct {
mlan_wmm_queue_config_action_e action;
/**< Set, Get, or Default */
mlan_wmm_ac_e accessCategory; /**< WMM_AC_BK(0) to WMM_AC_VO(3) */
t_u16 msduLifetimeExpiry; /**< lifetime expiry in TUs */
t_u8 supportedRates[10]; /**< Not supported yet */
} wlan_ioctl_wmm_queue_config_t;
/** Number of bins in the histogram for the HostCmd_DS_WMM_QUEUE_STATS */
#define WMM_STATS_PKTS_HIST_BINS 7
/**
* @brief IOCTL structure to start, stop, and get statistics for a WMM AC
*
* IOCTL structure from the application layer relayed to firmware to
* start or stop statistical collection for a given AC. Also used to
* retrieve and clear the collected stats on a given AC.
*
* @sa wlan_wmm_queue_stats_ioctl
*/
typedef struct {
mlan_wmm_stats_action_e action;
/**< Start, Stop, or Get */
t_u8 userPriority;
/**< User Priority (0 to 7) */
t_u16 pktCount; /**< Number of successful packets transmitted */
t_u16 pktLoss; /**< Packets lost; not included in pktCount */
t_u32 avgQueueDelay;
/**< Average Queue delay in microseconds */
t_u32 avgTxDelay;/**< Average Transmission delay in microseconds */
t_u16 usedTime; /**< Calculated used time - units of 32 microsec */
t_u16 policedTime;
/**< Calculated policed time - units of 32 microsec */
/** @brief Queue Delay Histogram; number of packets per queue delay range
*
* [0] - 0ms <= delay < 5ms
* [1] - 5ms <= delay < 10ms
* [2] - 10ms <= delay < 20ms
* [3] - 20ms <= delay < 30ms
* [4] - 30ms <= delay < 40ms
* [5] - 40ms <= delay < 50ms
* [6] - 50ms <= delay < msduLifetime (TUs)
*/
t_u16 delayHistogram[WMM_STATS_PKTS_HIST_BINS];
} wlan_ioctl_wmm_queue_stats_t;
/**
* @brief IOCTL and command sub structure for a Traffic stream status.
*/
typedef struct {
t_u8 tid; /**< TSID: Range: 0->7 */
t_u8 valid; /**< TSID specified is valid */
t_u8 accessCategory;/**< AC TSID is active on */
t_u8 userPriority; /**< UP specified for the TSID */
t_u8 psb; /**< Power save mode for TSID: 0 (legacy), 1 (UAPSD) */
t_u8 flowDir; /**< Upstream (0), Downlink(1), Bidirectional(3) */
t_u16 mediumTime; /**< Medium time granted for the TSID */
} __ATTRIB_PACK__ HostCmd_DS_WMM_TS_STATUS,
wlan_ioctl_wmm_ts_status_t, wlan_cmd_wmm_ts_status_t;
/**
* @brief IOCTL sub structure for a specific WMM AC Status
*/
typedef struct {
/** WMM Acm */
t_u8 wmmAcm;
/** Flow required flag */
t_u8 flowRequired;
/** Flow created flag */
t_u8 flowCreated;
/** Disabled flag */
t_u8 disabled;
/** delivery enabled */
t_u8 deliveryEnabled;
/** trigger enabled */
t_u8 triggerEnabled;
} wlan_ioctl_wmm_queue_status_ac_t;
/**
* @brief IOCTL structure to retrieve the WMM AC Queue status
*
* IOCTL structure from the application layer to retrieve:
* - ACM bit setting for the AC
* - Firmware status (flow required, flow created, flow disabled)
*
* @sa wlan_wmm_queue_status_ioctl
*/
typedef struct {
/** WMM AC queue status */
wlan_ioctl_wmm_queue_status_ac_t acStatus[MAX_AC_QUEUES];
} wlan_ioctl_wmm_queue_status_t;
typedef struct _wlan_get_scan_table_fixed {
/** BSSID of this network */
t_u8 bssid[MLAN_MAC_ADDR_LENGTH];
/** Channel this beacon/probe response was detected */
t_u8 channel;
/** RSSI for the received packet */
t_u8 rssi;
/** TSF value from the firmware at packet reception */
t_u64 network_tsf;
} wlan_get_scan_table_fixed;
/**
* Structure passed in the wlan_ioctl_get_scan_table_info for each
* BSS returned in the WLAN_GET_SCAN_RESP IOCTL
*/
typedef struct _wlan_ioctl_get_scan_table_entry {
/**
* Fixed field length included in the response.
*
* Length value is included so future fixed fields can be added to the
* response without breaking backwards compatibility. Use the length
* to find the offset for the bssInfoLength field, not a sizeof() calc.
*/
t_u32 fixed_field_length;
/**
* Length of the BSS Information (probe resp or beacon) that
* follows after the fixed_field_length
*/
t_u32 bss_info_length;
/**
* Always present, fixed length data fields for the BSS
*/
wlan_get_scan_table_fixed fixed_fields;
/*
* Probe response or beacon scanned for the BSS.
*
* Field layout:
* - TSF 8 octets
* - Beacon Interval 2 octets
* - Capability Info 2 octets
*
* - IEEE Infomation Elements; variable number & length per 802.11 spec
*/
/* t_u8 bss_info_buffer[1]; */
} wlan_ioctl_get_scan_table_entry;
/**
* Structure to store BSS info (probe resp or beacon) & IEEE IE info for each
* BSS returned in WLAN_GET_SCAN_RESP IOCTL
*/
typedef struct _wlan_ioctl_get_bss_info {
/**
* Length of the BSS Information (probe resp or beacon) that
* follows after the fixed_field
*/
t_u32 bss_info_length;
/**
* Probe response or beacon scanned for the BSS.
*
* Field layout:
*/
/** TSF 8 octets */
t_u8 tsf[8];
/** Beacon Interval 2 octets */
t_u16 beacon_interval;
/** Capability Info 2 octets */
IEEEtypes_CapInfo_t cap_info;
/**
* IEEE Infomation Elements; variable number & length per 802.11 spec
*/
/** SSID */
char ssid[MRVDRV_MAX_SSID_LENGTH + 1];
/** SSID Length */
t_u32 ssid_len;
/** WMM Capability */
char wmm_cap;
/** WPS Capability */
char wps_cap;
/** Privacy Capability - WEP/WPA/RSN */
char priv_cap;
/** HT (11N) Capability */
char ht_cap;
/** VHT (11AC) Capability */
char vht_cap[2];
/* 802.11k Capability */
char dot11k_cap;
/** 802.11r Capability */
char dot11r_cap;
} wlan_ioctl_get_bss_info;
/**
* Structure to save of scan table info for each BSS returned
* in WLAN_GET_SCAN_RESP IOCTL
*/
struct wlan_ioctl_get_scan_list {
/** fixed info */
wlan_ioctl_get_scan_table_entry fixed_buf;
/** variable info - BSS info (probe resp or beacon) & IEEE IE info */
wlan_ioctl_get_bss_info bss_info_buf;
/** pointer to next node in list */
struct wlan_ioctl_get_scan_list *next;
};
/**
* Sructure to retrieve the scan table
*/
typedef struct {
/**
* - Zero based scan entry to start retrieval in command request
* - Number of scans entries returned in command response
*/
t_u32 scan_number;
/**
* Buffer marker for multiple wlan_ioctl_get_scan_table_entry structures.
* Each struct is padded to the nearest 32 bit boundary.
*/
t_u8 scan_table_entry_buf[1];
} wlan_ioctl_get_scan_table_info;
typedef struct {
t_u8 chan_number;
/**< Channel Number to scan */
t_u8 radio_type;
/**< Radio type: 'B/G' Band = 0, 'A' Band = 1 */
t_u8 scan_type;/**< Scan type: Active = 1, Passive = 2 */
t_u8 reserved;/**< Reserved */
t_u32 scan_time;
/**< Scan duration in milliseconds; if 0 default used */
} __ATTRIB_PACK__ wlan_ioctl_user_scan_chan;
typedef struct {
char ssid[MRVDRV_MAX_SSID_LENGTH + 1];
/**< SSID */
t_u8 max_len; /**< Maximum length of SSID */
} __ATTRIB_PACK__ wlan_ioctl_user_scan_ssid;
typedef struct {
/** Flag set to keep the previous scan table intact */
t_u8 keep_previous_scan; /* Do not erase the existing scan results */
/** BSS mode to be sent in the firmware command */
t_u8 bss_mode;
/** Configure the number of probe requests for active chan scans */
t_u8 num_probes;
/** Reserved */
t_u8 reserved;
/** BSSID filter sent in the firmware command to limit the results */
t_u8 specific_bssid[ETH_ALEN];
/** SSID filter list used in the to limit the scan results */
wlan_ioctl_user_scan_ssid ssid_list[MRVDRV_MAX_SSID_LIST_LENGTH];
/** Variable number (fixed maximum) of channels to scan up */
wlan_ioctl_user_scan_chan chan_list[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
} __ATTRIB_PACK__ wlan_ioctl_user_scan_cfg;
#ifdef SDIO
int process_sdcmd52rw(int argc, char *argv[]);
int process_sdcmd53rw(int argc, char *argv[]);
#endif
int process_setuserscan(int argc, char *argv[]);
int process_getscantable(int argc, char *argv[]);
int process_getscantable_idx(wlan_ioctl_get_scan_table_info *prsp_info_req);
#endif /* _MLANMISC_H_ */

View file

@ -0,0 +1,52 @@
# File : mlanevent/Makefile
#
# Copyright 2014-2020 NXP
# Path to the top directory of the wlan distribution
PATH_TO_TOP = ../..
# Determine how we should copy things to the install directory
ABSPATH := $(filter /%, $(INSTALLDIR))
RELPATH := $(filter-out /%, $(INSTALLDIR))
INSTALLPATH := $(ABSPATH)
ifeq ($(strip $(INSTALLPATH)),)
INSTALLPATH := $(PATH_TO_TOP)/$(RELPATH)
endif
# Override CFLAGS for application sources, remove __ kernel namespace defines
CFLAGS := $(filter-out -D__%, $(ccflags-y))
# remove KERNEL include dir
CFLAGS := $(filter-out -I$(KERNELDIR)%, $(CFLAGS))
#CFLAGS += -DAP22 -fshort-enums
CFLAGS += -Wall
#ECHO = @
LIBS = -lrt
.PHONY: default tags all
OBJECTS = mlanevent.o
HEADERS = mlanevent.h
TARGET = mlanevent.exe
build default: $(TARGET)
@cp -f $(TARGET) $(INSTALLPATH)
all : tags default
$(TARGET): $(OBJECTS) $(HEADERS)
$(ECHO)$(CC) $(LIBS) -o $@ $(OBJECTS)
%.o: %.c $(HEADERS)
$(ECHO)$(CC) $(CFLAGS) -c -o $@ $<
tags:
ctags -R -f tags.txt
distclean clean:
$(ECHO)$(RM) $(OBJECTS) $(TARGET)
$(ECHO)$(RM) tags.txt

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,55 @@
# File : mlanutl/Makefile
#
# Copyright 2014-2020 NXP
# Path to the top directory of the wlan distribution
PATH_TO_TOP = ../..
# Determine how we should copy things to the install directory
ABSPATH := $(filter /%, $(INSTALLDIR))
RELPATH := $(filter-out /%, $(INSTALLDIR))
INSTALLPATH := $(ABSPATH)
ifeq ($(strip $(INSTALLPATH)),)
INSTALLPATH := $(PATH_TO_TOP)/$(RELPATH)
endif
# Override CFLAGS for application sources, remove __ kernel namespace defines
CFLAGS := $(filter-out -D__%, $(ccflags-y))
# remove KERNEL include dir
CFLAGS := $(filter-out -I$(KERNELDIR)%, $(CFLAGS))
#CFLAGS += -DAP22 -fshort-enums
CFLAGS += -Wall
#ECHO = @
LIBS = -lrt
.PHONY: default tags all
OBJECTS = mlanutl.o
HEADERS = mlanutl.h
exectarget=mlanutl
TARGET := $(exectarget)
build default: $(TARGET)
@cp -f $(TARGET) $(INSTALLPATH)
all : tags default
$(TARGET): $(OBJECTS) $(HEADERS)
$(ECHO)$(CC) $(LIBS) -o $@ $(OBJECTS)
%.o: %.c $(HEADERS)
$(ECHO)$(CC) $(CFLAGS) -c -o $@ $<
tags:
ctags -R -f tags.txt
distclean clean:
$(ECHO)$(RM) $(OBJECTS) $(TARGET)
$(ECHO)$(RM) tags.txt

View file

@ -0,0 +1,900 @@
/** @file mlanhostcmd.c
*
* @brief This file contains mlanutl helper functions
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
11/26/2008: initial version
************************************************************************/
#include "mlanhostcmd.h"
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief get hostcmd data
*
* @param ln A pointer to line number
* @param buf A pointer to hostcmd data
* @param size A pointer to the return size of hostcmd buffer
* @return MLAN_STATUS_SUCCESS
*/
static int
mlan_get_hostcmd_data(FILE * fp, int *ln, t_u8 *buf, t_u16 *size)
{
t_s32 errors = 0, i;
t_s8 line[512], *pos, *pos1, *pos2, *pos3;
t_u16 len;
while ((pos = mlan_config_get_line(fp, line, sizeof(line), ln))) {
(*ln)++;
if (strcmp(pos, "}") == 0) {
break;
}
pos1 = strchr(pos, ':');
if (pos1 == NULL) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos1++ = '\0';
pos2 = strchr(pos1, '=');
if (pos2 == NULL) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos2++ = '\0';
len = a2hex_or_atoi(pos1);
if (len < 1 || len > MRVDRV_SIZE_OF_CMD_BUFFER) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*size += len;
if (*pos2 == '"') {
pos2++;
pos3 = strchr(pos2, '"');
if (pos3 == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = '\0';
memset(buf, 0, len);
memmove(buf, pos2, MIN(strlen(pos2), len));
buf += len;
} else if (*pos2 == '\'') {
pos2++;
pos3 = strchr(pos2, '\'');
if (pos3 == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = ',';
for (i = 0; i < len; i++) {
pos3 = strchr(pos2, ',');
if (pos3 != NULL) {
*pos3 = '\0';
*buf++ = (t_u8)a2hex_or_atoi(pos2);
pos2 = pos3 + 1;
} else
*buf++ = 0;
}
} else if (*pos2 == '{') {
t_u16 tlvlen = 0, tmp_tlvlen;
mlan_get_hostcmd_data(fp, ln, buf + len, &tlvlen);
tmp_tlvlen = tlvlen;
while (len--) {
*buf++ = (t_u8)(tmp_tlvlen & 0xff);
tmp_tlvlen >>= 8;
}
*size += tlvlen;
buf += tlvlen;
} else {
t_u32 value = a2hex_or_atoi(pos2);
while (len--) {
*buf++ = (t_u8)(value & 0xff);
value >>= 8;
}
}
}
return MLAN_STATUS_SUCCESS;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief convert char to hex integer
*
* @param chr char to convert
* @return hex integer or 0
*/
int
hexval(t_s32 chr)
{
if (chr >= '0' && chr <= '9')
return chr - '0';
if (chr >= 'A' && chr <= 'F')
return chr - 'A' + 10;
if (chr >= 'a' && chr <= 'f')
return chr - 'a' + 10;
return 0;
}
/**
* @brief Hump hex data
*
* @param prompt A pointer prompt buffer
* @param p A pointer to data buffer
* @param len the len of data buffer
* @param delim delim char
* @return hex integer
*/
t_void
hexdump(t_s8 *prompt, t_void *p, t_s32 len, t_s8 delim)
{
t_s32 i;
t_u8 *s = p;
if (prompt) {
printf("%s: len=%d\n", prompt, (int)len);
}
for (i = 0; i < len; i++) {
if (i != len - 1)
printf("%02x%c", *s++, delim);
else
printf("%02x\n", *s);
if ((i + 1) % 16 == 0)
printf("\n");
}
printf("\n");
}
/**
* @brief convert char to hex integer
*
* @param chr char
* @return hex integer
*/
t_u8
hexc2bin(t_s8 chr)
{
if (chr >= '0' && chr <= '9')
chr -= '0';
else if (chr >= 'A' && chr <= 'F')
chr -= ('A' - 10);
else if (chr >= 'a' && chr <= 'f')
chr -= ('a' - 10);
return chr;
}
/**
* @brief convert string to hex integer
*
* @param s A pointer string buffer
* @return hex integer
*/
t_u32
a2hex(t_s8 *s)
{
t_u32 val = 0;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s && isxdigit(*s)) {
val = (val << 4) + hexc2bin(*s++);
}
return val;
}
/*
* @brief convert String to integer
*
* @param value A pointer to string
* @return integer
*/
t_u32
a2hex_or_atoi(t_s8 *value)
{
if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) {
return a2hex(value + 2);
} else if (isdigit(*value)) {
return atoi(value);
} else {
return *value;
}
}
/**
* @brief convert string to hex
*
* @param ptr A pointer to data buffer
* @param chr A pointer to return integer
* @return A pointer to next data field
*/
t_s8 *
convert2hex(t_s8 *ptr, t_u8 *chr)
{
t_u8 val;
for (val = 0; *ptr && isxdigit(*ptr); ptr++) {
val = (val * 16) + hexval(*ptr);
}
*chr = val;
return ptr;
}
/**
* @brief Check the Hex String
* @param s A pointer to the string
* @return MLAN_STATUS_SUCCESS --HexString, MLAN_STATUS_FAILURE --not HexString
*/
int
ishexstring(t_s8 *s)
{
int ret = MLAN_STATUS_FAILURE;
t_s32 tmp;
if (!strncasecmp("0x", s, 2)) {
s += 2;
}
while (*s) {
tmp = toupper(*s);
if (((tmp >= 'A') && (tmp <= 'F')) ||
((tmp >= '0') && (tmp <= '9'))) {
ret = MLAN_STATUS_SUCCESS;
} else {
ret = MLAN_STATUS_FAILURE;
break;
}
s++;
}
return ret;
}
/**
* @brief Convert String to Integer
* @param buf A pointer to the string
* @return Integer
*/
int
atoval(t_s8 *buf)
{
if (!strncasecmp(buf, "0x", 2))
return a2hex(buf + 2);
else if (!ishexstring(buf))
return a2hex(buf);
else
return atoi(buf);
}
/**
* @brief Prepare host-command buffer
* @param fp File handler
* @param cmd_name Command name
* @param buf A pointer to comand buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf)
{
t_s8 line[256], cmdname[256], *pos, cmdcode[10];
HostCmd_DS_GEN *hostcmd;
int ln = 0;
int cmdname_found = 0, cmdcode_found = 0;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
hostcmd->command = 0xffff;
snprintf(cmdname, sizeof(cmdname), "%s={", cmd_name);
cmdname_found = 0;
while ((pos = mlan_config_get_line(fp, line, sizeof(line), &ln))) {
if (strcmp(pos, cmdname) == 0) {
t_u16 len = 0;
cmdname_found = 1;
snprintf(cmdcode, sizeof(cmdcode), "CmdCode=");
cmdcode_found = 0;
while ((pos =
mlan_config_get_line(fp, line, sizeof(line),
&ln))) {
if (strncmp(pos, cmdcode, strlen(cmdcode)) == 0) {
cmdcode_found = 1;
hostcmd->command =
a2hex_or_atoi(pos +
strlen(cmdcode));
hostcmd->size = S_DS_GEN;
mlan_get_hostcmd_data(fp, &ln,
buf +
hostcmd->size,
&len);
hostcmd->size += len;
break;
}
}
if (!cmdcode_found) {
fprintf(stderr,
"mlanutl: CmdCode not found in conf file\n");
return MLAN_STATUS_FAILURE;
}
break;
}
}
if (!cmdname_found) {
fprintf(stderr,
"mlanutl: cmdname '%s' is not found in conf file\n",
cmd_name);
return MLAN_STATUS_FAILURE;
}
hostcmd->seq_num = 0;
hostcmd->result = 0;
hostcmd->command = cpu_to_le16(hostcmd->command);
hostcmd->size = cpu_to_le16(hostcmd->size);
return MLAN_STATUS_SUCCESS;
}
/** Config data header length */
#define CFG_DATA_HEADER_LEN 6
/**
* @brief Prepare cfg-data buffer
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param fp File handler
* @param buf A pointer to comand buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_cfg_data_buffer(int argc, char *argv[], FILE * fp, t_u8 *buf)
{
int ln = 0, type;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_802_11_CFG_DATA *pcfg_data;
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (HostCmd_DS_GEN *)buf;
hostcmd->command = cpu_to_le16(HostCmd_CMD_CFG_DATA);
pcfg_data = (HostCmd_DS_802_11_CFG_DATA *)(buf + S_DS_GEN);
pcfg_data->action =
(argc == 4) ? HostCmd_ACT_GEN_GET : HostCmd_ACT_GEN_SET;
type = atoi(argv[3]);
if ((type < 1) || (type > 2)) {
fprintf(stderr, "mlanutl: Invalid register type\n");
return MLAN_STATUS_FAILURE;
} else {
pcfg_data->type = type;
}
if (argc == 5) {
ln = fparse_for_hex(fp, pcfg_data->data);
}
pcfg_data->data_len = ln;
hostcmd->size =
cpu_to_le16(pcfg_data->data_len + S_DS_GEN +
CFG_DATA_HEADER_LEN);
pcfg_data->data_len = cpu_to_le16(pcfg_data->data_len);
pcfg_data->type = cpu_to_le16(pcfg_data->type);
pcfg_data->action = cpu_to_le16(pcfg_data->action);
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}
/**
* @brief Process host_cmd response
* @param buf A pointer to the response buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_host_cmd_resp(t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd = (HostCmd_DS_GEN *)buf;
int ret = MLAN_STATUS_SUCCESS;
hostcmd->command = le16_to_cpu(hostcmd->command);
hostcmd->size = le16_to_cpu(hostcmd->size);
hostcmd->seq_num = le16_to_cpu(hostcmd->seq_num);
hostcmd->result = le16_to_cpu(hostcmd->result);
hostcmd->command &= ~HostCmd_RET_BIT;
if (!hostcmd->result) {
switch (hostcmd->command) {
case HostCmd_CMD_CFG_DATA:
{
HostCmd_DS_802_11_CFG_DATA *pstcfgData =
(HostCmd_DS_802_11_CFG_DATA *)(buf +
S_DS_GEN);
pstcfgData->data_len =
le16_to_cpu(pstcfgData->data_len);
pstcfgData->action =
le16_to_cpu(pstcfgData->action);
if (pstcfgData->action == HostCmd_ACT_GEN_GET) {
hexdump("cfgdata", pstcfgData->data,
pstcfgData->data_len, ' ');
}
break;
}
case HostCmd_CMD_802_11_TPC_ADAPT_REQ:
{
mlan_ioctl_11h_tpc_resp *tpcIoctlResp =
(mlan_ioctl_11h_tpc_resp *)(buf +
S_DS_GEN);
if (tpcIoctlResp->status_code == 0) {
printf("tpcrequest: txPower(%d), linkMargin(%d), rssi(%d)\n", tpcIoctlResp->tx_power, tpcIoctlResp->link_margin, tpcIoctlResp->rssi);
} else {
printf("tpcrequest: failure, status = %d\n", tpcIoctlResp->status_code);
}
break;
}
case HostCmd_CMD_802_11_CRYPTO:
{
t_u16 alg =
le16_to_cpu((t_u16)
*(buf + S_DS_GEN +
sizeof(t_u16)));
if (alg != CIPHER_TEST_AES_CCM &&
alg != CIPHER_TEST_GCMP) {
HostCmd_DS_802_11_CRYPTO *cmd =
(HostCmd_DS_802_11_CRYPTO *)(buf
+
S_DS_GEN);
cmd->encdec = le16_to_cpu(cmd->encdec);
cmd->algorithm =
le16_to_cpu(cmd->algorithm);
cmd->key_IV_length =
le16_to_cpu(cmd->key_IV_length);
cmd->key_length =
le16_to_cpu(cmd->key_length);
cmd->data.header.type =
le16_to_cpu(cmd->data.header.
type);
cmd->data.header.len =
le16_to_cpu(cmd->data.header.
len);
printf("crypto_result: encdec=%d algorithm=%d,KeyIVLen=%d," " KeyLen=%d,dataLen=%d\n", cmd->encdec, cmd->algorithm, cmd->key_IV_length, cmd->key_length, cmd->data.header.len);
hexdump("KeyIV", cmd->keyIV,
cmd->key_IV_length, ' ');
hexdump("Key", cmd->key,
cmd->key_length, ' ');
hexdump("Data", cmd->data.data,
cmd->data.header.len, ' ');
} else {
HostCmd_DS_802_11_CRYPTO_AES_CCM
*cmd_aes_ccm =
(HostCmd_DS_802_11_CRYPTO_AES_CCM
*)(buf + S_DS_GEN);
cmd_aes_ccm->encdec
=
le16_to_cpu(cmd_aes_ccm->
encdec);
cmd_aes_ccm->algorithm =
le16_to_cpu(cmd_aes_ccm->
algorithm);
cmd_aes_ccm->key_length =
le16_to_cpu(cmd_aes_ccm->
key_length);
cmd_aes_ccm->nonce_length =
le16_to_cpu(cmd_aes_ccm->
nonce_length);
cmd_aes_ccm->AAD_length =
le16_to_cpu(cmd_aes_ccm->
AAD_length);
cmd_aes_ccm->data.header.type =
le16_to_cpu(cmd_aes_ccm->data.
header.type);
cmd_aes_ccm->data.header.len =
le16_to_cpu(cmd_aes_ccm->data.
header.len);
printf("crypto_result: encdec=%d algorithm=%d, KeyLen=%d," " NonceLen=%d,AADLen=%d,dataLen=%d\n", cmd_aes_ccm->encdec, cmd_aes_ccm->algorithm, cmd_aes_ccm->key_length, cmd_aes_ccm->nonce_length, cmd_aes_ccm->AAD_length, cmd_aes_ccm->data.header.len);
hexdump("Key", cmd_aes_ccm->key,
cmd_aes_ccm->key_length, ' ');
hexdump("Nonce", cmd_aes_ccm->nonce,
cmd_aes_ccm->nonce_length, ' ');
hexdump("AAD", cmd_aes_ccm->AAD,
cmd_aes_ccm->AAD_length, ' ');
hexdump("Data", cmd_aes_ccm->data.data,
cmd_aes_ccm->data.header.len,
' ');
}
break;
}
case HostCmd_CMD_802_11_AUTO_TX:
{
HostCmd_DS_802_11_AUTO_TX *at =
(HostCmd_DS_802_11_AUTO_TX *)(buf +
S_DS_GEN);
if (le16_to_cpu(at->action) ==
HostCmd_ACT_GEN_GET) {
if (S_DS_GEN + sizeof(at->action) ==
hostcmd->size) {
printf("auto_tx not configured\n");
} else {
MrvlIEtypesHeader_t *header =
&at->auto_tx.header;
header->type =
le16_to_cpu(header->
type);
header->len =
le16_to_cpu(header->
len);
if ((S_DS_GEN +
sizeof(at->action)
+
sizeof(MrvlIEtypesHeader_t)
+ header->len ==
hostcmd->size) &&
(header->type ==
TLV_TYPE_AUTO_TX)) {
AutoTx_MacFrame_t *atmf
=
&at->auto_tx.
auto_tx_mac_frame;
printf("Interval: %d second(s)\n", le16_to_cpu(atmf->interval));
printf("Priority: %#x\n", atmf->priority);
printf("Frame Length: %d\n", le16_to_cpu(atmf->frame_len));
printf("Dest Mac Address: " "%02x:%02x:%02x:%02x:%02x:%02x\n", atmf->dest_mac_addr[0], atmf->dest_mac_addr[1], atmf->dest_mac_addr[2], atmf->dest_mac_addr[3], atmf->dest_mac_addr[4], atmf->dest_mac_addr[5]);
printf("Src Mac Address: " "%02x:%02x:%02x:%02x:%02x:%02x\n", atmf->src_mac_addr[0], atmf->src_mac_addr[1], atmf->src_mac_addr[2], atmf->src_mac_addr[3], atmf->src_mac_addr[4], atmf->src_mac_addr[5]);
hexdump("Frame Payload",
atmf->payload,
le16_to_cpu
(atmf->
frame_len)
-
MLAN_MAC_ADDR_LENGTH
* 2, ' ');
} else {
printf("incorrect auto_tx command response\n");
}
}
}
break;
}
case HostCmd_CMD_802_11_SUBSCRIBE_EVENT:
{
HostCmd_DS_802_11_SUBSCRIBE_EVENT *se =
(HostCmd_DS_802_11_SUBSCRIBE_EVENT
*)(buf + S_DS_GEN);
if (le16_to_cpu(se->action) ==
HostCmd_ACT_GEN_GET) {
int len =
S_DS_GEN +
sizeof
(HostCmd_DS_802_11_SUBSCRIBE_EVENT);
printf("\nEvent\t\tValue\tFreq\tsubscribed\n\n");
while (len < hostcmd->size) {
MrvlIEtypesHeader_t *header =
(MrvlIEtypesHeader_t
*)(buf + len);
switch (le16_to_cpu
(header->type)) {
case TLV_TYPE_RSSI_LOW:
{
MrvlIEtypes_RssiThreshold_t
*low_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Beacon Low RSSI\t%d\t%d\t%s\n", low_rssi->RSSI_value, low_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0001) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_LOW:
{
MrvlIEtypes_SnrThreshold_t
*low_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Beacon Low SNR\t%d\t%d\t%s\n", low_snr->SNR_value, low_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0002) ? "yes" : "no");
break;
}
case TLV_TYPE_FAILCOUNT:
{
MrvlIEtypes_FailureCount_t
*failure_count
=
(MrvlIEtypes_FailureCount_t
*)(buf
+
len);
printf("Failure Count\t%d\t%d\t%s\n", failure_count->fail_value, failure_count->fail_freq, (le16_to_cpu(se->events) & 0x0004) ? "yes" : "no");
break;
}
case TLV_TYPE_BCNMISS:
{
MrvlIEtypes_BeaconsMissed_t
*bcn_missed
=
(MrvlIEtypes_BeaconsMissed_t
*)(buf
+
len);
printf("Beacon Missed\t%d\tN/A\t%s\n", bcn_missed->beacon_missed, (le16_to_cpu(se->events) & 0x0008) ? "yes" : "no");
break;
}
case TLV_TYPE_RSSI_HIGH:
{
MrvlIEtypes_RssiThreshold_t
*high_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Bcn High RSSI\t%d\t%d\t%s\n", high_rssi->RSSI_value, high_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0010) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_HIGH:
{
MrvlIEtypes_SnrThreshold_t
*high_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Beacon High SNR\t%d\t%d\t%s\n", high_snr->SNR_value, high_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0020) ? "yes" : "no");
break;
}
case TLV_TYPE_RSSI_LOW_DATA:
{
MrvlIEtypes_RssiThreshold_t
*low_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Data Low RSSI\t%d\t%d\t%s\n", low_rssi->RSSI_value, low_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0040) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_LOW_DATA:
{
MrvlIEtypes_SnrThreshold_t
*low_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Data Low SNR\t%d\t%d\t%s\n", low_snr->SNR_value, low_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0080) ? "yes" : "no");
break;
}
case TLV_TYPE_RSSI_HIGH_DATA:
{
MrvlIEtypes_RssiThreshold_t
*high_rssi
=
(MrvlIEtypes_RssiThreshold_t
*)(buf
+
len);
printf("Data High RSSI\t%d\t%d\t%s\n", high_rssi->RSSI_value, high_rssi->RSSI_freq, (le16_to_cpu(se->events) & 0x0100) ? "yes" : "no");
break;
}
case TLV_TYPE_SNR_HIGH_DATA:
{
MrvlIEtypes_SnrThreshold_t
*high_snr
=
(MrvlIEtypes_SnrThreshold_t
*)(buf
+
len);
printf("Data High SNR\t%d\t%d\t%s\n", high_snr->SNR_value, high_snr->SNR_freq, (le16_to_cpu(se->events) & 0x0200) ? "yes" : "no");
break;
}
case TLV_TYPE_LINK_QUALITY:
{
MrvlIEtypes_LinkQuality_t
*link_qual
=
(MrvlIEtypes_LinkQuality_t
*)(buf
+
len);
printf("Link Quality Parameters:\n");
printf("------------------------\n");
printf("Link Quality Event Subscribed\t%s\n", (le16_to_cpu(se->events) & 0x0400) ? "yes" : "no");
printf("Link SNR Threshold = %d\n", le16_to_cpu(link_qual->link_SNR_thrs));
printf("Link SNR Frequency = %d\n", le16_to_cpu(link_qual->link_SNR_freq));
printf("Min Rate Value = %d\n", le16_to_cpu(link_qual->min_rate_val));
printf("Min Rate Frequency = %d\n", le16_to_cpu(link_qual->min_rate_freq));
printf("Tx Latency Value = %d\n", le32_to_cpu(link_qual->tx_latency_val));
printf("Tx Latency Threshold = %d\n", le32_to_cpu(link_qual->tx_latency_thrs));
break;
}
case TLV_TYPE_PRE_BEACON_LOST:
{
MrvlIEtypes_PreBeaconLost_t
*pre_bcn_lost
=
(MrvlIEtypes_PreBeaconLost_t
*)(buf
+
len);
printf("------------------------\n");
printf("Pre-Beacon Lost Event Subscribed\t%s\n", (le16_to_cpu(se->events) & 0x0800) ? "yes" : "no");
printf("Pre-Beacon Lost: %d\n", pre_bcn_lost->pre_beacon_lost);
break;
}
default:
printf("Unknown subscribed event TLV Type=%#x," " Len=%d\n", le16_to_cpu(header->type), le16_to_cpu(header->len));
break;
}
len += (sizeof
(MrvlIEtypesHeader_t)
+
le16_to_cpu(header->
len));
}
}
break;
}
case HostCmd_CMD_MAC_REG_ACCESS:
case HostCmd_CMD_BBP_REG_ACCESS:
case HostCmd_CMD_RF_REG_ACCESS:
case HostCmd_CMD_CAU_REG_ACCESS:
{
HostCmd_DS_REG *preg =
(HostCmd_DS_REG *)(buf + S_DS_GEN);
preg->action = le16_to_cpu(preg->action);
if (preg->action == HostCmd_ACT_GEN_GET) {
preg->value = le32_to_cpu(preg->value);
printf("value = 0x%08x\n", preg->value);
}
break;
}
case HostCmd_CMD_MEM_ACCESS:
{
HostCmd_DS_MEM *pmem =
(HostCmd_DS_MEM *)(buf + S_DS_GEN);
pmem->action = le16_to_cpu(pmem->action);
if (pmem->action == HostCmd_ACT_GEN_GET) {
pmem->value = le32_to_cpu(pmem->value);
printf("value = 0x%08x\n", pmem->value);
}
break;
}
default:
printf("HOSTCMD_RESP: CmdCode=%#04x, Size=%#04x,"
" SeqNum=%#04x, Result=%#04x\n",
hostcmd->command, hostcmd->size,
hostcmd->seq_num, hostcmd->result);
hexdump("payload",
(t_void *)(buf + S_DS_GEN),
hostcmd->size - S_DS_GEN, ' ');
break;
}
} else {
printf("HOSTCMD failed: CmdCode=%#04x, Size=%#04x,"
" SeqNum=%#04x, Result=%#04x\n",
hostcmd->command, hostcmd->size,
hostcmd->seq_num, hostcmd->result);
}
return ret;
}
/**
* @brief Prepare the hostcmd for register access
* @param type Register type
* @param offset Register offset
* @param value Pointer to value (NULL for read)
* @param buf Pointer to hostcmd buffer
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf)
{
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REG *preg;
hostcmd = (HostCmd_DS_GEN *)buf;
switch (type) {
case 1:
hostcmd->command = cpu_to_le16(HostCmd_CMD_MAC_REG_ACCESS);
break;
case 2:
hostcmd->command = cpu_to_le16(HostCmd_CMD_BBP_REG_ACCESS);
break;
case 3:
hostcmd->command = cpu_to_le16(HostCmd_CMD_RF_REG_ACCESS);
break;
case 5:
hostcmd->command = cpu_to_le16(HostCmd_CMD_CAU_REG_ACCESS);
break;
default:
printf("Invalid register set specified\n");
return -EINVAL;
}
preg = (HostCmd_DS_REG *)(buf + S_DS_GEN);
preg->action = (value) ? HostCmd_ACT_GEN_SET : HostCmd_ACT_GEN_GET;
preg->action = cpu_to_le16(preg->action);
preg->offset = cpu_to_le16((t_u16)offset);
if (value)
preg->value = cpu_to_le32(*value);
else
preg->value = 0;
hostcmd->size = cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_REG));
hostcmd->seq_num = 0;
hostcmd->result = 0;
return MLAN_STATUS_SUCCESS;
}

View file

@ -0,0 +1,139 @@
/** @file mlanhostcmd.h
*
* @brief This file contains command structures for mlanutl application
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
11/26/2008: initial version
************************************************************************/
#ifndef _MLANHOSTCMD_H_
#define _MLANHOSTCMD_H_
/** Find number of elements */
#define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
/** Size of command buffer */
#define MRVDRV_SIZE_OF_CMD_BUFFER (3 * 1024)
/** Host Command ID : Memory access */
#define HostCmd_CMD_MEM_ACCESS 0x0086
/** Pre-Authenticate - 11r only */
#define HostCmd_CMD_802_11_AUTHENTICATE 0x0011
/** Read/Write Mac register */
#define HostCmd_CMD_MAC_REG_ACCESS 0x0019
/** Read/Write BBP register */
#define HostCmd_CMD_BBP_REG_ACCESS 0x001a
/** Read/Write RF register */
#define HostCmd_CMD_RF_REG_ACCESS 0x001b
/** Get TX Power data */
#define HostCmd_CMD_802_11_RF_TX_POWER 0x001e
/** Host Command ID : CAU register access */
#define HostCmd_CMD_CAU_REG_ACCESS 0x00ed
/** Host Command ID : 802.11 BG scan configuration */
#define HostCmd_CMD_802_11_BG_SCAN_CONFIG 0x006b
/** Host Command ID : Configuration data */
#define HostCmd_CMD_CFG_DATA 0x008f
/** Host Command ID : 802.11 TPC adapt req */
#define HostCmd_CMD_802_11_TPC_ADAPT_REQ 0x0060
/** Host Command ID : 802.11 crypto */
#define HostCmd_CMD_802_11_CRYPTO 0x0078
/** Host Command ID : 802.11 auto Tx */
#define HostCmd_CMD_802_11_AUTO_TX 0x0082
/** Host Command ID : 802.11 subscribe event */
#define HostCmd_CMD_802_11_SUBSCRIBE_EVENT 0x0075
#ifdef OPCHAN
/** Host Command ID : Operating channel config */
#define HostCmd_CMD_OPCHAN_CONFIG 0x00f8
/** Host Command ID : Opchan channel group config */
#define HostCmd_CMD_OPCHAN_CHANGROUP_CONFIG 0x00f9
#endif
/** Host Command ID : Channel TRPC config */
#define HostCmd_CMD_CHAN_TRPC_CONFIG 0x00fb
/** TLV type ID definition */
#define PROPRIETARY_TLV_BASE_ID 0x0100
/** TLV type : Beacon RSSI low */
#define TLV_TYPE_RSSI_LOW (PROPRIETARY_TLV_BASE_ID + 0x04) /* 0x0104 */
/** TLV type : Beacon SNR low */
#define TLV_TYPE_SNR_LOW (PROPRIETARY_TLV_BASE_ID + 0x05) /* 0x0105 */
/** TLV type : Fail count */
#define TLV_TYPE_FAILCOUNT (PROPRIETARY_TLV_BASE_ID + 0x06) /* 0x0106 */
/** TLV type : BCN miss */
#define TLV_TYPE_BCNMISS (PROPRIETARY_TLV_BASE_ID + 0x07) /* 0x0107 */
/** TLV type : Beacon RSSI high */
#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 0x16) /* 0x0116 */
/** TLV type : Beacon SNR high */
#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 0x17) /* 0x0117 */
/** TLV type : Auto Tx */
#define TLV_TYPE_AUTO_TX (PROPRIETARY_TLV_BASE_ID + 0x18) /* 0x0118 */
/** TLV type :Link Quality */
#define TLV_TYPE_LINK_QUALITY (PROPRIETARY_TLV_BASE_ID + 0x24) /* 0x0124 */
/** TLV type : Data RSSI low */
#define TLV_TYPE_RSSI_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x26) /* 0x0126 */
/** TLV type : Data SNR low */
#define TLV_TYPE_SNR_LOW_DATA (PROPRIETARY_TLV_BASE_ID + 0x27) /* 0x0127 */
/** TLV type : Data RSSI high */
#define TLV_TYPE_RSSI_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x28) /* 0x0128 */
/** TLV type : Data SNR high */
#define TLV_TYPE_SNR_HIGH_DATA (PROPRIETARY_TLV_BASE_ID + 0x29) /* 0x0129 */
/** TLV type: Pre-Beacon Lost */
#define TLV_TYPE_PRE_BEACON_LOST (PROPRIETARY_TLV_BASE_ID + 0x49) /* 0x0149 */
#ifdef OPCHAN
/** TLV type : Operating channel control description */
#define TLV_TYPE_OPCHAN_CONTROL_DESC (PROPRIETARY_TLV_BASE_ID + 0x79) /* 0x0179 */
/** TLV type : Operating channel group control */
#define TLV_TYPE_OPCHAN_CHANGRP_CTRL (PROPRIETARY_TLV_BASE_ID + 0x7a) /* 0x017a */
#endif
/** TLV type : Channel TRPC */
#define TLV_TYPE_CHAN_TRPC (PROPRIETARY_TLV_BASE_ID + 0x89) /* 0x0189 */
/** mlan_ioctl_11h_tpc_resp */
typedef struct {
int status_code;
/**< Firmware command result status code */
int tx_power;/**< Reported TX Power from the TPC Report */
int link_margin;
/**< Reported Link margin from the TPC Report */
int rssi; /**< RSSI of the received TPC Report frame */
} __ATTRIB_PACK__ mlan_ioctl_11h_tpc_resp;
/* Define general hostcmd data structure */
/** Convert String to integer */
t_u32 a2hex_or_atoi(char *value);
char *mlan_config_get_line(FILE * fp, char *str, t_s32 size, int *lineno);
int prepare_host_cmd_buffer(FILE * fp, char *cmd_name, t_u8 *buf);
int prepare_hostcmd_regrdwr(t_u32 type, t_u32 offset, t_u32 *value, t_u8 *buf);
#endif /* _MLANHOSTCMD_H_ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,519 @@
/** @file mlanoffload.h
*
* @brief This files contains mlanutl offload command handling.
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
08/11/2009: initial version
************************************************************************/
#ifndef _MLANOFFLOAD_H_
#define _MLANOFFLOAD_H_
#ifndef MAX
/** Find maximum value */
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif /* MAX */
/** Key length */
#define KEY_LEN 32
/** Phrase length */
#define PHRASE_LEN 32
/** WEP Key count */
#define WEP_KEY_CNT 4
/* Bitmap for OFFLoad Enable - Feature*/
#ifdef BIG_ENDIAN_SUPPORT
/** Roaming Feature */
#define PROFILE_DB_FEATURE_ROAMING 0x8000
/** CCX Feature */
#define PROFILE_DB_FEATURE_CCX 0x4000
/** UNUSED Feature */
#define PROFILE_DB_FEATURE_UNUSED 0x2000
/** adhoc/infra mode */
#define PROFILE_DB_FEATURE_MODE 0x1000
#else
/** Roaming Feature */
#define PROFILE_DB_FEATURE_ROAMING 0x0001
/** CCX Feature */
#define PROFILE_DB_FEATURE_CCX 0x0002
/** UNUSED Feature */
#define PROFILE_DB_FEATURE_UNUSED 0x0004
/** adhoc/infra mode */
#define PROFILE_DB_FEATURE_MODE 0x0008
#endif
/* Bitmap for profile AKMP Support */
#ifdef BIG_ENDIAN_SUPPORT
/** Key Management EAP */
#define PROFILE_DB_KEY_MGMT_IEEE8021X 0x8000
/** Key Management PSK */
#define PROFILE_DB_KEY_MGMT_PSK 0x4000
/** Key Management NONE */
#define PROFILE_DB_KEY_MGMT_NONE 0x2000
/** Key Management CCKM */
#define PROFILE_DB_KEY_MGMT_CCKM 0x1000
/** Key Management UNUSED */
#define PROFILE_DB_KEY_MGMT_UNUSED 0x0800
/** Key Management FT 802.1x */
#define PROFILE_DB_KEY_MGMT_FT_IEEE8021X 0x0400
/** Key Management FT PSK */
#define PROFILE_DB_KEY_MGMT_FT_PSK 0x0200
/** Key Management SHA256 802.1x */
#define PROFILE_DB_KEY_MGMT_SHA256_IEEE8021X 0x0100
/** Key Management SHA256 PSK*/
#define PROFILE_DB_KEY_MGMT_SHA256_PSK 0x0080
#else
/** Key Management EAP */
#define PROFILE_DB_KEY_MGMT_IEEE8021X 0x0001
/** Key Management PSK */
#define PROFILE_DB_KEY_MGMT_PSK 0x0002
/** Key Management NONE */
#define PROFILE_DB_KEY_MGMT_NONE 0x0004
/** Key Management CCKM */
#define PROFILE_DB_KEY_MGMT_CCKM 0x0008
/** Key Management UNUSED */
#define PROFILE_DB_KEY_MGMT_UNUSED 0x0010
/** Key Management FT 802.1x */
#define PROFILE_DB_KEY_MGMT_FT_IEEE8021X 0x0020
/** Key Management FT PSK */
#define PROFILE_DB_KEY_MGMT_FT_PSK 0x0040
/** Key Management SHA256 802.1x */
#define PROFILE_DB_KEY_MGMT_SHA256_IEEE8021X 0x0080
/** Key Management SHA256 PSK*/
#define PROFILE_DB_KEY_MGMT_SHA256_PSK 0x0100
#endif
/* Bitmap for profile Encryption protocol support */
#ifdef BIG_ENDIAN_SUPPORT
/** Encryption protocol noRsn */
#define PROFILE_DB_PROTO_NO_RSN 0x8000
/** Encryption protocol static wep */
#define PROFILE_DB_PROTO_WEP_STATIC 0x4000
/** Encryption protocol dynamic wep */
#define PROFILE_DB_PROTO_WEP_DYNAMIC 0x2000
/** Encryption protocol WPA */
#define PROFILE_DB_PROTO_WPA 0x1000
/** Encryption protocol WPA-none
* Ad-hoc Networks */
#define PROFILE_DB_PROTO_WPA_NONE 0x0800
/** Encryption protocol WPA2 */
#define PROFILE_DB_PROTO_WPA2 0x0400
/** Encryption protocol CCKM */
#define PROFILE_DB_PROTO_CCKM 0x0200
#else
/** Encryption protocol noRsn */
#define PROFILE_DB_PROTO_NO_RSN 0x0001
/** Encryption protocol static wep */
#define PROFILE_DB_PROTO_WEP_STATIC 0x0002
/** Encryption protocol dynamic wep */
#define PROFILE_DB_PROTO_WEP_DYNAMIC 0x0004
/** Encryption protocol WPA */
#define PROFILE_DB_PROTO_WPA 0x0008
/** Encryption protocol WPA-none
* Ad-hoc Networks */
#define PROFILE_DB_PROTO_WPA_NONE 0x0010
/** Encryption protocol WPA2 */
#define PROFILE_DB_PROTO_WPA2 0x0020
/** Encryption protocol CCKM */
#define PROFILE_DB_PROTO_CCKM 0x0040
#endif
#ifdef BIG_ENDIAN_SUPPORT
/** Cipher wep40 */
#define PROFILE_DB_CIPHER_WEP40 0x80
/** Cipher wep104 */
#define PROFILE_DB_CIPHER_WEP104 0x40
/** Cipher tkip */
#define PROFILE_DB_CIPHER_TKIP 0x20
/** Cipher ccmp */
#define PROFILE_DB_CIPHER_CCMP 0x10
#else
/** Cipher wep40 */
#define PROFILE_DB_CIPHER_WEP40 0x01
/** Cipher wep104 */
#define PROFILE_DB_CIPHER_WEP104 0x02
/** Cipher tkip */
#define PROFILE_DB_CIPHER_TKIP 0x04
/** Cipher ccmp */
#define PROFILE_DB_CIPHER_CCMP 0x08
#endif
typedef struct {
/** Header */
MrvlIEtypesHeader_t header;
t_u32 mode; /**< Mode */
t_u32 max_off_channel;
/**< Maximum off-channel measurement duration (ms) */
t_u32 max_on_channel;
/**< Maximum on-channel measurement duration (ms) */
} __ATTRIB_PACK__ MrvlIETypes_MeasTiming_t;
typedef struct {
/** Action Set or get */
t_u16 action;
/** TLV buffer starts here */
t_u8 tlv_buffer[1];
/*
* MrvlIETypes_MeasTiming_t
*/
} __ATTRIB_PACK__ HostCmd_DS_MEASUREMENT_Timing;
/** helper structure for profile parsing */
typedef struct {
/** SSID name string */
t_u8 ssid[IW_ESSID_MAX_SIZE + 1];
/** SSID len */
t_u32 ssid_len;
/** BSSID network name */
t_u8 bssid[ETH_ALEN];
/** passphrase configured */
t_s8 passphrase[PHRASE_LEN];
/** passphrase length */
t_u32 passphrase_len;
/** Pre-shared key config flag */
int psk_config;
/** Pre-shared key */
t_u8 psk[KEY_LEN];
/** wep keys */
t_u8 wep_key[WEP_KEY_CNT][KEY_LEN];
/** wep keys lengths */
t_u8 wep_key_len[WEP_KEY_CNT];
/** wep key index */
int wep_key_idx;
/** protocol fields */
t_u16 protocol;
/** pairwise Cipher values */
t_u8 pairwise_cipher;
/** Group Cipher values */
t_u8 groupwise_cipher;
/** key management */
t_u16 key_mgmt;
/** offload specific parameter(roaming) */
t_u16 roaming;
/** offload specific parameter */
t_u16 reserved;
/** offload specific parameter--ccx */
t_u16 ccx;
/** offload specific parameter--mode */
t_u16 mode;
} profile_entry_t;
typedef struct {
#ifdef BIG_ENDIAN_SUPPORT
/** Reserved */
t_u8 Reserved:3;
/** Channel not measured */
t_u8 Unmeasured:1;
/** Radar detected */
t_u8 Radar:1;
/** Unidentified signal received */
t_u8 Unidentified:1;
/** OFDM Preamble received */
t_u8 OFDM_Preamble:1;
/** BSS found */
t_u8 BSS:1;
#else
/** BSS found */
t_u8 BSS:1;
/** OFDM Preamble received */
t_u8 OFDM_Preamble:1;
/** Unidentified signal received */
t_u8 Unidentified:1;
/** Radar detected */
t_u8 Radar:1;
/** Channel not measured */
t_u8 Unmeasured:1;
/** Reserved */
t_u8 Reserved:3;
#endif
} __ATTRIB_PACK__ IEEEtypes_DFS_Map_t;
typedef struct {
MrvlIEtypesHeader_t Header; /**< Header */
t_u8 scanReqId; /**< Scan request id assigned in table */
} __ATTRIB_PACK__ MrvlIEtypes_ChanRptBcn_t;
typedef struct {
MrvlIEtypesHeader_t Header; /**< Header */
IEEEtypes_DFS_Map_t map; /**< IEEE 802.11h basic meas report */
} __ATTRIB_PACK__ MrvlIEtypes_ChanRpt11hBasic_t;
typedef struct {
MrvlIEtypesHeader_t Header; /**< Header */
t_u8 sourceAddr[ETH_ALEN]; /**< Source MAC */
t_u8 bssid[ETH_ALEN]; /**< BSSID MAC */
t_s16 rssi; /**< Avg RSSI of frames */
t_u16 frameCnt; /**< # of frames */
} __ATTRIB_PACK__ MrvlIEtypes_ChanRptFrame_t;
#ifdef OPCHAN
typedef struct {
MrvlIEtypesHeader_t header;
/**< Header */
MrvlChannelDesc_t chanDesc;
t_u16 controlFlags;
t_u16 reserved;
t_u8 actPower;
t_u8 mdMinPower;
t_u8 mdMaxPower;
t_u8 mdPower;
} __ATTRIB_PACK__ MrvlIEtypes_ChanControlDesc_t;
typedef struct {
#ifdef BIG_ENDIAN
/** Reserved */
t_u8 reserved_4_7:4;
/** Disble channel filtering flag */
t_u8 disable_chan_filt:1;
/** Channel scan mode passive flag */
t_u8 passive_scan:1;
/** Multidomain scan mode */
t_u8 multidomain_scan:1;
/** Enable probe response timeout */
t_u8 rsp_timeout_en:1;
#else
/** Enable probe response timeout */
t_u8 rsp_timeout_en:1;
/** Multidomain scan mode */
t_u8 multidomain_scan:1;
/** Channel scan mode passive flag */
t_u8 passive_scan:1;
/** Disble channel filtering flag */
t_u8 disable_chan_filt:1;
/** Reserved */
t_u8 reserved_4_7:4;
#endif
} __ATTRIB_PACK__ ChanScanMode_t;
typedef struct {
MrvlIEtypesHeader_t header;
/**< Header */
t_u32 chanGroupBitmap;
ChanScanMode_t scanMode;
t_u8 numChan;
MrvlChannelDesc_t chanDesc[50];
} __ATTRIB_PACK__ MrvlIEtypes_ChanGroupControl_t;
typedef struct {
t_u16 action;
/**< CMD Action Get/Set*/
t_u8 tlv_buffer[1];
} __ATTRIB_PACK__ HostCmd_DS_OPCHAN_CONFIG;
typedef struct {
t_u16 action;
/**< CMD Action Get/Set*/
t_u8 tlv_buffer[1];
} __ATTRIB_PACK__ HostCmd_DS_OPCHAN_CHANGROUP_CONFIG;
#endif
typedef struct {
t_u8 modGroup;
t_u8 txPower;
} __ATTRIB_PACK__ MrvlChanTrpcEntry_t;
typedef struct {
MrvlIEtypesHeader_t header;
/**< Header */
MrvlChannelDesc_t chanDesc;
MrvlChanTrpcEntry_t chanTrpcEntry[1];
} __ATTRIB_PACK__ MrvlIEtypes_ChanTrpcCfg_t;
typedef struct {
t_u16 action;
/**< CMD Action Get/Set*/
t_u16 reserved;
t_u8 tlv_buffer[1];/** MrvlIEtypes_ChanTrpcCfg_t TLVs */
} __ATTRIB_PACK__ HostCmd_DS_CHAN_TRPC_CONFIG;
typedef struct {
t_u8 controlSelect;
t_u8 controlBitmap[1]; /* Variable length # of byte bitmaps */
} __ATTRIB_PACK__ HostCmd_DS_OFFLOAD_FEATURE_CONTROL;
#define IAPP_DATA_MAX 1000
/**
* @brief Enumeration for the command result from an IAPP Proxy command
*/
typedef enum {
IAPP_PROXY_RESULT_SUCCESS = 0,
IAPP_PROXY_RESULT_EXEC_FAILURE = 1,
IAPP_PROXY_RESULT_TIMEOUT = 2,
IAPP_PROXY_RESULT_DATA_INVALID = 3,
} __ATTRIB_PACK__ mlan_iapp_proxy_result_e;
typedef struct {
mlan_iapp_proxy_result_e commandResult;
/**< Firmware execution result */
t_u32 timeout_ms; /**< Timeout value in milliseconds */
t_u8 iappType;
t_u8 iappSubType;
t_u32 iappDataLen;
t_u8 iappData[IAPP_DATA_MAX];
} __ATTRIB_PACK__ HostCmd_DS_IAPP_PROXY;
typedef struct {
/** Action: GET/SET */
t_u16 Action;
/** Reserved */
t_u16 Reserved;
/** Association timeout */
t_u32 AssocTimeout;
/** Reassociation timeout */
t_u32 ReassocTimeout;
/** Hand shake timeout */
t_u32 HandShakeTimeout;
/** Frame exchange timeout */
t_u32 FrameExchangeTimeout;
/** Deauth of old AP in millisec; 0 to disable */
t_u32 PriorApDeauthDelay;
/** Maximum time after a disconnect where a reassoc frame will be sent */
t_u32 ReassocDiscMax;
} __ATTRIB_PACK__ HostCmd_DS_AssociationTiming_t;
/** 16 bit unsigned integer */
typedef t_u16 IEEEtypes_AId_t;
/** 16 bit unsigned integer */
typedef t_u16 IEEEtypes_StatusCode_t;
typedef struct {
/** Capability information */
IEEEtypes_CapInfo_t Capability;
/** Association response status code */
IEEEtypes_StatusCode_t StatusCode;
/** Association ID */
IEEEtypes_AId_t AId;
/** IE data buffer */
t_u8 IEBuffer[1];
} __ATTRIB_PACK__ IEEEtypes_AssocRsp_t;
/** Maximum number of AC QOS queues available in the driver/firmware */
#define MAX_AC_QUEUES 4
/** timing select structure */
typedef struct {
char *str; /**< Timing mode string */
int match_len; /**< match length */
t_u8 sel; /**< flag */
} timing_sel_t;
/** ENUM definition: reg_chan_table */
typedef enum {
REGTABLE_DEFAULT = 0,
REGTABLE_ESS = 1,
REGTABLE_USER = 2,
REGTABLE_MULTIDOMAIN = 3,
REGTABLE_MAX = 0xFFFF,
} reg_chan_table_e;
/** Sub-command callback */
typedef int (*sub_cmd_callback_t) (int argc, char *argv[]);
/** Sub-command execution data */
typedef struct {
char *str;
/**< Command string */
int match_len;
/**< Length */
int display;
/**< display as valid cmd */
sub_cmd_callback_t callback;
/**< Sub-command callback */
} sub_cmd_exec_t;
/** HostCmd_CMD_802_11_RF_TX_POWER */
typedef struct {
t_u16 action;
t_s16 current_level;
t_s8 max_power;
t_s8 min_power;
} __ATTRIB_PACK__ HostCmd_DS_802_11_RF_TX_POWER;
/** HostCmd_CMD_802_11_AUTHENTICATE */
typedef struct {
/** MAC address */
t_u8 MacAddr[ETH_ALEN];
/** Authentication type */
t_u8 AuthType;
} __ATTRIB_PACK__ HostCmd_DS_802_11_AUTHENTICATE;
boolean reg_class_table_select(char *tableStr, reg_chan_table_e *pTable);
int process_sub_cmd(sub_cmd_exec_t *sub_cmd, int num_sub_cmds,
int argc, char *argv[]);
int process_regclass(int argc, char *argv[]);
int process_scanagent(int argc, char *argv[]);
int process_measurement(int argc, char *argv[]);
int process_profile_entry(int argc, char *argv[]);
int process_get_ra_config(int argc, char *argv[]);
int process_set_ra_config(int argc, char *argv[]);
int process_chanrpt(int argc, char *argv[]);
int process_assoc_timing(int argc, char *argv[]);
int process_get_assocrsp(int argc, char *argv[]);
int process_link_stats(int argc, char *argv[]);
int process_opchan(int argc, char *argv[]);
int process_changroup(int argc, char *argv[]);
int process_fcontrol(int argc, char *argv[]);
int process_iapp(int argc, char *argv[]);
int process_rf_tx_power(int argc, char *argv[]);
int process_authenticate(int argc, char *argv[]);
int process_txpowdisp(int argc, char *argv[]);
#endif /* _MLANOFFLOAD_H_ */

View file

@ -0,0 +1,545 @@
/** @file mlanregclass.c
*
* @brief This files contains mlanutl regclass command handling.
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
08/11/2009: initial version
************************************************************************/
#include "mlanutl.h"
#include "mlanhostcmd.h"
#include "mlanoffload.h"
#include "mlanregclass.h"
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief Convert reg domain number to string
*
* @param reg_domain Reg Domain
*
* @return Reg Domain type
*/
static char *
reg_domain_to_str(reg_domain_e reg_domain)
{
switch (reg_domain) {
case REGDOMAIN_FCC:
return "FCC";
case REGDOMAIN_ETSI:
return "ETSI";
case REGDOMAIN_MIC:
return "MIC";
case REGDOMAIN_OTHER:
return "MULTI";
default:
break;
}
return "UNKN";
}
/**
* @brief Convert reg channel table number to string
*
* @param table_select Reg channel table
*
* @return Reg channel table type
*/
static char *
table_num_to_str(reg_chan_table_e table_select)
{
switch (table_select) {
case REGTABLE_USER:
return "User";
case REGTABLE_MULTIDOMAIN:
return "MultiDomain";
case REGTABLE_ESS:
return "ESS";
case REGTABLE_DEFAULT:
return "Default";
default:
break;
}
return "UNKN";
}
/**
* @brief Regclass dump channel table
*
* @param argc Number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
static int
reg_class_dump_chan_table(int argc, char *argv[])
{
int ret = MLAN_STATUS_SUCCESS;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REGCLASS_GET_CHAN_TABLE *get_table;
int idx;
t_u16 regLimits;
boolean invalid_cmd = FALSE;
printf("ERR:Cannot allocate buffer for command!\n");
if (argv[0] == NULL) {
invalid_cmd = TRUE;
} else {
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
ret = ENOMEM;
goto done;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)
malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
ret = ENOMEM;
goto done;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD,
strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd =
(HostCmd_DS_GEN *)(buffer + cmd_header_len +
sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_REGCLASS_GET_CHAN_TABLE);
hostcmd->command = cpu_to_le16(HostCmd_CMD_REGCLASS_CHAN_TABLE);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
get_table = (HostCmd_DS_REGCLASS_GET_CHAN_TABLE *)pos;
get_table->action = cpu_to_le16(HostCmd_ACT_GEN_GET);
if (reg_class_table_select(argv[0], (reg_chan_table_e *)
&get_table->table_select) == FALSE) {
invalid_cmd = TRUE;
}
}
if (invalid_cmd) {
printf("\nValid tables table; valid [user, md, ess, default]\n\n");
ret = MLAN_STATUS_FAILURE;
goto done;
}
get_table->table_select = cpu_to_le16((t_u16)(get_table->table_select));
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[regClassIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
if (!le16_to_cpu(hostcmd->result)) {
printf("HOSTCMD_RESP: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
}
get_table->table_select = le16_to_cpu(get_table->table_select);
get_table->chan = le32_to_cpu(get_table->chan);
printf("---------------------------------------");
printf("---------------------------------------\n");
printf("%35s: %s [%d]\n", "Channel Table",
table_num_to_str(get_table->table_select), (int)get_table->chan);
printf("---------------------------------------");
printf("---------------------------------------\n");
printf(" chn | freq | sfrq | sp | class | maxP | behavior limits\n");
printf("---------------------------------------");
printf("---------------------------------------\n");
for (idx = 0; (unsigned int)idx < get_table->chan; idx++) {
char regDisp[8];
sprintf(regDisp, "%4s-%02u",
reg_domain_to_str(get_table->chan_entry[idx].
reg_domain),
get_table->chan_entry[idx].regulatory_class);
printf(" %03u | %04u | %04u | %02u | %-8s | %02u |",
get_table->chan_entry[idx].chan_num,
(get_table->chan_entry[idx].start_freq +
(get_table->chan_entry[idx].chan_num * 5)),
le16_to_cpu(get_table->chan_entry[idx].start_freq),
le16_to_cpu(get_table->chan_entry[idx].chan_spacing),
regDisp, get_table->chan_entry[idx].max_tx_power);
regLimits = le16_to_cpu(get_table->chan_entry[idx].reg_limits);
if (regLimits & BLIMIT_NOMADIC)
printf(" nomadic");
if (regLimits & BLIMIT_INDOOR_ONLY)
printf(" indoor");
if (regLimits & BLIMIT_TPC)
printf(" tpc");
if (regLimits & BLIMIT_DFS)
printf(" dfs");
if (regLimits & BLIMIT_IBSS_PROHIBIT)
printf(" no_ibss");
if (regLimits & BLIMIT_FOUR_MS_CS)
printf(" 4ms_cs");
if (regLimits & BLIMIT_LIC_BASE_STA)
printf(" base_sta");
if (regLimits & BLIMIT_MOBILE_STA)
printf(" mobile");
if (regLimits & BLIMIT_PUBLIC_SAFETY)
printf(" safety");
if (regLimits & BLIMIT_ISM_BANDS)
printf(" ism");
printf("\n");
}
printf("---------------------------------------");
printf("---------------------------------------\n");
printf("\n");
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Regclass configure user table
*
* @param argc Number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
static int
reg_class_config_user_table(int argc, char *argv[])
{
int ret = MLAN_STATUS_SUCCESS;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REGCLASS_CONFIG_USER_TABLE *cfg_user_table;
if (argv[0] == NULL) {
printf("\nCountry string not specified\n");
ret = MLAN_STATUS_FAILURE;
goto done;
}
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
ret = ENOMEM;
goto done;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
ret = ENOMEM;
goto done;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_REGCLASS_CONFIG_USER_TABLE);
hostcmd->command = cpu_to_le16(HostCmd_CMD_REGCLASS_CONFIG_USER_TABLE);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
cfg_user_table = (HostCmd_DS_REGCLASS_CONFIG_USER_TABLE *)pos;
cfg_user_table->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
memcpy(cfg_user_table->regulatory_str,
argv[0],
MIN(strlen(argv[0]), sizeof(cfg_user_table->regulatory_str)));
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[regClassIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
if (!le16_to_cpu(hostcmd->result)) {
printf("HOSTCMD_RESP: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue regclass multi-domain command
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
static int
reg_class_multidomain(int argc, char *argv[])
{
int ret = MLAN_STATUS_SUCCESS;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd;
HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL *multidomain_ctrl;
boolean invalid_cmd = FALSE;
if (argv[0] == NULL) {
invalid_cmd = TRUE;
} else {
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
ret = ENOMEM;
goto done;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)
malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
ret = ENOMEM;
goto done;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD,
strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd =
(HostCmd_DS_GEN *)(buffer + cmd_header_len +
sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cmd_len =
S_DS_GEN +
sizeof(HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL);
hostcmd->command =
cpu_to_le16(HostCmd_CMD_REGCLASS_MULTIDOMAIN_CONTROL);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
multidomain_ctrl =
(HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL *)pos;
if (strcmp(argv[0], "on") == 0) {
multidomain_ctrl->multidomain_enable = 1;
} else if (strcmp(argv[0], "off") == 0) {
multidomain_ctrl->multidomain_enable = 0;
} else {
invalid_cmd = TRUE;
}
}
if (invalid_cmd) {
printf("\nUnknown multiDomain command; valid [on, off]\n\n");
ret = MLAN_STATUS_FAILURE;
goto done;
}
multidomain_ctrl->multidomain_enable =
cpu_to_le32(multidomain_ctrl->multidomain_enable);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[regClass]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
} else {
printf("\nMultiDomain: %s\n",
le32_to_cpu(multidomain_ctrl->multidomain_enable) ?
"Enabled" : "Disabled");
}
if (!le16_to_cpu(hostcmd->result)) {
printf("HOSTCMD_RESP: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
} else {
printf("HOSTCMD failed: ReturnCode=%#04x, Result=%#04x\n",
le16_to_cpu(hostcmd->command),
le16_to_cpu(hostcmd->result));
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue a regclass command
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_regclass(int argc, char *argv[])
{
sub_cmd_exec_t sub_cmd[] = { {"table", 1, 1, reg_class_dump_chan_table},
{"multidomain", 1, 1, reg_class_multidomain},
{"country", 1, 1, reg_class_config_user_table}
};
return process_sub_cmd(sub_cmd, NELEMENTS(sub_cmd), argc, argv);
}

View file

@ -0,0 +1,105 @@
/** @file mlanregclass.h
*
* @brief This files contains mlanutl regclass command handling.
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
08/11/2009: initial version
************************************************************************/
#ifndef _MLANREGCLASS_H
#define _MLANREGCLASS_H
/** Nomadic */
#define BLIMIT_NOMADIC (1 << 0)
/** Indoor */
#define BLIMIT_INDOOR_ONLY (1 << 1)
/** Tpc */
#define BLIMIT_TPC (1 << 2)
/** Dfs */
#define BLIMIT_DFS (1 << 3)
/** IBSS Prohibit */
#define BLIMIT_IBSS_PROHIBIT (1 << 4)
/** Four MS CS */
#define BLIMIT_FOUR_MS_CS (1 << 5)
/** LIC Base STA */
#define BLIMIT_LIC_BASE_STA (1 << 6)
/** Mobile STA */
#define BLIMIT_MOBILE_STA (1 << 7)
/** Public Safety */
#define BLIMIT_PUBLIC_SAFETY (1 << 8)
/** ISM Bands */
#define BLIMIT_ISM_BANDS (1 << 9)
/** Enum Definitions: reg_domain */
typedef enum {
REGDOMAIN_NULL = 0x00,
REGDOMAIN_FCC = 0x01,
REGDOMAIN_ETSI = 0x02,
REGDOMAIN_MIC = 0x03,
REGDOMAIN_OTHER = 0xFF,
} reg_domain_e;
typedef struct {
t_u8 reg_domain; /**< Domain */
t_u8 regulatory_class;
/**< Regulatory class */
t_u8 chan_num; /**< Channel Number */
t_u8 reserved1; /**< Reserved */
t_u16 start_freq; /**< Start frequency */
t_u16 chan_spacing; /**< channel spacing */
t_u8 max_tx_power; /**< Max. tx power */
t_u8 coverage_class;/**< Coverage class */
t_u16 reg_limits; /**< Limits */
} __ATTRIB_PACK__ chan_entry_t;
typedef struct {
/** Action: GET/SET */
t_u16 action;
/** Reg channel table */
t_u16 table_select;
/** Channel number */
t_u32 chan;
/** Channel entry */
chan_entry_t chan_entry[75];
} __ATTRIB_PACK__ HostCmd_DS_REGCLASS_GET_CHAN_TABLE;
typedef struct {
t_u16 action;
/**< Action: GET/SET */
t_u16 reserved;
/**< Reserved */
char regulatory_str[3];/**< Regulatory String */
} __ATTRIB_PACK__ HostCmd_DS_REGCLASS_CONFIG_USER_TABLE;
typedef struct {
t_u32 multidomain_enable;
/**< Multi domain enable */
} __ATTRIB_PACK__ HostCmd_DS_REGCLASS_MULTIDOMAIN_CONTROL;
#endif /* _MLANREGCLASS_H */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,320 @@
/** @file mlanroamagent.h
*
* @brief This files contains mlanutl roamagent command handling.
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
08/11/2009: initial version
************************************************************************/
#ifndef _MLANROAMAGENT_H_
#define _MLANROAMAGENT_H_
/** Bit definitions */
#ifndef BIT
#define BIT(x) (1UL << (x))
#endif
/* Define actionsd for HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST_MAINTENANCE */
/** Blacklist */
#define HostCmd_ACT_ADD_TO_BLACKLIST 0x0001
/** Flushing blacklisted entry */
#define HostCmd_ACT_REMOVE_FROM_BLACKLIST 0x0002
/** Roaming scanmode: discovery */
#define DISCOVERY_MODE 1
/** Roaming scanmode: tracking */
#define TRACKING_MODE 2
/** Threshold configuration: RSSI */
#define RSSI_THRESHOLD 1
/** Threshold configuration: SNR */
#define SNR_THRESHOLD 2
#ifdef BIG_ENDIAN_SUPPORT
/** Bit values for Qualified Neighbor RSSI Entry */
#define BIT_NEIGHFLAG_RSSI 0x80000000
/** Bit values for Qualified Neighbor AGE Entry */
#define BIT_NEIGHFLAG_AGE 0x40000000
/** Bit values for Qualified Neighbor Blacklist Entry */
#define BIT_NEIGHFLAG_BLACKLIST 0x20000000
/** Bit values for Qualified Neighbor Admission Capacity */
#define BIT_NEIGHFLAG_ADMISSION_CAP 0x10000000
/** Bit values for Qualified Neighbor Uplink RSSI */
#define BIT_NEIGHFLAG_UPLINK_RSSI 0x08000000
#else
/** Bit values for Qualified Neighbor RSSI Entry */
#define BIT_NEIGHFLAG_RSSI 0x01
/** Bit values for Qualified Neighbor AGE Entry */
#define BIT_NEIGHFLAG_AGE 0x02
/** Bit values for Qualified Neighbor Blacklist Entry */
#define BIT_NEIGHFLAG_BLACKLIST 0x04
/** Bit values for Qualified Neighbor Admission Capacity */
#define BIT_NEIGHFLAG_ADMISSION_CAP 0x08
/** Bit values for Qualified Neighbor Uplink RSSI */
#define BIT_NEIGHFLAG_UPLINK_RSSI 0x10
#endif
/** milliseconds time conversion data */
typedef struct exactTime {
t_u16 hrs; /**< Number of hours */
t_u16 mins; /**< Number of minutes */
t_u16 secs; /**< Number of seconds */
t_u16 msecs; /**< Number of milliseconds left */
} ExactTime_t;
/** ROAMAGENT HostEvent bitmasks */
typedef enum {
HOST_EVENT_NBOR_DISABLE = 6, /* reset bit 0 */
HOST_EVENT_NBOR_ENABLE = 1, /* set bit 0 */
HOST_EVENT_ROAM_DISABLE = 5, /* reset bit 1 */
HOST_EVENT_ROAM_ENABLE = 2, /* set bit 1 */
HOST_EVENT_STATE_DISABLE = 3, /* reset bit 2 */
HOST_EVENT_STATE_ENABLE = 4, /* reset bit 2 */
} __ATTRIB_PACK__ HostEvent_e;
/** ROAMAGENT_CONTROL command identifiers */
typedef enum {
ROAM_CONTROL_DISABLE = 6, /* reset bit 0 */
ROAM_CONTROL_ENABLE = 1, /* set bit 0 */
ROAM_CONTROL_RESUME = 5, /* reset bit 1 */
ROAM_CONTROL_SUSPEND = 2, /* set bit 1 */
CROSSBAND_DISABLE = 3, /* reset bit 2 */
CROSSBAND_ENABLE = 4 /* set bit 2 */
} __ATTRIB_PACK__ RoamControl_e;
/*
* Definitions of roaming state and other constants
*/
/** Enum Definitations: Roaming agent state */
typedef enum {
STATE_DISCONNECTED,
STATE_STABLE,
STATE_DEGRADING,
STATE_UNACCEPTABLE,
STATE_HARDROAM,
STATE_LINKLOSS,
STATE_SOFTROAM,
STATE_SUSPEND,
STATE_CMD_SUSPEND,
STATE_ASYNCASSOC_SUSPEND
} RoamingAgentState;
/** statistics threshold High RSSI */
typedef struct {
/** Header */
MrvlIEtypesHeader_t Header;
/** RSSI threshold (dBm) */
t_u8 Value;
/** reporting frequency */
t_u8 Frequency;
} __ATTRIB_PACK__ MrvlIEtypes_BeaconHighRssiThreshold_t,
MrvlIEtypes_BeaconLowRssiThreshold_t,
MrvlIEtypes_BeaconHighSnrThreshold_t,
MrvlIEtypes_BeaconLowSnrThreshold_t;
/** HostCmd_DS_CMD_ROAMAGENT_STATISTICS_THRESHOLD */
typedef struct {
/** Action */
t_u16 action;
/** roaming state */
t_u8 State;
/** active/configured user */
t_u8 Profile;
/** TLV buffer */
t_u8 TlvBuffer[1];
/* MrvlIEtypes_BeaconHighRssiThreshold_t BeaconHighRssiThreshold;
* MrvlIEtypes_BeaconLowRssiThreshold_t BeaconLowRssiThreshold;
* MrvlIEtypes_BeaconHighSnrThreshold_t BeaconHighSnrThreshold;
* MrvlIEtypes_BeaconLowSnrThreshold_t BeaconLowSnrThreshold;
* MrvlIEtypes_BeaconsMissed_t PreBeaconMissed;
* MrvlIEtypes_FailureCount_t FailureCnt;
*/
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_STATISTICS_THRESHOLD;
typedef struct {
/** */
signed char RssiHighLevel;
/** */
signed char RssiLowLevel;
/** */
signed char RssiNborDiff;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_ROAM_THRESHOLD;
#define ROAM_THRESH_MAX 4
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_ASSESSMENT */
typedef struct {
/** Action */
t_u16 action;
/** configured qualifying snr */
signed char ConfQualSignalStrength;
/** active qualifying snr */
signed char ActiveQualSignalStrength;
/** qualifying neighbor count */
t_u16 QualifyingNumNeighbor;
/** inactivity in # scans */
t_u16 StaleCount;
/** inactivity in time (ms) */
t_u32 StalePeriod;
/** blacklist duration in ms due to minor failures */
t_u32 ShortBlacklistPeriod;
/** blacklist duration in ms due to severe failures */
t_u32 LongBlacklistPeriod;
HostCmd_DS_CMD_ROAMAGENT_ROAM_THRESHOLD RoamThresh[ROAM_THRESH_MAX];
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_ASSESSMENT;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST */
typedef struct {
/** Action */
t_u16 action;
/** Reserved */
t_u16 Reserved;
/** TLV buffer */
t_u8 TlvBuffer[1];
/* MrvlIEtypes_NeighborEntry_t Neighbors[MRVL_ROAM_MAX_NEIGHBORS];
* MRVL_ROAM_MAX_NEIGHBORS = 5
*/
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST;
/** neighbor entry details roaming agent */
typedef struct {
/** Header */
MrvlIEtypesHeader_t Header;
/** bssid of neighbor */
t_u8 Bssid[ETH_ALEN];
/** Reserved */
t_u16 Reserved;
/** neighbor snr */
t_s16 SignalStrength;
/** neighbor age */
t_u16 Age;
/** bit map for qualified neighbor */
t_u32 QualifiedNeighborBitmap;
/** blacklist duration in ms */
t_u32 BlackListDuration;
} __ATTRIB_PACK__ MrvlIEtypes_NeighborEntry_t;
/** HostCmd_DS_ROAMAGENT_ADV_METRIC_THRESHOLD */
typedef struct {
/** Action */
t_u16 action;
/** Beacon RSSI Metrics,Data RSSI Metrics or PER Metrics */
t_u16 Metrics;
/** Percentage FER Threshold value to exceed for making a roam decision */
t_u8 UcFerThresholdValue;
/** Percentage PER Threshold value to exceed for making a roam decision */
t_u8 UcPerThresholdValue;
/** Reserved for later use */
t_u8 Reserved[2];
/** Time (ms) for which FER should prevail in stable state */
t_u32 StableFERPeriod_ms;
/** Time (ms) for which FER should prevail in degrading state */
t_u32 DegradingFERPeriod_ms;
/** Time (ms) for which FER should prevail in unacceptable state */
t_u32 UnacceptableFERPeriod_ms;
/** Time (ms) for which FER should prevail in stable state */
t_u32 StablePERPeriod_ms;
/** Time (ms) for which PER should prevail in degrading state */
t_u32 DegradingPERPeriod_ms;
/** Time (ms) for which PER should prevail in unacceptable state */
t_u32 UnacceptablePERPeriod_ms;
/** Number of TX packets to exceed in period_ms ms for the FER for Roam */
t_u32 UiFerPktThreshold;
/** Number of TX packets to exceed in period_ms ms for the PER for Roam */
t_u32 UiPerPktThreshold;
/** Time in ms for which inactivity should prevail for state transition */
t_u32 InactivityPeriodThreshold_ms;
/** With Data RSSI Metrics, Roam only when RX packets in period_ms ms exceeds this */
t_u32 UiRxPktThreshold;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_ADV_METRIC_THRESHOLD;
/** scan period for each search mode and state for roaming agent */
typedef struct {
/** Header */
MrvlIEtypesHeader_t Header;
/** search mode */
t_u16 SearchMode;
/** roaming state */
t_u16 State;
/** scan period value */
t_u32 ScanPeriod;
} __ATTRIB_PACK__ MrvlIEtypes_NeighborScanPeriod_t;
/** HostCmd_DS_CMD_ROAMAGENT_CONTROL */
typedef struct {
/** Action */
t_u16 action;
/** enable control */
t_u8 Control;
/** host event control */
t_u8 HostEvent;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_CONTROL;
/** HostCmd_DS_CMD_ROAMAGENT_BACKOFF */
typedef struct {
/** Action */
t_u16 action;
/** minimum scans */
t_u16 Scans;
/** backoff period */
t_u32 Period;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_BACKOFF;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD */
typedef struct {
/** Action */
t_u16 action;
/** Reserved */
t_u16 Reserved;
/** scanPeriod TLV */
MrvlIEtypes_NeighborScanPeriod_t scanPeriod;
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD_RSP */
typedef struct {
/** Action */
t_u16 action;
/** Reserved */
t_u16 Reserved;
/** TLV buffer */
t_u8 TlvBuffer[1];
/* MrvlIEtypes_NeighborScanPeriod_t scanPeriod[MRVL_ROAM_SCAN_PERIODS];
* MRVL_ROAM_SCAN_PERIODS = 6
*/
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBOR_SCANPERIOD_RSP;
/** HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST_MAINTENANCE */
typedef struct {
/** Action */
t_u16 action;
/** BSSID */
t_u8 BSSID[ETH_ALEN];
} __ATTRIB_PACK__ HostCmd_DS_CMD_ROAMAGENT_NEIGHBORLIST_MAINTENANCE;
#endif /* _MLANROAMAGENT_H_ */

View file

@ -0,0 +1,848 @@
/** @file mlanscanagent.c
*
* @brief This files contains mlanutl scanagent command handling.
*
* Usage: mlanutl mlanX scanagent [...]
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
08/11/2009: initial version
************************************************************************/
#include "mlanutl.h"
#include "mlanhostcmd.h"
#include "mlanoffload.h"
#include "mlanscanagent.h"
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/**
* @brief scanagent configure scan table
*
* @param age_limit age limit
* @param hold_limit hold limit
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_cfg_scan_table_limits(t_u32 age_limit, t_u32 hold_limit)
{
int ret = 0;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS *scan_table_limits = NULL;
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
return -ENOMEM;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
free(buffer);
return -ENOMEM;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_SCAN_TABLE_LIMITS);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
scan_table_limits = (HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS *)pos;
scan_table_limits->table_age_limit = cpu_to_le16(age_limit);
scan_table_limits->table_hold_limit = cpu_to_le16(hold_limit);
/* 0 set values are ignored by firmware */
scan_table_limits->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
printf("\nAge limit = %7d seconds\n",
le16_to_cpu(scan_table_limits->table_age_limit));
printf("Hold limit = %7d seconds\n\n",
le16_to_cpu(scan_table_limits->table_hold_limit));
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Set scanagent age limit
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_age_limit(int argc, char *argv[])
{
t_u32 age_limit = 0;
if (argc) {
age_limit = atoi(argv[0]);
}
return scanagent_cfg_scan_table_limits(age_limit, 0);
}
/**
* @brief Set scanagent hold limit
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_hold_limit(int argc, char *argv[])
{
t_u32 hold_limit = 0;
if (argc) {
hold_limit = atoi(argv[0]);
}
return scanagent_cfg_scan_table_limits(0, hold_limit);
}
/**
* @brief Set scanagent scan timing
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_timing(int argc, char *argv[])
{
int ret = 0;
struct ifreq ifr;
int idx;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len = 0, sel = 0;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_CONFIG_TIMING *cfg_timing_cmd = NULL;
MrvlIEtypes_ConfigScanTiming_t *cfg_timing_tlv = NULL;
timing_sel_t sel_str[] = { {"disconnected", 1},
{"adhoc", 1},
{"fullpower", 1},
{"ieeeps", 1},
{"periodic", 1}
};
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
cmd_len = S_DS_GEN + sizeof(t_u16);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
return -ENOMEM;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
free(buffer);
return -ENOMEM;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_SCAN_TIMING);
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cfg_timing_cmd = (HostCmd_DS_SCANAGENT_CONFIG_TIMING *)pos;
cfg_timing_cmd->action = cpu_to_le16(HostCmd_ACT_GEN_GET);
cfg_timing_tlv
= (MrvlIEtypes_ConfigScanTiming_t *)cfg_timing_cmd->tlv_buffer;
if (argc == 5) {
cfg_timing_cmd->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
cfg_timing_tlv->header.type = cpu_to_le16(TLV_TYPE_SCAN_TIMING);
cfg_timing_tlv->header.len =
cpu_to_le16(sizeof(MrvlIEtypes_ConfigScanTiming_t)
- sizeof(cfg_timing_tlv->header));
for (idx = 0; (unsigned int)idx < NELEMENTS(sel_str); idx++) {
if (strncmp(argv[0],
sel_str[idx].str,
sel_str[idx].match_len) == 0) {
sel = idx + 1;
break;
}
}
if (idx == NELEMENTS(sel_str)) {
printf("Wrong argument for mode selected \"%s\"\n",
argv[0]);
ret = -EINVAL;
goto done;
}
/*
* HostCmd_DS_ScanagentTimingMode_e;
* TIMING_MODE_INVALID = 0,
* TIMING_MODE_DISCONNECTED = 1,
* TIMING_MODE_ADHOC = 2,
* TIMING_MODE_FULL_POWER = 3,
* TIMING_MODE_IEEE_PS = 4,
* TIMING_MODE_PERIODIC_PS = 5,
*/
cfg_timing_tlv->mode = cpu_to_le32(sel);
cfg_timing_tlv->dwell = cpu_to_le32(atoi(argv[1]));
cfg_timing_tlv->max_off = cpu_to_le32(atoi(argv[2]));
cfg_timing_tlv->min_link = cpu_to_le32(atoi(argv[3]));
cfg_timing_tlv->rsp_timeout = cpu_to_le32(atoi(argv[4]));
cmd_len += sizeof(MrvlIEtypes_ConfigScanTiming_t);
}
hostcmd->size = cpu_to_le16(cmd_len);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
ret = process_host_cmd_resp(HOSTCMD, buffer);
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Set scanagent profile scan period
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_profile_period(int argc, char *argv[])
{
int ret = 0;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len = 0;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN *cfg_profile_scan = NULL;
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
cmd_len = S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN);
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
return -ENOMEM;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
free(buffer);
return -ENOMEM;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command =
cpu_to_le16(HostCmd_CMD_SCANAGENT_CONFIG_PROFILE_SCAN);
hostcmd->size = cpu_to_le16(cmd_len);
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
cfg_profile_scan = (HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN *)pos;
if (argc == 1) {
cfg_profile_scan->action = cpu_to_le16(HostCmd_ACT_GEN_SET);
cfg_profile_scan->scan_interval = cpu_to_le16(atoi(argv[0]));
} else {
cfg_profile_scan->action = cpu_to_le16(HostCmd_ACT_GEN_GET);
}
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
cfg_profile_scan->scan_interval =
le16_to_cpu(cfg_profile_scan->scan_interval);
if ((int)cfg_profile_scan->scan_interval == 0)
printf("\nProfile Scan interval: <disabled>\n\n");
else
printf("\nProfile Scan interval: %d seconds\n\n",
(int)cfg_profile_scan->scan_interval);
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief scanagent parse entry selection
*
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param psel A pointer to scanagent entry selection
*
* @return None
*/
static void
scanAgentParseEntrySel(int argc, char *argv[],
HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE *psel,
int *cmd_len)
{
int arg_idx, tmp_idx;
t_u8 *tlv_pos;
MrvlIEtypes_SsIdParamSet_t *ssid;
MrvlIEtypes_Bssid_List_t *bssid;
unsigned int mac[ETH_ALEN];
tlv_pos = (t_u8 *)psel->tlv_buffer;
for (arg_idx = 0; arg_idx < argc; arg_idx++) {
if (strncmp(argv[arg_idx], "ssid=", strlen("ssid=")) == 0) {
ssid = (MrvlIEtypes_SsIdParamSet_t *)tlv_pos;
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
ssid->header.len =
strlen(argv[arg_idx]) - strlen("ssid=");
strncpy((char *)ssid->ssid,
(argv[arg_idx] + strlen("ssid=")),
ssid->header.len);
tlv_pos +=
ssid->header.len + sizeof(MrvlIEtypesHeader_t);
ssid->header.len = cpu_to_le16(ssid->header.len);
} else if (strncmp(argv[arg_idx], "bssid=", strlen("bssid=")) ==
0) {
bssid = (MrvlIEtypes_Bssid_List_t *)tlv_pos;
bssid->header.type = cpu_to_le16(TLV_TYPE_BSSID);
bssid->header.len = ETH_ALEN;
/*
* "bssid" token string handler
*/
sscanf(argv[arg_idx] + strlen("bssid="),
"%2x:%2x:%2x:%2x:%2x:%2x", mac + 0, mac + 1,
mac + 2, mac + 3, mac + 4, mac + 5);
for (tmp_idx = 0;
(unsigned int)tmp_idx < NELEMENTS(mac);
tmp_idx++) {
bssid->bssid[tmp_idx] = (t_u8)mac[tmp_idx];
}
tlv_pos +=
bssid->header.len + sizeof(MrvlIEtypesHeader_t);
bssid->header.len = cpu_to_le16(bssid->header.len);
} else if (strncmp(argv[arg_idx], "age=", strlen("age=")) == 0) {
psel->age =
cpu_to_le32(atoi
(argv[arg_idx] + strlen("age=")));
} else if (strncmp(argv[arg_idx], "id=", strlen("id=")) == 0) {
psel->scan_request_id =
cpu_to_le32(atoi
(argv[arg_idx] + strlen("id=")));
}
}
*cmd_len += (tlv_pos - psel->tlv_buffer);
}
/**
* @brief scanagent execute scan
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_exec_scan(int argc, char *argv[])
{
int ret = 0;
struct ifreq ifr;
int arg_idx, tmp_idx;
t_u32 cmd_len = 0, cmd_header_len = 0;
t_u8 *buffer = NULL, *pos = NULL, *tlv_pos = NULL;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_SCAN_EXEC *scan_exec = NULL;
MrvlIEtypes_SsIdParamSet_t *ssid = NULL;
MrvlIEtypes_Bssid_List_t *bssid = NULL;
MrvlIEtypes_ConfigScanTiming_t *cfg_timing_tlv = NULL;
unsigned int mac[ETH_ALEN];
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
cmd_len = (S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_SCAN_EXEC)
- sizeof(scan_exec->tlv_buffer));
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
return -ENOMEM;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
free(buffer);
return -ENOMEM;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_SCAN_EXEC);
hostcmd->size = 0;
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
scan_exec = (HostCmd_DS_SCANAGENT_SCAN_EXEC *)pos;
tlv_pos = scan_exec->tlv_buffer;
for (arg_idx = 0; arg_idx < argc; arg_idx++) {
if (strncmp(argv[arg_idx], "ssid=", strlen("ssid=")) == 0) {
/*
* "ssid" token string handler
*/
ssid = (MrvlIEtypes_SsIdParamSet_t *)tlv_pos;
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
ssid->header.len =
strlen(argv[arg_idx]) - strlen("ssid=");
strncpy((char *)ssid->ssid,
argv[arg_idx] + strlen("ssid="),
ssid->header.len);
tlv_pos +=
ssid->header.len + sizeof(MrvlIEtypesHeader_t);
ssid->header.len = cpu_to_le16(ssid->header.len);
} else if (strncmp(argv[arg_idx], "bssid=", strlen("bssid=")) ==
0) {
bssid = (MrvlIEtypes_Bssid_List_t *)tlv_pos;
bssid->header.type = cpu_to_le16(TLV_TYPE_BSSID);
bssid->header.len = ETH_ALEN;
/*
* "bssid" token string handler
*/
sscanf(argv[arg_idx] + strlen("bssid="),
"%2x:%2x:%2x:%2x:%2x:%2x", mac + 0, mac + 1,
mac + 2, mac + 3, mac + 4, mac + 5);
for (tmp_idx = 0;
(unsigned int)tmp_idx < NELEMENTS(mac);
tmp_idx++) {
bssid->bssid[tmp_idx] = (t_u8)mac[tmp_idx];
}
tlv_pos +=
bssid->header.len + sizeof(MrvlIEtypesHeader_t);
bssid->header.len = cpu_to_le16(bssid->header.len);
} else if (strncmp(argv[arg_idx], "type=", strlen("type=")) ==
0) {
/*
if (strcmp(argv[arg_idx] + strlen("type="), "prof") == 0) {
scan_exec->scan_type = CONFIG_PROFILE;
} else {
scan_exec->scan_type = CONFIG_SITE_SURVEY;
}
*/
scan_exec->scan_type = CONFIG_SITE_SURVEY;
scan_exec->scan_type =
cpu_to_le16(scan_exec->scan_type);
} else if (strncmp(argv[arg_idx], "group=", strlen("group=")) ==
0) {
sscanf(argv[arg_idx] + strlen("group="), "0x%x",
&tmp_idx);
scan_exec->chan_group = cpu_to_le32(tmp_idx);
} else if (strncmp(argv[arg_idx], "delay=", strlen("delay=")) ==
0) {
/*
* "delay" token string handler
*/
sscanf(argv[arg_idx] + strlen("delay="),
"%d", (int *)&scan_exec->delay);
scan_exec->delay = cpu_to_le32(scan_exec->delay);
} else if (strncmp(argv[arg_idx], "timing=", strlen("timing="))
== 0) {
cfg_timing_tlv =
(MrvlIEtypes_ConfigScanTiming_t *)tlv_pos;
cfg_timing_tlv->header.type =
cpu_to_le16(TLV_TYPE_SCAN_TIMING);
cfg_timing_tlv->header.len = ((sizeof(cfg_timing_tlv)
-
sizeof(cfg_timing_tlv->
header)));
/*
* "timing" token string handler
*/
sscanf(argv[arg_idx] + strlen("timing="), "%d,%d,%d,%d",
(int *)&cfg_timing_tlv->dwell,
(int *)&cfg_timing_tlv->max_off,
(int *)&cfg_timing_tlv->min_link,
(int *)&cfg_timing_tlv->rsp_timeout);
cfg_timing_tlv->mode = 0;
cfg_timing_tlv->dwell =
cpu_to_le32(cfg_timing_tlv->dwell);
cfg_timing_tlv->max_off =
cpu_to_le32(cfg_timing_tlv->max_off);
cfg_timing_tlv->min_link =
cpu_to_le32(cfg_timing_tlv->min_link);
cfg_timing_tlv->rsp_timeout =
cpu_to_le32(cfg_timing_tlv->rsp_timeout);
tlv_pos += sizeof(MrvlIEtypesHeader_t);
tlv_pos += cfg_timing_tlv->header.len;
cfg_timing_tlv->header.len =
cpu_to_le16(cfg_timing_tlv->header.len);
}
}
cmd_len += (tlv_pos - scan_exec->tlv_buffer);
hostcmd->size = cpu_to_le16(cmd_len);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
} else {
printf("\nScan Scheduled, ID = %d\n\n",
(int)le32_to_cpu(scan_exec->scan_req_id_out));
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue a scanagent cmd_type subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
* @param cmd_type command type
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_entry_sub_cmd(int argc, char *argv[],
HostCmd_DS_ScanagentTableMaintenance_e cmd_type)
{
int ret = 0;
struct ifreq ifr;
t_u8 *buffer = NULL, *pos = NULL;
t_u32 cmd_len = 0, cmd_header_len = 0;
struct eth_priv_cmd *cmd = NULL;
HostCmd_DS_GEN *hostcmd = NULL;
HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE *table_maintenance = NULL;
cmd_header_len = strlen(CMD_NXP) + strlen(HOSTCMD);
cmd_len = (S_DS_GEN + sizeof(HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE)
- sizeof(table_maintenance->tlv_buffer));
buffer = (t_u8 *)malloc(BUFFER_LENGTH);
if (buffer == NULL) {
fprintf(stderr, "Cannot alloc memory\n");
return -ENOMEM;
}
memset(buffer, 0, BUFFER_LENGTH);
cmd = (struct eth_priv_cmd *)malloc(sizeof(struct eth_priv_cmd));
if (!cmd) {
printf("ERR:Cannot allocate buffer for command!\n");
free(buffer);
return -ENOMEM;
}
/* Fill up buffer */
#ifdef USERSPACE_32BIT_OVER_KERNEL_64BIT
memset(cmd, 0, sizeof(struct eth_priv_cmd));
memcpy(&cmd->buf, &buffer, sizeof(buffer));
#else
cmd->buf = buffer;
#endif
cmd->used_len = 0;
cmd->total_len = BUFFER_LENGTH;
/* buffer = MRVL_CMD<cmd> */
strncpy((char *)buffer, CMD_NXP, strlen(CMD_NXP));
strncpy((char *)buffer + strlen(CMD_NXP), HOSTCMD, strlen(HOSTCMD));
/* buffer = MRVL_CMD<cmd><hostcmd_size><HostCmd_DS_GEN><CMD_DS> */
hostcmd = (HostCmd_DS_GEN *)(buffer + cmd_header_len + sizeof(t_u32));
hostcmd->command = cpu_to_le16(HostCmd_CMD_SCANAGENT_TABLE_MAINTENANCE);
hostcmd->size = 0;
hostcmd->seq_num = 0;
hostcmd->result = 0;
/* Point after host command header */
pos = (t_u8 *)hostcmd + S_DS_GEN;
table_maintenance = (HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE *)pos;
table_maintenance->action = cpu_to_le16((t_u16)cmd_type);
scanAgentParseEntrySel(argc, argv, table_maintenance, (int *)&cmd_len);
hostcmd->size = cpu_to_le16(cmd_len);
/* Put buffer length */
memcpy(buffer + cmd_header_len, &cmd_len, sizeof(t_u32));
/* Initialize the ifr structure */
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, dev_name, strlen(dev_name));
ifr.ifr_ifru.ifru_data = (void *)cmd;
/* Perform ioctl */
if (ioctl(sockfd, MLAN_ETH_PRIV, &ifr)) {
perror("ioctl[scanAgentIoctl]");
printf("ERR:Command sending failed!\n");
ret = -EFAULT;
goto done;
}
done:
if (buffer)
free(buffer);
if (cmd)
free(cmd);
return ret;
}
/**
* @brief Issue a scanagent table lock subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_lock(int argc, char *argv[])
{
return scanagent_table_entry_sub_cmd(argc, argv, SCAN_TABLE_OP_LOCK);
}
/**
* @brief Issue a scanagent table unlock subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_unlock(int argc, char *argv[])
{
return scanagent_table_entry_sub_cmd(argc, argv, SCAN_TABLE_OP_UNLOCK);
}
/**
* @brief Issue a scanagent table purge subcommand
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS on success, otherwise error code
*/
static int
scanagent_table_purge(int argc, char *argv[])
{
return scanagent_table_entry_sub_cmd(argc, argv, SCAN_TABLE_OP_PURGE);
}
/**
* @brief Issue a scanagent command
*
* @param argc number of arguments
* @param argv A pointer to arguments array
*
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
int
process_scanagent(int argc, char *argv[])
{
sub_cmd_exec_t sub_cmd[] = {
{"timing", 2, 1, scanagent_timing},
{"scan", 2, 1, scanagent_exec_scan},
{"lock", 2, 1, scanagent_table_lock},
{"unlock", 2, 1, scanagent_table_unlock},
{"purge", 2, 1, scanagent_table_purge},
{"profile", 2, 1, scanagent_profile_period},
{"holdlimit", 2, 1, scanagent_hold_limit},
{"agelimit", 2, 1, scanagent_age_limit}
};
return process_sub_cmd(sub_cmd, NELEMENTS(sub_cmd), argc, argv);
}

View file

@ -0,0 +1,155 @@
/** @file mlanscanagent.h
*
* @brief This files contains mlanutl scanagent command handling.
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
08/11/2009: initial version
************************************************************************/
#ifndef _MLAN_SCANAGENT_H_
#define _MLAN_SCANAGENT_H_
typedef struct {
/** Action GET or SET */
t_u16 action;
/** scan interval */
t_u16 scan_interval;
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_CONFIG_PROFILE_SCAN;
typedef struct {
t_u32 scan_req_id_out;
/**< Scan request id */
t_u32 delay; /**< Delay */
t_u32 chan_group; /**< Channel Group */
t_u16 scan_type; /**< Scan type */
t_u16 reserved; /**< Reserved */
t_u8 tlv_buffer[1]; /**< Rest is TLV buffer */
/* MrvlIEtypes_SsIdParamSet_t
* MrvlIEtypes_Bssid_List_t
* MrvlIEtypes_ConfigScanTiming_t
*/
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_SCAN_EXEC;
typedef struct {
/** Action Set or get */
t_u16 action;
/** Reserved */
t_u16 reserved;
/** Table age limit */
t_u16 table_age_limit;
/** Table hold limit */
t_u16 table_hold_limit;
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_SCAN_TABLE_LIMITS;
typedef struct {
/** Action Set or get */
t_u16 action;
/** TLV buffer starts here */
t_u8 tlv_buffer[1];
/* MrvlIEtypes_ConfigScanTiming_t */
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_CONFIG_TIMING;
typedef struct {
/** HostCmd_DS_ScanagentTableMaintenance_e action */
t_u16 action;
/** Reserved */
t_u16 reserved;
/** Request Id, 0 to disable */
t_u32 scan_request_id;
/** Age, 0 to disable */
t_u32 age;
/** TLV Buffer follows */
t_u8 tlv_buffer[1];
/* MrvlIEtypes_SsIdParamSet_t
* MrvlIEtypes_Bssid_List_t
*/
} __ATTRIB_PACK__ HostCmd_DS_SCANAGENT_TABLE_MAINTENANCE;
/** ENUM definition: Scanagent Table Maintenance */
typedef enum {
SCAN_TABLE_OP_INVALID = 0,
SCAN_TABLE_OP_LOCK = 1,
SCAN_TABLE_OP_UNLOCK = 2,
SCAN_TABLE_OP_PURGE = 3,
} __ATTRIB_PACK__ HostCmd_DS_ScanagentTableMaintenance_e;
/** MrvlIEtypes_SsIdParamSet_t */
typedef struct _MrvlIEtypes_SsIdParamSet_t {
/** Header */
MrvlIEtypesHeader_t header;
/** SSID */
t_u8 ssid[1];
} __ATTRIB_PACK__ MrvlIEtypes_SsIdParamSet_t;
/** _MrvlIEtypes_Bssid_List_t */
typedef struct _MrvlIEtypes_Bssid_List_t {
/** Header */
MrvlIEtypesHeader_t header;
/** BSSID */
t_u8 bssid[ETH_ALEN];
} __ATTRIB_PACK__ MrvlIEtypes_Bssid_List_t;
typedef struct {
/** Header */
MrvlIEtypesHeader_t header;
t_u32 mode; /**< Mode */
t_u32 dwell; /**< Dwell */
t_u32 max_off; /**< Max. off */
t_u32 min_link;/**< Minimum Link */
t_u32 rsp_timeout;
/**< Rsp Timeout */
} __ATTRIB_PACK__ MrvlIEtypes_ConfigScanTiming_t;
/** ENUM definition: ScanAgentScanType */
typedef enum {
CONFIG_SITE_SURVEY = 0,
CONFIG_NEIGHBOR = 1,
CONFIG_PROFILE = 2,
CONFIG_ARBITRARY_CHANNEL = 3,
} __ATTRIB_PACK__ HostCmd_DS_ScanagentScanType_e;
/** ENUM definition: ScanAgentScanTimingMode */
typedef enum {
TIMING_MODE_INVALID = 0,
TIMING_MODE_DISCONNECTED = 1,
TIMING_MODE_ADHOC = 2,
TIMING_MODE_FULL_POWER = 3,
TIMING_MODE_IEEE_PS = 4,
TIMING_MODE_PERIODIC_PS = 5,
} __ATTRIB_PACK__HostCmd_DS_ScanagentTimingMode_e;
int process_host_cmd_resp(char *cmd_name, t_u8 *buf);
#endif /* _MLAN_SCANAGENT_H_ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,420 @@
/** @file timestamp.c
*
* @brief Functions for timestamping feature
*
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
#include "timestamp.h"
#include "time.h"
/* GLobal Declarations */
struct timespec send_time;
struct interface_data inter;
/**
*@brief Receive Timestamps
*
*@param argc Number of arguments
*@param argv Pointer to the arguments array
*
* @return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE
**/
void
receive_timestamp(int argc, char *argv[])
{
int sockfd;
int sockopt;
char ifName[IFNAMSIZ];
struct ifreq if_ip; /* get ip addr */
int so_timestamping_flags = 0;
int siocgstamp = 0;
int siocgstampns = 0;
struct timeval now;
int res;
struct ifreq if_idx;
struct ifreq if_mac;
fd_set readfs, errorfs;
/* Get interface name */
if (argc > 2)
strcpy(ifName, argv[1]);
else {
fprintf(stderr,
"invalid no. of arguments to receive_timestamp \n");
exit(1);
}
/* Header structures */
so_timestamping_flags |= SOF_TIMESTAMPING_SOFTWARE;
so_timestamping_flags |= SOF_TIMESTAMPING_RAW_HARDWARE;
memset(&if_ip, 0, sizeof(struct ifreq));
/* Open PF_PACKET socket, listening for EtherType ETHER_TYPE */
if ((sockfd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_802_EX1))) == -1) {
perror("listener: socket");
}
/* Get the index of the interface to receive on */
memset(&if_idx, 0, sizeof(struct ifreq));
strncpy(if_idx.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0)
perror("SIOCGIFINDEX");
/* Get the MAC address of the interface to receive on */
memset(&if_mac, 0, sizeof(struct ifreq));
strncpy(if_mac.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFHWADDR, &if_mac) < 0)
perror("SIOCGIFHWADDR");
/* Allow the socket to be reused - incase connection is closed prematurely */
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt,
sizeof sockopt) == -1) {
perror("setsockopt");
close(sockfd);
exit(1);
}
/* Bind to device */
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
ifName, IFNAMSIZ - 1) == -1) {
perror("SO_BINDTODEVICE");
close(sockfd);
exit(1);
}
if (so_timestamping_flags &&
setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMPING,
&so_timestamping_flags,
sizeof(so_timestamping_flags)) < 0)
perror("setsockopt SO_TIMESTAMPING");
while (1) {
FD_ZERO(&readfs);
FD_ZERO(&errorfs);
FD_SET(sockfd, &readfs);
FD_SET(sockfd, &errorfs);
gettimeofday(&now, NULL);
res = select(sockfd + 1, &readfs, 0, &errorfs, NULL);
if (res > 0) {
recvpacket(sockfd, 0, siocgstamp, siocgstampns);
}
}
}
/**
*@brief Send Timestamps
*
*@param argc Number of arguments
*@param argv Pointer to the arguments array
*
*@return MLAN_STATUS_SUCCESS/MLAN_STATUS_FAILURE
**/
int
send_timestamp(int argc, char *argv[])
{
int sockfd;
struct ifreq if_idx;
struct ifreq if_mac;
int tx_len = 0, i;
char sendbuf[BUF_SIZ];
char buff[BUF_SIZ];
struct ether_header *eh = (struct ether_header *)sendbuf;
struct sockaddr_ll socket_address;
char ifName[IFNAMSIZ], ip[50];
struct timeval delta;
fd_set readfs, errorfs;
int res, siocgstamp = 1, siocgstampns = 1;
int so_timestamping_flags = SOF_TIMESTAMPING_TX_HARDWARE;
struct ifreq hwtstamp;
struct hwtstamp_config hwconfig;
so_timestamping_flags |= SOF_TIMESTAMPING_RAW_HARDWARE;
so_timestamping_flags |= SOF_TIMESTAMPING_TX_HARDWARE;
so_timestamping_flags |= SOF_TIMESTAMPING_SYS_HARDWARE;
/* Get interface name */
if (argc > 4) {
strcpy(ifName, argv[1]);
strcpy(ip, argv[4]);
} else {
fprintf(stderr, "invalid no. of args for send_timestamp\n");
exit(1);
}
/* Open RAW socket to send on */
if ((sockfd = socket(PF_PACKET, SOCK_RAW, ETH_P_802_EX1)) == -1) {
perror("socket");
}
memset(&hwtstamp, 0, sizeof(hwtstamp));
strncpy(hwtstamp.ifr_name, ifName, sizeof(hwtstamp.ifr_name));
hwtstamp.ifr_data = (void *)&hwconfig;
memset(&hwconfig, 0, sizeof(hwconfig));
hwconfig.tx_type =
(so_timestamping_flags & SOF_TIMESTAMPING_TX_HARDWARE) ?
HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
hwconfig.rx_filter =
(so_timestamping_flags & SOF_TIMESTAMPING_RX_HARDWARE) ?
HWTSTAMP_FILTER_PTP_V1_L4_SYNC : HWTSTAMP_FILTER_NONE;
/* Get the index of the interface to send on */
memset(&if_idx, 0, sizeof(struct ifreq));
strncpy(if_idx.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0)
perror("SIOCGIFINDEX");
/* Get the MAC address of the interface to send on */
memset(&if_mac, 0, sizeof(struct ifreq));
strncpy(if_mac.ifr_name, ifName, IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFHWADDR, &if_mac) < 0)
perror("SIOCGIFHWADDR");
if (so_timestamping_flags &&
setsockopt(sockfd, SOL_SOCKET, SO_TIMESTAMPING,
&so_timestamping_flags,
sizeof(so_timestamping_flags)) < 0)
perror("setsockopt SO_TIMESTAMPING");
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
ifName, IFNAMSIZ - 1) == -1) {
perror("bind");
exit(1);
}
/* Construct the Ethernet header */
memset(sendbuf, 0, BUF_SIZ);
/* Ethernet header */
memcpy(eh->ether_shost, (u_int8_t *) & if_mac.ifr_hwaddr.sa_data,
MLAN_MAC_ADDR_LENGTH);
eh->ether_type = htons(ETH_P_802_EX1);
tx_len += sizeof(struct ether_header);
get_mac(ifName, ip);
for (i = 0; i < MLAN_MAC_ADDR_LENGTH; i++) {
eh->ether_dhost[i] = (uint8_t) inter.mac[i];
}
/* Index of the network device */
socket_address.sll_ifindex = if_idx.ifr_ifindex;
/* Address length */
socket_address.sll_halen = ETH_ALEN;
memcpy(&socket_address.sll_addr, (uint8_t *) & inter.mac,
MLAN_MAC_ADDR_LENGTH);
clock_gettime(CLOCK_REALTIME, &send_time);
sprintf(buff, "%lld.%lld", (long long)send_time.tv_sec,
(long long)send_time.tv_nsec);
strcpy((sendbuf + tx_len), buff);
/* Send packet */
res = sendto(sockfd, sendbuf, tx_len + strlen(buff), 0,
(struct sockaddr *)&socket_address,
sizeof(struct sockaddr_ll));
if (res < 0)
perror("Send ");
fprintf(stdout, "Application time : %lld.%09lld (sent)\n",
(long long)send_time.tv_sec, (long long)send_time.tv_nsec);
delta.tv_sec = 5;
delta.tv_usec = 0;
FD_ZERO(&readfs);
FD_ZERO(&errorfs);
FD_SET(sockfd, &readfs);
FD_SET(sockfd, &errorfs);
res = select(sockfd + 1, &readfs, 0, &errorfs, &delta);
if (res > 0) {
recvpacket(sockfd, MSG_ERRQUEUE, siocgstamp, siocgstampns);
}
return MLAN_STATUS_SUCCESS;
}
/**
*@brief get destination mac address
*
*@param ifc interface from which packet has to be sent
*@param ip IP Address of destination
*
*@return N/A
**/
void
get_mac(char *ifc, char *ip)
{
char ipAddr[20];
char hwAddr[20];
char device[10], temp[3], in[50];
int i = 0, j = 0, k = 0, res = 0, retry = 0;
FILE *arpCache = fopen("/proc/net/arp", "r");
if (!arpCache) {
fprintf(stderr,
"Arp Cache: Failed to open file \"/proc/net/arp\"");
}
/* Ignore the first line, which contains the header */
char header[ARP_FILE_BUFFER_LEN];
retry_again:
if (!fgets(header, sizeof(header), arpCache))
fprintf(stderr, "error getting mac from proc files");
while (3 == fscanf(arpCache, ARP_FORMAT, ipAddr, hwAddr, device)) {
if ((!strcmp(ipAddr, ip)) && (!strcmp(ifc, device))) {
printf("Sending Packet to Peer : %s\n", hwAddr);
strcpy(inter.ip, ipAddr);
strcpy(inter.interface, device);
while (hwAddr[i] != '\0') {
if (hwAddr[i] == ':') {
inter.mac[j++] = strtol(temp, NULL, 16);
i++;
k = 0;
} else
temp[k++] = hwAddr[i++];
}
inter.mac[j] = strtol(temp, NULL, 16);
res = 1;
}
}
if (res != 1 && retry == 0) {
sprintf(in, "ping -c 2 %s > /dev/null", ip);
system(in);
retry = 1;
rewind(arpCache);
goto retry_again;
} else if (res != 1 && retry == 1) {
printf("cannot find mac address for the specified ip\n");
fclose(arpCache);
exit(1);
}
fclose(arpCache);
}
/*
*@brief Receive Sync Packets
*
*@param sock socket from which packet must be recieved
*@param recvmsg_flags flags for recvmsg
*@param siocgstamp timestamp flag
*@param siocgstampns timestamp flag for nano secs
*
*@return N/A
**/
void
recvpacket(int sock, int recvmsg_flags, int siocgstamp, int siocgstampns)
{
unsigned char data[256];
struct msghdr msg;
struct iovec entry;
struct sockaddr_in from_addr;
struct {
struct cmsghdr cm;
char control[512];
} control;
int res, i;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = &entry;
msg.msg_iovlen = 1;
entry.iov_base = data;
entry.iov_len = sizeof(data);
msg.msg_name = (caddr_t) & from_addr;
msg.msg_namelen = sizeof(from_addr);
msg.msg_control = &control;
msg.msg_controllen = sizeof(control);
res = recvmsg(sock, &msg, recvmsg_flags | MSG_DONTWAIT);
if (res < 0) {
fprintf(stderr, "%s %s: %s\n",
"recvmsg",
(recvmsg_flags & MSG_ERRQUEUE) ? "error" : "regular",
strerror(errno));
} else {
if (!(recvmsg_flags & MSG_ERRQUEUE)) {
printf("Received Packet from Peer : ");
for (i = 6; i < 12; i++)
printf("%02x:", data[i]);
printf("\n");
}
printpacket(&msg, res, sock, recvmsg_flags, siocgstamp,
siocgstampns);
}
}
/**
* @brief Prints Sent/Received Sync packets
*
* @param msg msghdr structure variable
* @param res result of recvmsg call
* @param sock socket variable
* @param recvmsg_flags flags for receive message
* @param siocgstamp timestamp flag
* @param siocgstampns timestamp flag for nano secs
*
* @return N/A
**/
void
printpacket(struct msghdr *msg, int res,
int sock, int recvmsg_flags, int siocgstamp, int siocgstampns)
{
struct cmsghdr *cmsg;
struct timespec now;
struct timespec *stamp;
clock_gettime(CLOCK_REALTIME, &now);
if (!(recvmsg_flags & MSG_ERRQUEUE)) {
printf("Application time : %ld.%09ld (received)\n",
(long)now.tv_sec, (long)now.tv_nsec);
}
for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SO_TIMESTAMPING) {
stamp = (struct timespec *)CMSG_DATA(cmsg);
stamp++;
/* skip deprecated HW transformed */
stamp++;
fprintf(stdout, "HW time : %ld.%09ld\n",
(long)stamp->tv_sec, (long)stamp->tv_nsec);
if (!(recvmsg_flags & MSG_ERRQUEUE))
fprintf(stdout, "Delta in nsecs= %lld\n",
((long long)(now.tv_sec -
stamp->tv_sec) *
1000000000L + now.tv_nsec) -
(stamp->tv_nsec));
else
fprintf(stdout, "Delta in nsecs= %lld",
((long long)(stamp->tv_sec -
send_time.tv_sec) *
1000000000L + (stamp->tv_nsec) -
send_time.tv_nsec));
}
}
fprintf(stdout, "\n");
}

View file

@ -0,0 +1,60 @@
/** @file timestamp.h
*
* @brief This file contains definitions used for timestamp feature
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
#ifndef _TIMESTAMP_H_
#define _TIMESTAMP_H_
#include "mlanutl.h"
#include <linux/if_packet.h>
#include <netinet/ether.h>
#include <linux/net_tstamp.h>
#define BUF_SIZ 1024
#define ARP_FORMAT "%s %*s %*s %s %*s %s"
#define ARP_FILE_BUFFER_LEN (1024)
struct interface_data {
char ip[20];
int mac[20];
char interface[20];
};
/**
* 802.1 Local Experimental 1.
*/
#ifndef ETH_P_802_EX1
#define ETH_P_802_EX1 0x88B5
#endif
void receive_timestamp(int argc, char *argv[]);
int send_timestamp(int argc, char *argv[]);
void get_mac(char *ifc, char *ip);
void recvpacket(int sock, int recvmsg_flags, int siocgstamp, int siocgstampns);
void printpacket(struct msghdr *msg, int res, int sock,
int recvmsg_flags, int siocgstamp, int siocgstampns);
#endif //_TIMESTAMP_H_

View file

@ -0,0 +1,54 @@
# File : uaputl/Makefile
#
# Copyright 2014-2020 NXP
# Path to the top directory of the wlan distribution
PATH_TO_TOP = ../..
# Determine how we should copy things to the install directory
ABSPATH := $(filter /%, $(INSTALLDIR))
RELPATH := $(filter-out /%, $(INSTALLDIR))
INSTALLPATH := $(ABSPATH)
ifeq ($(strip $(INSTALLPATH)),)
INSTALLPATH := $(PATH_TO_TOP)/$(RELPATH)
endif
# Override CFLAGS for application sources, remove __ kernel namespace defines
CFLAGS := $(filter-out -D__%, $(ccflags-y))
# remove KERNEL include dir
CFLAGS := $(filter-out -I$(KERNELDIR)%, $(CFLAGS))
#CFLAGS += -DAP22 -fshort-enums
CFLAGS += -Wall
#ECHO = @
LIBS = -lrt
.PHONY: default tags all
OBJECTS = uaputl.o uapcmd.o uaphostcmd.o
HEADERS = uaputl.h uapcmd.h
TARGET = uaputl.exe
build default: $(TARGET)
@cp -f $(TARGET) $(INSTALLPATH)
@cp -rf config $(INSTALLPATH)
all : tags default
$(TARGET): $(OBJECTS) $(HEADERS)
$(ECHO)$(CC) $(LIBS) -o $@ $(OBJECTS)
%.o: %.c $(HEADERS)
$(ECHO)$(CC) $(CFLAGS) -c -o $@ $<
tags:
ctags -R -f tags.txt
distclean clean:
$(ECHO)$(RM) $(OBJECTS) $(TARGET)
$(ECHO)$(RM) tags.txt

View file

@ -0,0 +1,45 @@
/* Domain and country mapping are in this section */
/* Domain name followed by supported countries */
COUNTRY: DOMAIN_CODE_FCC AE AM AN AR AZ BH BL BN BR CL CN CR CS DZ EC EG GE HN HK ID IL IR JM JO KP KW KZ LB LK MA MO NP OM PE PG PH PK PT QA SA SG SV SY TH TT TN UY YE ZA ZW VN
COUNTRY: DOMAIN_CODE_FCC1 US UZ CA CO DO GT MX PA PR TW NZ BO BZ VE
COUNTRY: DOMAIN_CODE_MKK JP
COUNTRY: DOMAIN_CODE_ETSI AL AD AT AU BY BE BA BG HR CY CZ DK EE FI FR MK DE GB GR HU IS IE IT KR LV LI LT LU MT MD MC ME NL NO PL RO RU SM RS SI SK ES SE CH TR UA UK
COUNTRY: DOMAIN_CODE_IN IN
COUNTRY: DOMAIN_CODE_MY MY
/* Domain specific sub-band information */
/* Domain name followed by set of triplets separated by comma */
/* 1st number in triplet is First channel, */
/* 2nd number in triplet is Number of channels followed from the First channel */
/* 3rd number in triplet is Max-TX-power in dbm */
DOMAIN: DOMAIN_CODE_FCC 1 13 20
DOMAIN: DOMAIN_CODE_FCC1 1 11 30
DOMAIN: DOMAIN_CODE_ETSI 1 13 20
DOMAIN: DOMAIN_CODE_MKK 1 14 23
DOMAIN: DOMAIN_CODE_IN 1 11 30
DOMAIN: DOMAIN_CODE_MY 1 13 20
DOMAIN: DOMAIN_CODE_TEST 1 1 20, 2 1 16, 3 6 30, 11 1 10
DOMAIN: DOMAIN_CODE_TEST1 1 11 30, 36 1 17, 40 1 17, 44 1 17, 48 1 17, 52 1 24, 56 1 24, 60 1 24, 64 1 24, 149 1 23, 153 1 23, 157 1 23, 161 1 23, 165 1 23,
DOMAIN: DOMAIN_CODE_END
/*
* Information for channels in A Band.
*/
*** 5GHz ***
DOMAIN: DOMAIN_CODE_FCC 36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 100 1 20, 104 1 20, 108 1 20, 112 1 20, 116 1 20, 120 1 20, 124 1 20, 128 1 20, 132 1 20, 136 1 20, 140 1 20, 144 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
DOMAIN: DOMAIN_CODE_FCC1 36 1 30, 40 1 30, 44 1 30, 48 1 30, 52 1 30, 56 1 30, 60 1 30, 64 1 30, 100 1 30, 104 1 30, 108 1 30, 112 1 30, 116 1 30, 120 1 30, 124 1 30, 128 1 30, 132 1 30, 136 1 30, 140 1 30, 144 1 30, 149 1 30, 153 1 30, 157 1 30, 161 1 30, 165 1 30,
DOMAIN: DOMAIN_CODE_MKK 8 1 24, 12 1 24, 16 1 24, 36 1 23, 40 1 23, 44 1 23, 48 1 23, 52 1 23, 56 1 23, 60 1 23, 64 1 23, 100 1 23, 104 1 23, 108 1 23, 112 1 23, 116 1 23, 120 1 23, 124 1 23, 128 1 23, 132 1 23, 136 1 23, 140 1 23,
DOMAIN: DOMAIN_CODE_ETSI 36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 100 1 20, 104 1 20, 108 1 20, 112 1 20, 116 1 20, 120 1 20, 124 1 20, 128 1 20, 132 1 20, 136 1 20, 140 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
DOMAIN: DOMAIN_CODE_IN 36 1 30, 40 1 30, 44 1 30, 48 1 30, 52 1 30, 56 1 30, 60 1 30, 64 1 30, 149 1 30, 153 1 30, 157 1 30, 161 1 30, 165 1 30,
DOMAIN: DOMAIN_CODE_MY 36 1 20, 40 1 20, 44 1 20, 48 1 20, 52 1 20, 56 1 20, 60 1 20, 64 1 20, 149 1 20, 153 1 20, 157 1 20, 161 1 20, 165 1 20,
DOMAIN: DOMAIN_CODE_5G_END

View file

@ -0,0 +1,9 @@
# File : embedded_dhcp.conf
dhcp_config={
HostIPAddr=192.168.10.1
StartIPAddr=192.168.10.10
SubMask=255.255.255.0
LeaseTime=10000
LimitCount=5
}

View file

@ -0,0 +1,42 @@
01 00 0c 00 58 02
00 40 68 0c 00 00 00 40 00 00 00 00 00 11 00 00
00 11 00 10 00 00 00 00 00 00 00 00 00 00 00 00
10 12 00 10 10 86 40 89 01 03 02 00 01 02 05 00
01 03 05 00 17 17 00 05 00 00 00 00 00 00 00 00
00 30 1f 11 00 00 00 70 00 00 00 00 13 00 1e 01
00 1e 5e 15 29 5e 15 13 5c 1d 0d 0b 1d 0d 0b 29
0d 0b 29 5c 0b 29 5c 1d 00 5c 1d 0d 00 00 00 00
00 5c c0 0e 00 00 00 cc 00 5f 00 00 07 01 04 00
00 00 0e 0d 00 00 00 00 00 00 00 00 00 00 00 ff
00 00 00 01 00 00 00 00 00 00 00 ff 00 00 00 01
00 00 00 00 00 00 00 ff 00 00 00 01 00 00 00 00
00 00 00 ff 00 00 00 01 00 00 00 00 06 3c 06 3d
00 00 00 00 00 00 00 00 00 00 00 00
00 5c dc 25 00 00 01 28 00 6f 00 00 07 01 04 00
00 00 0e 0d 00 00 00 00 00 00 00 00 00 08 00 07
00 00 00 09 00 00 00 00 00 08 00 07 00 00 00 09
00 00 00 00 00 08 00 07 00 00 00 09 00 00 00 00
00 08 00 07 00 00 00 09 00 00 00 00 06 3c 06 3d
00 00 00 00 00 00 00 00 00 00 00 00
00 14 9f 1f 00 00 01 3c 03 00 00 00 00 f1 0a f1
00 fb 0d fb
00 20 dd 28 00 00 01 5c 08 86 00 88 ff 06 b1 05
24 24 3c 42 00 00 24 18 a4 24 bc bc 3d 00 a0 8f
00 14 00 2a 00 00 01 70 00 00 30 00 01 05 1b 00
00 00 00 01
00 74 2c 10 00 00 01 e4 00 00 00 00 09 6a 09 b0
0b 12 00 6c 04 0a 00 6c 03 03 00 6c 03 03 00 6c
3f ff ff 00 3f ff ff 01 3f ff ff 02 3f ff ff 03
15 00 00 04 17 00 00 05 19 00 00 06 1b 00 00 07
1d 00 00 08 1f 00 00 09 21 00 00 0a 23 00 00 0b
25 00 00 0c 28 00 00 0d 2a 00 00 0e 2d 00 00 0f
2f 00 00 10 32 00 00 11 34 00 00 12 3f ff ff 13
3f ff ff 14
00 74 84 10 ff ff ff ff 01 00 00 00 09 b0 09 ba
0a 0f 00 6c 04 09 00 6c 03 03 00 6c 03 03 00 6c
3f ff ff 00 3f ff ff 01 3f ff ff 02 3f ff ff 03
15 00 00 04 17 00 00 05 1a 00 00 06 1c 00 00 07
1f 00 00 08 21 00 00 09 23 00 00 0a 26 00 00 0b
2a 00 00 0c 2d 00 00 0d 31 00 00 0e 34 00 00 0f
3f ff ff 10 3f ff ff 11 3f ff ff 12 3f ff ff 13
3f ff ff 14

View file

@ -0,0 +1,22 @@
# File : uapcoex.conf
coex_config={
common_config={
bitmap=0x0 # bit 0: override CTS2RTS protection
APBTCoex=0 # enabled or not
}
sco_config={
protectionFromQTime0=1000
protectionFromQTime1=600
protectionFromQTime2=0
protectionFromQTime3=0
scoProtectionFromRate=9
aclFrequency=20
}
acl_config={
enabled=1
btTime=40
wlanTime=60
aclProtectionFromRate=1
}
}

View file

@ -0,0 +1,151 @@
# File : uaputl.conf
ap_config={
SSID="NXP Micro AP" # SSID of Micro AP, use '\' as an escape character before '"' character in SSID
BeaconPeriod=100 # Beacon period in TU
Channel=6 # Radio Channel 6
# Channel=0,1 # auto channel select (MCS mode)
# Channel=6,2 # primary channel 6, secondary channel above.
# Channel=6,4 # primary channel 6, secondary channel below
ChanList=1,6,11 # Scan channel list
# AP_MAC=00:34:22:77:46:41 # MAC address of AP
Band=0 # 0 for 2.4GHz band
# 1 for 5GHz band
Rate=0x82,0x84,0x8b,0x96,0x0C,0x12,0x18,0x24,0x30,0x48,0x60,0x6c
# Set of data rate that a station
# in the BSS may use
# (in unit of 500 kilobit/s)
TxPowerLevel=13 # Transmit power level in dBm
BroadcastSSID=1 # Broadcast SSID feature
# 1: Enable 0:Disable
RTSThreshold=2347 # RTS threshold value
FragThreshold=2346 # Fragmentation threshold value
DTIMPeriod=1 # DTIM period in beacon periods
MCBCdataRate=0 # MCBC rate to use for packet transmission
# 0:auto
# >0 fix rate (in unit of 500 kilobit/s)
# TxBeaconRate=0 # Beacon rate to use for Beacon transmission
# 0:auto
# >0 fix rate (in unit of 500 kilobit/s)
PktFwdCtl=1 # Packet forwarding control
# 0: forward all packets to the host
# 1: firmware handles intr-BSS packets
StaAgeoutTimer=1800 # Inactive client station age out timer value
# in units of 100ms
PSStaAgeoutTimer=400 # Inactive client PS station age out timer value
# in units of 100ms
MaxStaNum=10 # Max number of stations allowed to connect
Retrylimit=7 # Retry limit to use for packet transmissions
AuthMode=0 # 0:Open authentication
# 1:shared key authentication
# 3: WPA3 SAE
Protocol=1 # protocol to use
# 1: No security 2: Static WEP
# 8: WPA 32: WPA2 40:WPA2 Mixed Mode
# 64: WPA3 SAE
RSNReplayProtection=0 # RSN replay protection 0: disabled, 1: enabled
PairwiseUpdateTimeout=100 #Pairwise Handshake update timeout: 100ms
PairwiseHandshakeRetries=3 #Pairwise Handshake retries: 3
GroupwiseUpdateTimeout=100 #Groupwise Handshake update timeout: 100ms
GroupwiseHandshakeRetries=3 #Groupwise Handshake retries: 3
# **** WEP security setting******
# KeyIndex=0 # Index of WEP key to use (0 to 3)
# Sample Key configurations are
# Key_0="55555"
# Key_1=1234567890
# Key_2="1234567890123"
# Key_3=12345678901234567890123456
# **** Pairwise Cipher setting******
# Configure both of the following for Protocol=40
# PwkCipherWPA=4 # Pairwise cipher type
# 4: TKIP 8: AES CCMP
# 12: AES CCMP + TKIP
# PwkCipherWPA2=8 # Pairwise cipher type
# 4: TKIP 8: AES CCMP
# 12: AES CCMP + TKIP
# **** Group Cipher setting******
# GwkCipher=4 # group cipher type
# 4: TKIP 8: AES CCMP
# PSK="1234567890" # WPA/WPA2 passphrase
GroupRekeyTime= 86400 # Group key re-key interval, in second.
# 0 mean never re-key
Enable11n=1 # 1 to enable, 0 to disable
HTCapInfo=0x111c # HTCapInfo
# Bit 15-13: Reserved set to 0
# Bit 12: DSS/CCK mode in 40MHz enable/disable
# Bit 11-10: Reserved set to 0
# Bit 9-8: Reserved set to 0x01
# Bit 7: Reserved set to 0
# Bit 6: Short GI in 40 Mhz enable/disable
# Bit 5: Short GI in 20 Mhz enable/disable
# Bit 4: Green field enable/disble
# Bit 3-2: Reserved set to 1
# Bit 1: 20/40 Mhz enable disable.
# Bit 0: Reserved set to 0
AMPDU=0x03 # AMPDU
# Bit 7-5: Reserved set to 0
# Bit 4-2: Minimum MPDU Start spacing
# Set to 0 for no restriction
# Set to 1 for 1/4 us
# Set to 2 for 1/2 us
# Set to 3 for 1 us
# Set to 4 for 2 us
# Set to 5 for 4 us
# Set to 6 for 8 us
# Set to 7 for 16 us
# Bit 1-0: Max A-MPDU length
HT_MCS_MAP=0x0000ffff # Bit 7-0: MCS_SET_0
# Bit 15-8:MCS_SET_1
# Enable2040Coex=1 #Enable 20/40 coex feature
#802.11D specific configuration
11d_enable=0 # 0-disable 1-enable
# country=US # country information
# PreambleType=2 #0 to set auto, 1 to set short, 2 to set long preamble
}
ap_mac_filter={
FilterMode=0 # Mode of filter table
# 0: filter table is disabled
# 1: allow MAC address in the filter table to associate
# 2: block MAC address in the filter table
Count=0 # Number of entries in filter table,up to 16
#Sample mac settings are
# mac_1=00:50:23:45:76:22 # mac address
# mac_2=00:34:22:77:46:34 # mac address
}
# Wmm param setting
Wmm_parameters={
Qos_info=0x80
AC_BE
Aifsn=1
Ecw_max=1
Ecw_min=1
Tx_op=1
AC_BK
Aifsn=2
Ecw_max=2
Ecw_min=2
Tx_op=2
AC_VI
Aifsn=3
Ecw_max=3
Ecw_min=3
Tx_op=3
AC_VO
Aifsn=4
Ecw_max=4
Ecw_min=4
Tx_op=4
}

View file

@ -0,0 +1,80 @@
# File : uaputl_wifidirect.conf
ap_config={
SSID="DIRECT-" # SSID for WifiDirect
BeaconPeriod=100 # Beacon period in TU
Channel=6 # Radio Channel 6
# Channel=0,1 # auto channel select (MCS mode)
# Channel=6,2 # primary channel 6, secondary channel above.
# Channel=6,4 # primary channel 6, secondary channel below
ChanList=1,6,11 # Scan channel list
# AP_MAC=00:34:22:77:46:41 # MAC address of AP
Rate=0x8C,0x12,0x18,0x24,0x30,0x48,0x60,0x6c
# Set of data rate that a station
# in the BSS may use
# (in unit of 500 kilobit/s)
TxPowerLevel=13 # Transmit power level in dBm
BroadcastSSID=1 # Broadcast SSID feature
# 1: Enable 0:Disable
RTSThreshold=2347 # RTS threshold value
FragThreshold=2346 # Fragmentation threshold value
DTIMPeriod=1 # DTIM period in beacon periods
MCBCdataRate=0 # MCBC rate to use for packet transmission
# 0:auto
# >0 fix rate (in unit of 500 kilobit/s)
PktFwdCtl=1 # Packet forwarding control
# 0: forward all packets to the host
# 1: firmware handles intr-BSS packets
StaAgeoutTimer=1800 # Inactive client station age out timer value
# in units of 100ms
PSStaAgeoutTimer=400 # Inactive client PS station age out timer value
# in units of 100ms
MaxStaNum=7 # Max number of stations allowed to connect
Retrylimit=7 # Retry limit to use for packet transmissions
AuthMode=0 # 0:Open authentication
# 1:shared key authentication
Protocol=32 # protocol to use
# 1: No security 2: Static WEP
# 8: WPA 32: WPA2 40:WPA2 Mixed Mode
RSNReplayProtection=0 # RSN replay protection 0: disabled, 1: enabled
PairwiseUpdateTimeout=2000 #Pairwise Handshake update timeout: 2000ms
PairwiseHandshakeRetries=3 #Pairwise Handshake retries: 3
GroupwiseUpdateTimeout=2000 #Groupwise Handshake update timeout: 2000ms
GroupwiseHandshakeRetries=3 #Groupwise Handshake retries: 3
PwkCipherWPA2=8 # Pairwise cipher type
GwkCipher=8 # group cipher type
PSK="1234567890" # WPA/WPA2 passphrase
GroupRekeyTime= 86400 # Group key re-key interval, in second.
# 0 mean never re-key
Enable11n=1 # 1 to enable, 0 to disable
HTCapInfo=0x111c # HTCapInfo
# Bit 15-13: Reserved set to 0
# Bit 12: DSS/CCK mode in 40MHz enable/disable
# Bit 11-10: Reserved set to 0
# Bit 9-8: Reserved set to 0x01
# Bit 7: Reserved set to 0
# Bit 6: Short GI in 40 Mhz enable/disable
# Bit 5: Short GI in 20 Mhz enable/disable
# Bit 4: Green field enable/disble
# Bit 3-2: Reserved set to 1
# Bit 1: 20/40 Mhz enable disable.
# Bit 0: Reserved set to 0
AMPDU=0x03 # AMPDU
# Bit 7-5: Reserved set to 0
# Bit 4-2: Minimum MPDU Start spacing
# Set to 0 for no restriction
# Set to 1 for 1/4 us
# Set to 2 for 1/2 us
# Set to 3 for 1 us
# Set to 4 for 2 us
# Set to 5 for 4 us
# Set to 6 for 8 us
# Set to 7 for 16 us
# Bit 1-0: Max A-MPDU length
#802.11D specific configuration
11d_enable=0 # 0-disable 1-enable
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,86 @@
/** @file uapcmd.h
*
* @brief This file contains declaration referring to
* functions defined in uapcmd.c
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
03/01/08: Initial creation
************************************************************************/
#ifndef _UAPCMD_H
#define _UAPCMD_H
/** Function Prototype Declaration */
int apcmd_sys_cfg_ap_mac_address(int argc, char *argv[]);
int apcmd_sys_cfg_ssid(int argc, char *argv[]);
int apcmd_sys_cfg_beacon_period(int argc, char *argv[]);
int apcmd_sys_cfg_dtim_period(int argc, char *argv[]);
int apcmd_sys_cfg_bss_status(int argc, char *argv[]);
int apcmd_sys_cfg_channel(int argc, char *argv[]);
int apcmd_sys_cfg_channel_ext(int argc, char *argv[]);
int apcmd_sys_cfg_scan_channels(int argc, char *argv[]);
int apcmd_sys_cfg_rates(int argc, char *argv[]);
int apcmd_sys_cfg_rates_ext(int argc, char *argv[]);
int apcmd_sys_cfg_tx_power(int argc, char *argv[]);
int apcmd_sys_cfg_bcast_ssid_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_preamble_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_rts_threshold(int argc, char *argv[]);
int apcmd_sys_cfg_frag_threshold(int argc, char *argv[]);
int apcmd_sys_cfg_radio_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_rsn_replay_prot(int argc, char *argv[]);
int apcmd_sys_cfg_tx_beacon_rate(int argc, char *argv[]);
int apcmd_sys_cfg_mcbc_data_rate(int argc, char *argv[]);
int apcmd_sys_cfg_pkt_fwd_ctl(int argc, char *argv[]);
int apcmd_sys_cfg_sta_ageout_timer(int argc, char *argv[]);
int apcmd_sys_cfg_ps_sta_ageout_timer(int argc, char *argv[]);
int apcmd_sys_cfg_auth(int argc, char *argv[]);
int apcmd_sys_cfg_protocol(int argc, char *argv[]);
int apcmd_sys_cfg_wep_key(int argc, char *argv[]);
int apcmd_sys_cfg_cipher(int argc, char *argv[]);
int apcmd_sys_cfg_pwk_cipher(int argc, char *argv[]);
int apcmd_sys_cfg_gwk_cipher(int argc, char *argv[]);
int apcmd_sys_cfg_wpa_passphrase(int argc, char *argv[]);
int apcmd_sys_cfg_wpa3_sae_password(int argc, char *argv[]);
int apcmd_sys_cfg_group_rekey_timer(int argc, char *argv[]);
int apcmd_sta_filter_table(int argc, char *argv[]);
int apcmd_sys_cfg_max_sta_num(int argc, char *argv[]);
int apcmd_sys_cfg_retry_limit(int argc, char *argv[]);
int apcmd_sys_cfg_sticky_tim_config(int argc, char *argv[]);
int apcmd_sys_cfg_sticky_tim_sta_mac_addr(int argc, char *argv[]);
int apcmd_sys_cfg_eapol_pwk_hsk(int argc, char *argv[]);
int apcmd_sys_cfg_eapol_gwk_hsk(int argc, char *argv[]);
int apcmd_cfg_data(int argc, char *argv[]);
int apcmd_sys_cfg_custom_ie(int argc, char *argv[]);
int apcmd_sys_cfg_wmm(int argc, char *argv[]);
int apcmd_sys_cfg_ap_wmm(int argc, char *argv[]);
int apcmd_sys_cfg_11n(int argc, char *argv[]);
#ifdef RX_PACKET_COALESCE
int apcmd_rx_pkt_coalesce(int argc, char *argv[]);
void print_rx_packet_coalesc_help(void);
#endif
int apcmd_sys_cfg_2040_coex(int argc, char *argv[]);
int apcmd_sys_cfg_restrict_client_mode(int argc, char *argv[]);
#endif /* _UAP_H */

View file

@ -0,0 +1,343 @@
/** @file uaphostcmd.c
*
* @brief This file contains uAP hostcmd functions
*
*
* Copyright 2014-2020 NXP
*
* NXP CONFIDENTIAL
* The source code contained or described herein and all documents related to
* the source code (Materials) are owned by NXP, its
* suppliers and/or its licensors. Title to the Materials remains with NXP,
* its suppliers and/or its licensors. The Materials contain
* trade secrets and proprietary and confidential information of NXP, its
* suppliers and/or its licensors. The Materials are protected by worldwide copyright
* and trade secret laws and treaty provisions. No part of the Materials may be
* used, copied, reproduced, modified, published, uploaded, posted,
* transmitted, distributed, or disclosed in any way without NXP's prior
* express written permission.
*
* No license under any patent, copyright, trade secret or other intellectual
* property right is granted to or conferred upon you by disclosure or delivery
* of the Materials, either expressly, by implication, inducement, estoppel or
* otherwise. Any license under such intellectual property rights must be
* express and approved by NXP in writing.
*
*/
/************************************************************************
Change log:
11/26/2008: initial version
************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "uaputl.h"
#ifndef MIN
/** Find minimum value */
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif /* MIN */
/********************************************************
Local Variables
********************************************************/
/********************************************************
Global Variables
********************************************************/
/********************************************************
Local Functions
********************************************************/
/*
* @brief convert String to integer
*
* @param value A pointer to string
* @return integer
*/
static t_u32
a2hex_or_atoi(char *value)
{
if (value[0] == '0' && (value[1] == 'X' || value[1] == 'x')) {
return a2hex(value + 2);
} else if (isdigit(*value)) {
return atoi(value);
} else {
return *value;
}
}
/**
* @brief Get one line from the File
*
* @param fp File handler
* @param str Storage location for data.
* @param size Maximum number of characters to read.
* @param lineno A pointer to return current line number
* @return returns string or NULL
*/
char *
mlan_config_get_line(FILE * fp, char *str, t_s32 size, int *lineno)
{
char *start, *end;
int out, next_line;
if (!fp || !str)
return NULL;
do {
read_line:
if (!fgets(str, size, fp))
break;
start = str;
start[size - 1] = '\0';
end = start + strlen(str);
(*lineno)++;
out = 1;
while (out && (start < end)) {
next_line = 0;
/* Remove empty lines and lines starting with # */
switch (start[0]) {
case ' ': /* White space */
case '\t': /* Tab */
start++;
break;
case '#':
case '\n':
case '\0':
next_line = 1;
break;
case '\r':
if (start[1] == '\n')
next_line = 1;
else
start++;
break;
default:
out = 0;
break;
}
if (next_line)
goto read_line;
}
/* Remove # comments unless they are within a double quoted
* string. Remove trailing white space. */
if ((end = strstr(start, "\""))) {
if (!(end = strstr(end + 1, "\"")))
end = start;
} else
end = start;
if ((end = strstr(end + 1, "#")))
*end-- = '\0';
else
end = start + strlen(start) - 1;
out = 1;
while (out && (start < end)) {
switch (*end) {
case ' ': /* White space */
case '\t': /* Tab */
case '\n':
case '\r':
*end = '\0';
end--;
break;
default:
out = 0;
break;
}
}
if (*start == '\0')
continue;
return start;
} while (1);
return NULL;
}
/**
* @brief get hostcmd data
*
* @param ln A pointer to line number
* @param buf A pointer to hostcmd data
* @param size A pointer to the return size of hostcmd buffer
* @return UAP_SUCCESS
*/
static int
mlan_get_hostcmd_data(FILE * fp, int *ln, t_u8 *buf, t_u16 *size)
{
t_s32 errors = 0, i;
char line[512], *pos, *pos1, *pos2, *pos3;
t_u16 len;
while ((pos = mlan_config_get_line(fp, line, sizeof(line), ln))) {
(*ln)++;
if (strcmp(pos, "}") == 0) {
break;
}
pos1 = strchr(pos, ':');
if (pos1 == NULL) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos1++ = '\0';
pos2 = strchr(pos1, '=');
if (pos2 == NULL) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos2++ = '\0';
len = a2hex_or_atoi(pos1);
if (len < 1 || len > MRVDRV_SIZE_OF_CMD_BUFFER) {
printf("Line %d: Invalid hostcmd line '%s'\n", *ln,
pos);
errors++;
continue;
}
*size += len;
if (*pos2 == '"') {
pos2++;
if ((pos3 = strchr(pos2, '"')) == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = '\0';
memset(buf, 0, len);
memmove(buf, pos2, MIN(strlen(pos2), len));
buf += len;
} else if (*pos2 == '\'') {
pos2++;
if ((pos3 = strchr(pos2, '\'')) == NULL) {
printf("Line %d: invalid quotation '%s'\n", *ln,
pos);
errors++;
continue;
}
*pos3 = ',';
for (i = 0; i < len; i++) {
if ((pos3 = strchr(pos2, ',')) != NULL) {
*pos3 = '\0';
*buf++ = (t_u8)a2hex_or_atoi(pos2);
pos2 = pos3 + 1;
} else
*buf++ = 0;
}
} else if (*pos2 == '{') {
t_u16 tlvlen = 0, tmp_tlvlen;
mlan_get_hostcmd_data(fp, ln, buf + len, &tlvlen);
tmp_tlvlen = tlvlen;
while (len--) {
*buf++ = (t_u8)(tmp_tlvlen & 0xff);
tmp_tlvlen >>= 8;
}
*size += tlvlen;
buf += tlvlen;
} else {
t_u32 value = a2hex_or_atoi(pos2);
while (len--) {
*buf++ = (t_u8)(value & 0xff);
value >>= 8;
}
}
}
return UAP_SUCCESS;
}
/********************************************************
Global Functions
********************************************************/
/**
* @brief Prepare host-command buffer
* @param fname path to the config file
* @param cmd_name Command name
* @param buf A pointer to comand buffer
* @return UAP_SUCCESS--success, otherwise--fail
*/
int
prepare_host_cmd_buffer(char *fname, char *cmd_name, t_u8 *buf)
{
char line[256], cmdname[256], *pos, cmdcode[10];
apcmdbuf *hostcmd;
int ln = 0;
int cmdname_found = 0, cmdcode_found = 0;
FILE *config_fp;
int ret = UAP_SUCCESS;
config_fp = fopen(fname, "r");
if (!config_fp) {
printf("Unable to find %s. Exiting...\n", fname);
return UAP_FAILURE;
}
memset(buf, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
hostcmd = (apcmdbuf *)buf;
hostcmd->cmd_code = 0xffff;
snprintf(cmdname, sizeof(cmdname), "%s={", cmd_name);
cmdname_found = 0;
while ((pos = mlan_config_get_line(config_fp, line, sizeof(line), &ln))) {
if (strcmp(pos, cmdname) == 0) {
cmdname_found = 1;
snprintf(cmdcode, sizeof(cmdcode), "CmdCode=");
cmdcode_found = 0;
while ((pos =
mlan_config_get_line(config_fp, line,
sizeof(line), &ln))) {
if (strncmp(pos, cmdcode, strlen(cmdcode)) == 0) {
t_u16 len = 0;
cmdcode_found = 1;
hostcmd->cmd_code =
a2hex_or_atoi(pos +
strlen(cmdcode));
hostcmd->size =
sizeof(apcmdbuf) -
BUF_HEADER_SIZE;
mlan_get_hostcmd_data(config_fp, &ln,
buf +
sizeof(apcmdbuf),
&len);
hostcmd->size += len;
break;
}
}
if (!cmdcode_found) {
fprintf(stderr,
"uaputl: CmdCode not found in conf file\n");
ret = UAP_FAILURE;
goto done;
}
break;
}
}
if (!cmdname_found) {
fprintf(stderr,
"uaputl: cmdname '%s' is not found in conf file\n",
cmd_name);
ret = UAP_FAILURE;
goto done;
}
done:
fclose(config_fp);
return ret;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,57 @@
# File : wifidirectutl/Makefile
#
# Copyright 2014-2020 NXP
# Path to the top directory of the wlan distribution
PATH_TO_TOP = ../..
# Determine how we should copy things to the install directory
ABSPATH := $(filter /%, $(INSTALLDIR))
RELPATH := $(filter-out /%, $(INSTALLDIR))
INSTALLPATH := $(ABSPATH)
ifeq ($(strip $(INSTALLPATH)),)
INSTALLPATH := $(PATH_TO_TOP)/$(RELPATH)
endif
# Override CFLAGS for application sources, remove __ kernel namespace defines
CFLAGS := $(filter-out -D__%, $(ccflags-y))
# remove KERNEL include dir
CFLAGS := $(filter-out -I$(KERNELDIR)%, $(CFLAGS))
CFLAGS += -Wall
LIBS = -lrt
.PHONY: default tags all
OBJECTS = wifidirectutl.o
HEADERS = wifidirectutl.h
ifneq (,$(findstring DWIFI_DISPLAY_SUPPORT, $(CFLAGS)))
OBJECTS += wifi_display.o
HEADERS += wifi_display.h
endif
TARGET = wifidirectutl
build default: $(TARGET)
@cp -f $(TARGET) $(INSTALLPATH)
@cp -rf config $(INSTALLPATH)
all : tags default
$(TARGET): $(OBJECTS) $(HEADERS)
$(ECHO)$(CC) $(LIBS) -o $@ $(OBJECTS)
%.o: %.c $(HEADERS)
$(ECHO)$(CC) $(CFLAGS) -c -o $@ $<
tags:
ctags -R -f tags.txt
distclean clean:
$(ECHO)$(RM) $(OBJECTS) $(TARGET)
$(ECHO)$(RM) tags.txt

View file

@ -0,0 +1,415 @@
# File : wifidirect.conf
######################### WIFIDIRECT Configuration command ##################
wifidirect_config={
# Arrange in order of subelement Ids
#
# WIFIDIRECT IE parameters.
#
Capability={
DeviceCapability=33
GroupCapability=8
}
GroupOwnerIntent={
Intent=5 # 0-15. 15-> highest GO desire
}
Channel={ # Listen channel attribute.
CountryString="US"
RegulatoryClass=81
ChannelNumber=6
}
InfrastructureManageabilityInfo={
Manageability=0
}
ChannelList={
CountryString="US"
# multiple attributes channel entry list
Regulatory_Class_1=81 # Regulatory class
NumofChannels_1=11 # No of channels
ChanList_1=1,2,3,4,5,6,7,8,9,10,11 # Scan channel list
Regulatory_Class_2=115 # Regulatory class
NumofChannels_2=4 # No of channels
ChanList_2=36,40,44,48 # Scan channel list
#Regulatory_Class_3=118 # Regulatory class
#NumofChannels_3=4 # No of channels
#ChanList_3=52,56,60,64 # Scan channel list
#Regulatory_Class_4=121 # Regulatory class
#NumofChannels_4=11 # No of channels
#ChanList_4=100,104,108,112,116,120,124,128,132,136,140 # Scan channel list
# Enable only one of the country blocks at a time
#CountryString="JP"
# multiple attributes channel entry list
#Regulatory_Class_1=81 # Regulatory class
#NumofChannels_1=13 # No of channels
#ChanList_1=1,2,3,4,5,6,7,8,9,10,11,12,13 # Scan channel list
#Regulatory_Class_2=115 # Regulatory class
#NumofChannels_2=4 # No of channels
#ChanList_2=36,40,44,48 # Scan channel list
#Regulatory_Class_3=118 # Regulatory class
#NumofChannels_3=4 # No of channels
#ChanList_3=52,56,60,64 # Scan channel list
#Regulatory_Class_4=121 # Regulatory class
#NumofChannels_4=11 # No of channels
#ChanList_4=100,104,108,112,116,120,124,128,132,136,140 # Scan channel list
}
NoticeOfAbsence={
NoA_Index=0 # Instance of NoA timing
OppPS=1 # Opportunistic Power save
CTWindow=10 # Client Traffic Window
NoA_descriptor={
CountType_1=255 # Count for GO mode OR Type for client mode
Duration_1=51200 # Max absence duration for GO mode OR
# min acceptable presence period for client mode
Interval_1=102400
StartTime_1=0
#CountType_2=1 # Count for GO mode OR Type for client mode
#Duration_2=0 # Max absence duration for GO mode OR
# min acceptable presence period for client mode
#Interval_2=0
#StartTime_2=0
}
}
DeviceInfo={
DeviceAddress=00:50:43:00:00:00
# categ: 2 bytes, OUI: 4 bytes, subcateg: 2 bytes
PrimaryDeviceTypeCategory=1
PrimaryDeviceTypeOUI=0x00,0x50,0xF2,0x04
PrimaryDeviceTypeSubCategory=1
SecondaryDeviceCount=2
SecondaryDeviceType={
SecondaryDeviceTypeCategory_1=6
SecondaryDeviceTypeOUI_1=0x00,0x50,0xF2,0x04
SecondaryDeviceTypeSubCategory_1=1
SecondaryDeviceTypeCategory_2=4
SecondaryDeviceTypeOUI_2=0x00,0x50,0xF2,0x04
SecondaryDeviceTypeSubCategory_2=1
}
DeviceName="MRVL_DEFAULT_NAME"
# ConfigMethods USB= 0x01
# ConfigMethods Ethernet= 0x02
# ConfigMethods Label= 0x04
# ConfigMethods Display= 0x08
# ConfigMethods Ext_NFC_Token= 0x10
# ConfigMethods Int_NFC_Token= 0x20
# ConfigMethods NFC_Interface= 0x40
# ConfigMethods PushButton= 0x80
# ConfigMethods KeyPad= 0x100
WPSConfigMethods=0x188
}
GroupId={
GroupAddr=00:50:43:00:00:00
GroupSsId="DIRECT-"
}
GroupBSSId={
# using LAA for interface address by default
GroupBssId=02:50:43:00:00:00
}
DeviceId={
WIFIDIRECT_MAC=00:50:43:00:00:00 # MAC address of wifidirect device in Hex
}
Interface={
# using LAA for interface addresses by default
InterfaceAddress=02:50:43:00:00:00
InterfaceAddressCount=2
InterfaceAddressList=02:50:43:00:00:00,02:52:43:00:00:00
}
ConfigurationTimeout={
# units of 10 milliseconds
GroupConfigurationTimeout=250
ClientConfigurationTimeout=100
}
ExtendedListenTime={
# units of milliseconds
AvailabilityPeriod=1000
AvailabilityInterval=1500
}
IntendedIntfAddress={
# using LAA for interface address by default
GroupInterfaceAddress=02:50:43:00:00:00
}
OperatingChannel={ # Operating channel attribute.
CountryString="US"
OpRegulatoryClass=81
OpChannelNumber=6
}
InvitationFlagBitmap={
InvitationFlag=0 # bit0: Invitation type:
} # 0: request to reinvoke a persistent group
# 1: request to join an active WIFIDIRECT group
#Extra={
#Buffer=0x00,0x50,0x43,0x07,0x20,0xa1
#}
#
# WPS IE parameters.
#
WPSIE={
WPSVersion=0x10
WPSSetupState=0x1
WPSRequestType=0x0
WPSResponseType=0x0
WPSSpecConfigMethods=0x0188
WPSUUID=0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78,0x12,0x34,0x56,0x78
WPSPrimaryDeviceType=0x00,0x01,0x00,0x50,0xF2,0x04,0x00,0x01
WPSRFBand=0x01
WPSAssociationState=0x00
WPSConfigurationError=0x00
WPSDevicePassword=0x00
WPSDeviceName="MRVL_DEFAULT_NAME"
WPSManufacturer=NXP
WPSModelName=SD-8787
WPSModelNumber=0x00,0x00,0x00,0x01
WPSSerialNumber=0x00,0x00,0x00,0x01
WPSVendorExtension=0x00,0x37,0x2A,0x00,0x01,0x20
}
}
######################### WIFIDIRECT Parameters configuration command #######
wifidirect_param_config={
MinDiscoveryInterval=1
MaxDiscoveryInterval=7
EnableScan=1
#ScanPeerDeviceId=00:50:43:77:43:47
#ScanRequestDeviceType=0x01,0x00,0x50,0xF2,0x04,0x01,0x3C,0x10
DeviceState=4
}
######################### WIFIDIRECT Action Frame command ##################
wifidirect_action_frame={
PeerAddr=00:50:43:00:00:00
Category=4 # 4 : Public action frame, 0x7F : Vendor specific
Action=0 # 0xDD : Vendor specific, Others : Reserved.
OUI=0x50,0x6F,0x9A
OUIType=9 # WFA wifidirect.
# 15 : WPSE.
# OUI SubType 0 : GO Negotiation Request
# OUI SubType 1 : GO Negotiation Response
# OUI SubType 2 : GO Negotiation Confirmation
# OUI SubType 3 : WIFIDIRECT Invitation Request
# OUI SubType 4 : WIFIDIRECT Invitation Response
# OUI SubType 5 : Device Discoverability Request
# OUI SubType 6 : Device Discoverability Response
# OUI SubType 7 : Provision Discovery Request
# OUI SubType 8 : Provision Discovery Response
#
# UPDATE LINE BELOW for APPROPRIATE SUB TYPE
#
OUISubType=0
DialogToken=1
# Arrange in order of subelement Ids
# Other parameters which can be configured from WIFIDIRECT config command.
#DeviceId={
# WIFIDIRECT_MAC=00:50:43:77:46:41 # MAC address of wifidirect device in Hex
#}
#Interface={
# InterfaceAddress=00:50:43:77:46:41
# InterfaceAddressCount=2
# InterfaceAddressList=00:50:43:77:46:41,00:50:43:78:47:42
#}
}
######################### WIFIDIRECT service discovery command ##################
wifidirect_discovery_request={
PeerAddr=00:50:43:00:00:00
Category=4
Action=10
DialogToken=1
AdvertizementProtocolIE=0x6c,0x02,0x00,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryRequestLen={
InfoId=0xDD,0xDD
RequestLen={
OUI=0x50,0x6F,0x9A
OUISubType=9
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=0 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 255: Vendor specific
ServiceTransactionId=1
QueryData={
## Use Data below, if ServiceProtocol=1 (Bonjour).
#
## DNSName can be string or hexadecimal sequence of bytes.
#DNSName="_afpovertcp._tcp.local."
# DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
#DNSType=12
#BonjourVersion=1
## Use Data below, if ServiceProtocol=2 (uPnP).
#
#uPnPVersion=0x10
#uPnPQueryValue="ssdp:all" # Searches for all UPnP devices and services
#
# OR any one of following values in WIFIDIRECT spec.
#uPnPQueryValue="upnp:rootdevice" # Searches for all UPnP root devices
#uPnPQueryValue="uuid:device-uuid" # Searches for a particular device
#uPnPQueryValue="urn:schemas-upnp-org:device:deviceType:ver"
# Searches for devices of the given type
#uPnPQueryValue="urn:domain-name:device:deviceType:ver"
# Searches for devices with a vendor-specific type
#uPnPQueryValue="urn:schemas-upnp-org:service:serviceType:ver"
# Searches for devices containing a service of the given type
#uPnPQueryValue="urn:domain-name:service:serviceType:ver"
# Searches for devices containing a vendor-specific service
}
}
}
}
}
wifidirect_discovery_response={
PeerAddr=00:50:43:00:00:00
Category=4
Action=11
DialogToken=1
StatusCode=0
GasComebackDelay=0x0000
AdvertizementProtocolIE=0x6c,0x02,0x7F,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryResponseLen={
InfoId=0xDD,0xDD
ResponseLen={
OUI=0x50,0x6F,0x9A
OUISubType=9
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=0 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 255: Vendor specific
ServiceTransactionId=1
ServiceStatus=0 # 0: Success
# 1: Service protocol type not available
# 2: Query data not available
# 3: Bad request.
ResponseData={
## Use Data below, if ServiceProtocol=1 (Bonjour).
#
## DNSName can be string or hexadecimal sequence of bytes.
DNSName="_afpovertcp._tcp.local."
# DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
DNSType=12
BonjourVersion=1
## RecordData can be string or hexadecimal sequence of bytes.
# RecordData=""
RecordData=0x00
## Use Data below, if ServiceProtocol=2 (uPnP).
#
#uPnPVersion=0x10
#uPnPResponseValue="ssdp:all" # Searches for all UPnP devices and services
#
# OR any one of following values in WIFIDIRECT spec.
#uPnPResponseValue="upnp:rootdevice" # Searches for all UPnP root devices
#uPnPResponseValue="uuid:device-uuid" # Searches for a particular device
#uPnPResponseValue="urn:schemas-upnp-org:device:deviceType:ver"
# Searches for devices of the given type
#uPnPResponseValue="urn:domain-name:device:deviceType:ver"
# Searches for devices with a vendor-specific type
#uPnPResponseValue="urn:schemas-upnp-org:service:serviceType:ver"
# Searches for devices containing a service of the given type
#uPnPResponseValue="urn:domain-name:service:serviceType:ver"
# Searches for devices containing a vendor-specific service
}
}
}
}
}
### GAS Comback request and response Frame ###
wifidirect_gas_comeback_request={
PeerAddr=00:50:43:00:00:00
Category=4
Action=12
DialogToken=1
}
wifidirect_gas_comeback_response={
PeerAddr=00:50:43:00:00:00
Category=4
Action=13
DialogToken=1
StatusCode=0
GasResponseFragID=0x01
# Bit 7: More GAS fragments bit
# Bits 0-6: GAS query response fragment ID.
# 0 for initial frame and increments subsequently.
GasComebackDelay=0x0000
AdvertizementProtocolIE=0x6c,0x02,0x7F,0x00
# octet 1: Element Id = 108 ( 0x6c)
# octer 2: Length of following fields
# octer 3: Bit7: PAME-BI ( Message Exchange BSSID independant)
# Bits0-6: Query response length limit.
# octer 4: Advertizement Protocol ID
QueryResponseLen={
InfoId=0xDD,0xDD
ResponseLen={
OUI=0x00,0x50,0xF2
OUISubType=9
ServiceUpdateIndicator=0
VendorLen={
ServiceProtocol=1 # 0: All service protocol types
# 1: Bonjour, 2: uPnP, 3: WS-Discovery
# 255: Vendor specific
ServiceTransactionId=1
ServiceStatus=0 # 0: Success
# 1: Service protocol type not available
# 2: Query data not available
# 3: Bad request.
ResponseData={
## Use Data below, if ServiceProtocol=1 (Bonjour).
#
## DNSName can be string or hexadecimal sequence of bytes.
# DNSName="_afpovertcp._tcp.local."
DNSName=0x07,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x0B,0x5F,0x61,0x66,0x70,0x6F,0x76,0x65,0x72,0x74,0x63,0x70,0xC0,0x0C
DNSType=12
BonjourVersion=1
## RecordData can be string or hexadecimal sequence of bytes.
# RecordData=""
RecordData=0x00
## Use Data below, if ServiceProtocol=2 (uPnP).
#
#uPnPVersion=0x10
#uPnPResponseValue="ssdp:all" # Searches for all UPnP devices and services
#
# OR any one of following values in WIFIDIRECT spec.
#uPnPResponseValue="upnp:rootdevice" # Searches for all UPnP root devices
#uPnPResponseValue="uuid:device-uuid" # Searches for a particular device
#uPnPResponseValue="urn:schemas-upnp-org:device:deviceType:ver"
# Searches for devices of the given type
#uPnPResponseValue="urn:domain-name:device:deviceType:ver"
# Searches for devices with a vendor-specific type
#uPnPResponseValue="urn:schemas-upnp-org:service:serviceType:ver"
# Searches for devices containing a service of the given type
#uPnPResponseValue="urn:domain-name:service:serviceType:ver"
# Searches for devices containing a vendor-specific service
}
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
#! /bin/bash
if echo $1 2>&1 | grep dbg > /dev/null; then
insmod mlan-dbg.ko
else
insmod mlan.ko
fi
insmod $1.ko $2 $3 $4 $5 $6 $7 $8
for (( i = 1; i <= 10; i++ ))
do
ifconfig -a 2>&1 | grep -E "(mlan0|uap0|wfd0)" > /dev/null
if [ $? -eq 0 ]; then
exit
fi
sleep 1
done

View file

@ -0,0 +1,20 @@
#! /bin/bash
ifconfig mlan0 down
ifconfig uap0 down
ifconfig mmlan0 down
ifconfig muap0 down
ifconfig wfd0 down
ifconfig wfd1 down
ifconfig mwfd0 down
ifconfig mwfd1 down
for (( i = 0; i <= 30; i++ ))
do
rmmod moal 2> /dev/null
lsmod 2>&1 | grep moal > /dev/null
if [ ! $? -eq 0 ]; then
break
fi
sleep 1
done
rmmod mlan
sleep 5

Binary file not shown.

View file

@ -0,0 +1,30 @@
#!/bin/bash
# iwpriv mlan0 drvdbg 0x20037
# change the mac address
./wifidirect/update_mac.sh
echo "wfd0 Mac address updated in config/wifidirect.conf"
./wifidirectutl wfd0 wifidirect_config config/wifidirect.conf
#ifdef STREAM_2X2
iwpriv wfd0 bssrole 1
#else
# iwpriv wfd0 bssrole 1
#endif
./uaputl.exe -i wfd0 sys_config config/uaputl_wifidirect.conf
#ifdef STREAM_2X2
iwpriv wfd0 bssrole 0
#else
# iwpriv wfd0 bssrole 0
#endif
# iwpriv wfd0 bssrole 1
# change the group owner parameters
# either in uaputl_wifidirect.conf or using CLI below
#./uaputl.exe -i wfd0 sys_cfg_wpa_passphrase 1234567890
#./uaputl.exe -i wfd0 sys_cfg_eapol_gwk_hsk 2000 3
#./uaputl.exe -i wfd0 sys_cfg_eapol_pwk_hsk 2000 3
# iwpriv wfd0 bssrole 0
./wifidirectutl wfd0 wifidirect_mode 1
iwpriv wfd0 bssrole 1
./wifidirectutl wfd0 wifidirect_mode 2
./uaputl.exe -i wfd0 bss_start

View file

@ -0,0 +1,25 @@
#!/bin/bash
# iwpriv wfd0 drvdbg 0x20037
#change the mac address
./wifidirect/update_mac.sh
echo "wfd0 Mac address updated in config/wifidirect.conf"
#ifdef STREAM_2X2
iwpriv wfd0 bssrole 1
#else
# iwpriv wfd0 bssrole 1
#endif
./uaputl.exe -i wfd0 sys_config config/uaputl_wifidirect.conf
#ifdef STREAM_2X2
iwpriv wfd0 bssrole 0
#else
# iwpriv wfd0 bssrole 0
#endif
./wifidirectutl wfd0 wifidirect_config config/wifidirect.conf
# change the passphrase
# either in uaputl_wifidirect.conf or using CLI below
#./uaputl.exe -i wfd0 sys_cfg_wpa_passphrase 1234567890
./wifidirectutl wfd0 wifidirect_mode 1
./wifidirectutl wfd0 wifidirect_params_config config/wifidirect.conf
./mlanutl wfd0 hostcmd config/bg_scan_wifidirect.conf bgscfg
./wifidirectutl wfd0 wifidirect_mode 4

View file

@ -0,0 +1,18 @@
#!/bin/bash
iwpriv wfd0 drvdbg 0x20037
# change the mac address
ifconfig mlan0 hw ether 00:50:43:21:0e:08
ifconfig wfd0 hw ether 00:50:43:21:0e:08
ifconfig uap0 hw ether 00:50:43:21:0e:08
iwpriv wfd0 deepsleep 0
iwconfig wfd0 power off
iwpriv wfd0 bssrole 1
./uaputl.exe -i wfd0 sys_config config/uaputl_wifidirect.conf
iwpriv wfd0 bssrole 0
./wifidirectutl wfd0 wifidirect_config config/wifidirect.conf
./uaputl.exe -i wfd0 sys_cfg_protocol 32
./uaputl.exe -i wfd0 sys_cfg_cipher 8 8
./uaputl.exe -i wfd0 sys_cfg_wpa_passphrase 1234567890
./wifidirectutl wfd0 wifidirect_mode 1

View file

@ -0,0 +1,8 @@
#!/bin/bash
./uaputl.exe -i wfd0 bss_stop
sleep 1
iwpriv wfd0 bssrole 0
./wifidirectutl wfd0 wifidirect_mode 0
# IE clear assume index 0, 1
./uaputl.exe -i wfd0 sys_cfg_custom_ie 0 0
./uaputl.exe -i wfd0 sys_cfg_custom_ie 1 0

View file

@ -0,0 +1,6 @@
#!/bin/bash
# deauth the GO first
./wifidirectutl wfd0 wifidirect_mode 0
# IE clear assume index 0, 1
./uaputl.exe -i wfd0 sys_cfg_custom_ie 0 0
./uaputl.exe -i wfd0 sys_cfg_custom_ie 1 0

View file

@ -0,0 +1,16 @@
#!/bin/bash
MAC=`ifconfig wfd0 | grep wfd0 | tr -s ' ' | cut -d ' ' -f5`
MAC26=`echo $MAC | cut -d ':' -f2-6`
LAA=`echo $MAC | cut -d ':' -f1`
LAA=$((0x$LAA+2))
if [ $LAA -lt 16 ] ; then
LAA=`printf "%X\n" $LAA`
MACLAA=0$LAA:$MAC26
else
LAA=`printf "%X\n" $LAA`
MACLAA=$LAA:$MAC26
fi
sed "s/00:50:43:00:00:00/$MAC/" config/wifidirect.conf > tmp$$
mv tmp$$ config/wifidirect.conf
sed "s/02:50:43:00:00:00/$MACLAA/" config/wifidirect.conf > tmp$$
mv tmp$$ config/wifidirect.conf