mirror of
https://github.com/drasko/open-ameba.git
synced 2024-11-21 13:34:17 +00:00
first commit
This commit is contained in:
parent
2ee525362e
commit
d108756e9b
792 changed files with 336059 additions and 0 deletions
973
.cproject
Normal file
973
.cproject
Normal file
|
@ -0,0 +1,973 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||||
|
<macros>
|
||||||
|
<stringMacro name="ProjSDK" type="VALUE_TEXT" value="RTL00_SDKV35a"/>
|
||||||
|
</macros>
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="default Makefile" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.exe.debug">
|
||||||
|
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404." name="/" resourcePath="">
|
||||||
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.288622836" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1378006318" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.829811693" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix" value="arm-none-eabi-" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix.340953338" name="Suffix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.1881808200" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c" value="gcc" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.1575778284" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp" value="g++" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.352708376" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar" value="ar" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.2022992880" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy" value="objcopy" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.1165596750" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump" value="objdump" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.1424938245" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size" value="size" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.1178667540" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make" value="make" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.352113456" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm" value="rm" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath.717194910" name="Use global path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path.330006680" name="Path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1355782894" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.1217652270" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.567065326" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.481156355" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m3" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.523822563" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.1935690412" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.thumb" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork.1112695459" name="Thumb interwork (-mthumb-interwork)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness.1279725395" name="Endianness" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.406729192" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.696330314" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess.1993592845" name="Unaligned access" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family.1684279663" name="AArch64 family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc.1194142030" name="Feature crc" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto.1676576354" name="Feature crypto" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp.779285692" name="Feature fp" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd.329424470" name="Feature simd" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel.52122821" name="Code model" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign.143067804" name="Strict align (-mstrict-align)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.1650172779" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1995924900" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.540086527" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1134954409" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.891002678" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.1462618410" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon.1502805699" name="No common unitialized (-fno-common)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions.489484821" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding.288487298" name="Assume freestanding environment (-ffreestanding)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin.1279479150" name="Disable builtin (-fno-builtin)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant.1026066769" name="Single precision constants (-fsingle-precision-constant)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC.1334719698" name="Position independent code (-fPIC)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto.660582564" name="Link-time optimizer (-flto)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants.1426487277" name="Disable loop invariant move (-fno-move-loop-invariants)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other.1971719971" name="Other optimization flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.2013893568" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly.1293433935" name="Check syntax only (-fsyntax-only)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic.586569514" name="Pedantic (-pedantic)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors.1098067866" name="Pedantic warnings as errors (-pedantic-errors)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.1358560314" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused.84941636" name="Warn on various unused elements (-Wunused)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized.1774490719" name="Warn on uninitialized variables (-Wuninitialised)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.824848678" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.13235635" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.2098345604" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.2090284278" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.569308145" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.196823967" name="Warn if padding is included (-Wpadded)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.1295955369" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.799670807" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.251337410" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.1653200215" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.2052940896" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other.1870461853" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1201133808" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.2039694665" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof.1137517500" name="Generate prof information (-p)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof.494604134" name="Generate gprof information (-pg)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.378060659" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1171651449" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
|
||||||
|
<builder arguments="-s" buildPath="${workspace_loc:/${ProjName}/project/realtek_ameba1_va0_example/GCC-RELEASE}" command="mingw32-make.exe" enableAutoBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1928881956" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1867136583" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.803936844" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1206727361" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1390387922" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.19053491" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="CONFIG_PLATFORM_8195A"/>
|
||||||
|
<listOptionValue builtIn="false" value="GCC_ARMCM3"/>
|
||||||
|
<listOptionValue builtIn="false" value="ARDUINO_SDK"/>
|
||||||
|
<listOptionValue builtIn="false" value="M3"/>
|
||||||
|
<listOptionValue builtIn="false" value="F_CPU=166666666L"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1624349386" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1640084941" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.200080958" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="CONFIG_PLATFORM_8195A"/>
|
||||||
|
<listOptionValue builtIn="false" value="GCC_ARMCM3"/>
|
||||||
|
<listOptionValue builtIn="false" value="ARDUINO_SDK"/>
|
||||||
|
<listOptionValue builtIn="false" value="M3"/>
|
||||||
|
<listOptionValue builtIn="false" value="F_CPU=166666666L"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.421691648" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1126132436" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.1106277337" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.714231139" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.978736090" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" value="true" valueType="boolean"/>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.1430020536" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.818134961" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.798774812" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.1234603622" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.81472388" name="Display source (--source|-S)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders.193012888" name="Display all headers (--all-headers|-x)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle.976059339" name="Demangle names (--demangle|-C)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers.1492594993" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide.1056294869" name="Wide lines (--wide|-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide" value="true" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.250341025" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format.459793684" name="Size format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry excluding="RTL00_SDKV35a/project|project/realtek_ameba1_va0_example/disasm_to_c_boot|component/soc/realtek/8195a/misc/gcc_utility|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_1.c|component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F|doc|project/realtek_ameba1_va0_example/example_sources|build|project/realtek_ameba1_va0_example/GCC-RELEASE|component/common/network/lwip/lwip_v1.5.0.beta|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_4.c|component1|component/common/network/lwip/lwip_v1.3.2|flasher|component/os/freertos/freertos_v8.1.2/Source/portable/IAR|component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3_MPU|component/common/network/lwip/lwip_v1.4.1/port/stm32f2x7|component/os/freertos/freertos_v8.1.2/Demo|component/os/freertos/freertos_v8.1.2/Source/portable/RVDS|component/soc/realtek/8195a/misc/iar_utility|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_3.c|tools|component/common/network/ssl/polarssl-1.3.8/ssl_self_test.c|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_2.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
<storageModule moduleId="ilg.gnuarmeclipse.managedbuild.packs"/>
|
||||||
|
</cconfiguration>
|
||||||
|
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.510381534">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.510381534" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||||
|
<macros>
|
||||||
|
<stringMacro name="ProjSDK" type="VALUE_TEXT" value="RTL00_SDKV35a"/>
|
||||||
|
</macros>
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="main Makefile" id="cdt.managedbuild.config.gnu.mingw.exe.release.510381534" name="Release" parent="cdt.managedbuild.config.gnu.mingw.exe.release">
|
||||||
|
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.510381534." name="/" resourcePath="">
|
||||||
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1331669481" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1386009229" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.906264076" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix" value="arm-none-eabi-" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix.1737103952" name="Suffix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.352021196" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c" value="gcc" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.2017644748" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp" value="g++" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1613005810" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar" value="ar" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.8514861" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy" value="objcopy" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.999950947" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump" value="objdump" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.1837512864" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size" value="size" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.589946620" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make" value="make" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.196123759" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm" value="rm" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath.512925197" name="Use global path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path.1528855341" name="Path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1306771897" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.1287237101" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1033045697" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.1018189258" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m3" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.678030981" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.136379804" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.thumb" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork.1373754919" name="Thumb interwork (-mthumb-interwork)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness.1465940463" name="Endianness" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.2112266715" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.407311370" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess.695664951" name="Unaligned access" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family.202710632" name="AArch64 family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc.242497342" name="Feature crc" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto.1974531914" name="Feature crypto" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp.660200968" name="Feature fp" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd.1233244294" name="Feature simd" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel.498121486" name="Code model" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign.952900779" name="Strict align (-mstrict-align)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.475866598" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.2088084120" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.263056684" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1662221277" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1484887886" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.523628101" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon.774354347" name="No common unitialized (-fno-common)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions.1488698260" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding.2009610250" name="Assume freestanding environment (-ffreestanding)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin.2046819055" name="Disable builtin (-fno-builtin)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant.1845401859" name="Single precision constants (-fsingle-precision-constant)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC.1248248517" name="Position independent code (-fPIC)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto.1064738650" name="Link-time optimizer (-flto)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants.1963895652" name="Disable loop invariant move (-fno-move-loop-invariants)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other.1363033731" name="Other optimization flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.827986487" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly.931408380" name="Check syntax only (-fsyntax-only)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic.1092080308" name="Pedantic (-pedantic)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors.1010696628" name="Pedantic warnings as errors (-pedantic-errors)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.760232272" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused.1728302009" name="Warn on various unused elements (-Wunused)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized.1930131691" name="Warn on uninitialized variables (-Wuninitialised)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1156648663" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.672901268" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.1994589092" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.123169426" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.826765932" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.156607791" name="Warn if padding is included (-Wpadded)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.1351684514" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.1949187882" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1895179507" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.2051998707" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.821418437" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other.2067172410" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1941097436" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.30653585" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof.1627791721" name="Generate prof information (-p)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof.977946526" name="Generate gprof information (-pg)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.70094073" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1505237487" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
|
||||||
|
<builder arguments="-s" buildPath="${workspace_loc:/${ProjName}}" command="mingw32-make.exe" id="ilg.gnuarmeclipse.managedbuild.cross.builder.599629164" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="false" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder">
|
||||||
|
<outputEntries>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name=""/>
|
||||||
|
</outputEntries>
|
||||||
|
</builder>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.986275098" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1946659190" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1118688937" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths"/>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.722165562" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.15138288" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1349310488" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="CONFIG_PLATFORM_8195A"/>
|
||||||
|
<listOptionValue builtIn="false" value="GCC_ARMCM3"/>
|
||||||
|
<listOptionValue builtIn="false" value="ARDUINO_SDK"/>
|
||||||
|
<listOptionValue builtIn="false" value="M3"/>
|
||||||
|
<listOptionValue builtIn="false" value="F_CPU=166666666L"/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.1191413676" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/common/bsp}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/os_dep/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/driver}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/network/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/platform}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi/rtw_wpa_supplicant/src}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/iotdemokit}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/google}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/framework}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example/wlan_fast_connect}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal_ext}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/targets/hal/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/lwip}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/ipv4}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/test}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/rtl_std_lib/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/osdep}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hci}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal/OUTSRC}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/wlan/realtek/wlan_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/polarssl-1.3.8/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/ssl_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/utilities}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/Curve25519}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/GladmanAES}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/codec}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/host/uvc/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device/class}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs/r0.10c/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/sdio/realtek/sdio_host/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/audio}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/i2s}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/xmodem}""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1929075018" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1154716753" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.2100617784" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="CONFIG_PLATFORM_8195A"/>
|
||||||
|
<listOptionValue builtIn="false" value="GCC_ARMCM3"/>
|
||||||
|
<listOptionValue builtIn="false" value="ARDUINO_SDK"/>
|
||||||
|
<listOptionValue builtIn="false" value="M3"/>
|
||||||
|
<listOptionValue builtIn="false" value="F_CPU=166666666L"/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.1414265452" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/common/bsp}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/os_dep/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/driver}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/network/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/platform}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi/rtw_wpa_supplicant/src}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/iotdemokit}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/google}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/framework}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example/wlan_fast_connect}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal_ext}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/targets/hal/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/lwip}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/ipv4}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/test}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/rtl_std_lib/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/osdep}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hci}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal/OUTSRC}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/wlan/realtek/wlan_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/polarssl-1.3.8/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/ssl_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/utilities}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/Curve25519}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/GladmanAES}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/codec}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/host/uvc/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device/class}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs/r0.10c/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/sdio/realtek/sdio_host/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/audio}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/i2s}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/xmodem}""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.188668818" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1097868112" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.1171742405" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.2087397299" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.1436328271" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths.1921114810" name="Library search path (-L)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.libs.2034197567" name="Libraries (-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.libs"/>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.76050363" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.352595454" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.702099759" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.1993138551" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.538816325" name="Display source (--source|-S)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders.997591536" name="Display all headers (--all-headers|-x)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle.1337830561" name="Demangle names (--demangle|-C)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers.211879144" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide.1093890381" name="Wide lines (--wide|-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide" value="true" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.892122898" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format.145710658" name="Size format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.510381534.229944589" name="/" resourcePath="RTL00_SDKV35a">
|
||||||
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1070877287" name="Cross ARM GCC" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base" unusedChildren="">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1386009229.66403643" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1386009229"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.906264076.1427666078" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.906264076"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix.1737103952.912406400" name="Suffix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix.1737103952"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.352021196.1017071953" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.352021196"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.2017644748.36643021" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.2017644748"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1613005810.1016231209" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.1613005810"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.8514861.1470941810" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.8514861"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.999950947.1947200071" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.999950947"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.1837512864.1038400629" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.1837512864"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.589946620.1407198692" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.589946620"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.196123759.156281879" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.196123759"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath.512925197.795211669" name="Use global path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath.512925197"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path.1528855341.1888314690" name="Path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path.1528855341"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1306771897.540825015" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1306771897"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.1287237101.272965199" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.1287237101"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1033045697.339166740" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.1033045697"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.1018189258.960110149" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.1018189258"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.678030981.1454173278" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.678030981"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.136379804.1871672396" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.136379804"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork.1373754919.1145747368" name="Thumb interwork (-mthumb-interwork)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork.1373754919"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness.1465940463.998461428" name="Endianness" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness.1465940463"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.2112266715.1678261187" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.2112266715"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.407311370.1989193795" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.407311370"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess.695664951.819280041" name="Unaligned access" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess.695664951"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family.202710632.1227421049" name="AArch64 family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family.202710632"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc.242497342.571905358" name="Feature crc" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc.242497342"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto.1974531914.1549839989" name="Feature crypto" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto.1974531914"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp.660200968.1605824599" name="Feature fp" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp.660200968"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd.1233244294.141710043" name="Feature simd" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd.1233244294"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel.498121486.1393644620" name="Code model" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel.498121486"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign.952900779.264394554" name="Strict align (-mstrict-align)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign.952900779"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.475866598.1032154005" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.475866598"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.2088084120.496829682" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.2088084120"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.263056684.1796048106" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.263056684"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1662221277.1894480632" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1662221277"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1484887886.814430096" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1484887886"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.523628101.1798914718" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.523628101"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon.774354347.1995679856" name="No common unitialized (-fno-common)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon.774354347"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions.1488698260.144272999" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions.1488698260"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding.2009610250.183357583" name="Assume freestanding environment (-ffreestanding)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding.2009610250"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin.2046819055.520138278" name="Disable builtin (-fno-builtin)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin.2046819055"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant.1845401859.2353114" name="Single precision constants (-fsingle-precision-constant)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant.1845401859"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC.1248248517.169706172" name="Position independent code (-fPIC)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC.1248248517"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto.1064738650.159643828" name="Link-time optimizer (-flto)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto.1064738650"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants.1963895652.1392148469" name="Disable loop invariant move (-fno-move-loop-invariants)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants.1963895652"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other.1363033731.962644856" name="Other optimization flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other.1363033731"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.827986487.1521277532" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.827986487"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly.931408380.1287183253" name="Check syntax only (-fsyntax-only)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly.931408380"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic.1092080308.101535841" name="Pedantic (-pedantic)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic.1092080308"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors.1010696628.611132965" name="Pedantic warnings as errors (-pedantic-errors)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors.1010696628"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.760232272.1621118066" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.760232272"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused.1728302009.2003501753" name="Warn on various unused elements (-Wunused)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused.1728302009"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized.1930131691.711994977" name="Warn on uninitialized variables (-Wuninitialised)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized.1930131691"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1156648663.229813352" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1156648663"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.672901268.723923306" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.672901268"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.1994589092.1209485670" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.1994589092"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.123169426.1954204806" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.123169426"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.826765932.335308619" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.826765932"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.156607791.1982350979" name="Warn if padding is included (-Wpadded)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.156607791"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.1351684514.211841066" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.1351684514"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.1949187882.1769280254" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.1949187882"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1895179507.250880478" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1895179507"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.2051998707.636581538" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.2051998707"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.821418437.155869018" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.821418437"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other.2067172410.400567785" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other.2067172410"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1941097436.632840437" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.1941097436"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.30653585.1170114952" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.30653585"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof.1627791721.1436404427" name="Generate prof information (-p)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof.1627791721"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof.977946526.1412845431" name="Generate gprof information (-pg)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof.977946526"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.70094073.566509087" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.70094073"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1622564502" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.986275098">
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1333644780" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1473679944" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.15138288">
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1737601197" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1449200561" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1154716753">
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.262090898" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.135995649" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.1097868112"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.1771072208" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.2087397299"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.1545746413" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.352595454"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.849146699" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.702099759"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.1129147248" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.1993138551"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1718658696" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.892122898"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry excluding="RTL00_SDKV35a|${ProjSDK}|project/realtek_ameba1_va0_example/disasm_to_c_boot|component/soc/realtek/8195a/misc/gcc_utility|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_1.c|component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F|doc|project/realtek_ameba1_va0_example/example_sources|build|project/realtek_ameba1_va0_example/GCC-RELEASE|component/common/network/lwip/lwip_v1.5.0.beta|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_4.c|component1|component/common/network/lwip/lwip_v1.3.2|flasher|component/os/freertos/freertos_v8.1.2/Source/portable/IAR|component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3_MPU|component/common/network/lwip/lwip_v1.4.1/port/stm32f2x7|component/os/freertos/freertos_v8.1.2/Demo|component/os/freertos/freertos_v8.1.2/Source/portable/RVDS|component/soc/realtek/8195a/misc/iar_utility|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_3.c|tools|component/common/network/ssl/polarssl-1.3.8/ssl_self_test.c|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_2.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/>
|
||||||
|
<entry excluding=".git/|.settings/|AutoMake/|build/|flasher/|LibAutoMake/|project/" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="RTL00_SDKV35a"/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
<storageModule moduleId="ilg.gnuarmeclipse.managedbuild.packs"/>
|
||||||
|
</cconfiguration>
|
||||||
|
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235" moduleId="org.eclipse.cdt.core.settings" name="AutoMake">
|
||||||
|
<macros>
|
||||||
|
<stringMacro name="ProjSDK" type="VALUE_TEXT" value="RTL00_SDKV35a"/>
|
||||||
|
</macros>
|
||||||
|
<externalSettings>
|
||||||
|
<externalSetting/>
|
||||||
|
</externalSettings>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactExtension="axf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="Eclipse Makefile" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235" name="AutoMake" parent="cdt.managedbuild.config.gnu.mingw.exe.debug" postannouncebuildStep="Gen bins files" postbuildStep="mingw32-make.exe -f ../flasher.mk copybin1 genbin23 OBJ_DIR=. BIN_DIR=. TARGET=${ProjName} BOOTS=../../${ProjSDK}/component/soc/realtek/8195a/misc/bsp/image FLASHER_PATH=../../${ProjSDK}/flasher/ TOOLS_PATH=../../${ProjSDK}/component/soc/realtek/8195a/misc/iar_utility/common/tools/" preannouncebuildStep="" prebuildStep="">
|
||||||
|
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235." name="/" resourcePath="">
|
||||||
|
<toolChain id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.820810393" name="Cross ARM GCC" nonInternalBuilderId="ilg.gnuarmeclipse.managedbuild.cross.builder" superClass="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.1532421903" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix.1247796277" name="Prefix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.prefix" value="arm-none-eabi-" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix.1109094786" name="Suffix" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.suffix"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.c.1693842570" name="C compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.c" value="gcc" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp.368037455" name="C++ compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.cpp" value="g++" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar.548129980" name="Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.ar" value="ar" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy.928892842" name="Hex/Bin converter" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objcopy" value="objcopy" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump.2049305935" name="Listing generator" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.objdump" value="objdump" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.size.1590831374" name="Size command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.size" value="size" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.make.778372793" name="Build command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.make" value="make" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm.1982036737" name="Remove command" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.command.rm" value="rm" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath.1087893518" name="Use global path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.useglobalpath"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path.358350159" name="Path" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.path"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash.1471634859" name="Create flash image" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createflash" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting.829775475" name="Create extended listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.createlisting"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize.687052112" name="Print size" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.addtools.printsize" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family.229064670" name="ARM family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-m3" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture.1274871685" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.architecture"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.1753705938" name="Instruction set" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.instructionset.thumb" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork.1185454201" name="Thumb interwork (-mthumb-interwork)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.thumbinterwork"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness.344831861" name="Endianness" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.endianness"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi.1494945194" name="Float ABI" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.abi"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit.1430475206" name="FPU Type" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.fpu.unit"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess.761494227" name="Unaligned access" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.unalignedaccess"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family.236324706" name="AArch64 family" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.family"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc.691118581" name="Feature crc" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crc"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto.512340533" name="Feature crypto" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.crypto"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp.1818141507" name="Feature fp" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.fp"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd.552088394" name="Feature simd" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.feature.simd"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel.629831365" name="Code model" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.cmodel"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign.142677767" name="Strict align (-mstrict-align)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.aarch64.target.strictalign"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.338451914" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.1847621316" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level" value="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.size" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.950065296" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar.1565579932" name="'char' is signed (-fsigned-char)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.signedchar" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections.1637733419" name="Function sections (-ffunction-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.functionsections" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections.388135605" name="Data sections (-fdata-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.datasections" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon.929521784" name="No common unitialized (-fno-common)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nocommon" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions.484841655" name="Do not inline functions (-fno-inline-functions)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.noinlinefunctions"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding.1365456256" name="Assume freestanding environment (-ffreestanding)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.freestanding"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin.247659415" name="Disable builtin (-fno-builtin)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nobuiltin"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant.291097667" name="Single precision constants (-fsingle-precision-constant)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.spconstant"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC.1612856597" name="Position independent code (-fPIC)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.PIC" value="false" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto.229971232" name="Link-time optimizer (-flto)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.lto"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants.1314126454" name="Disable loop invariant move (-fno-move-loop-invariants)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.nomoveloopinvariants"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other.1587251749" name="Other optimization flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.other" value="-fomit-frame-pointer -fno-short-enums" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.670995525" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly.1518733381" name="Check syntax only (-fsyntax-only)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.syntaxonly"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic.2117575855" name="Pedantic (-pedantic)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedantic"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors.1841301234" name="Pedantic warnings as errors (-pedantic-errors)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pedanticerrors"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn.520559357" name="Inhibit all warnings (-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.nowarn" value="false" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused.2106052794" name="Warn on various unused elements (-Wunused)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unused"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized.1355578963" name="Warn on uninitialized variables (-Wuninitialised)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.uninitialized"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn.1541255076" name="Enable all common warnings (-Wall)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.allwarn" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn.1821835269" name="Enable extra warnings (-Wextra)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.extrawarn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration.1796379869" name="Warn on undeclared global function (-Wmissing-declaration)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.missingdeclaration"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion.2029727081" name="Warn on implicit conversions (-Wconversion)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.conversion"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.497097090" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.351178826" name="Warn if padding is included (-Wpadded)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow.634040430" name="Warn if shadowed variable (-Wshadow)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.shadow"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.1097249106" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.966690400" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.2062311727" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors.1498403655" name="Generate errors instead of warnings (-Werror)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.toerrors"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other.1807832307" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.other" value="-Wno-pointer-sign" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.663173283" name="Debug level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level" value="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.level.max" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format.1951797542" name="Debug format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.format"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof.720255162" name="Generate prof information (-p)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.prof"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof.1451219900" name="Generate gprof information (-pg)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.gprof"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.120412298" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.656329034" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
|
||||||
|
<builder arguments="-s" autoBuildTarget="all" buildPath="${workspace_loc:/rtl00TstMinAmebaV35a}/AutoMake" cleanBuildTarget="clean" command="mingw32-make.exe" id="org.eclipse.cdt.build.core.internal.builder.697587574" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1889114087" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.527575306" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1893189760" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/RTL00_SDKV35a}""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1712176846" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.119146776" name="Cross ARM C Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths.2057322667" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/RTL00_SDKV35a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/src/mad}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/common/bsp}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/os_dep/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/driver}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/network/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/platform}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi/rtw_wpa_supplicant/src}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/iotdemokit}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/google}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/framework}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example/wlan_fast_connect}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal_ext}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/targets/hal/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/lwip}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/ipv4}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/test}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/rtl_std_lib/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/osdep}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hci}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal/OUTSRC}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/wlan/realtek/wlan_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/polarssl-1.3.8/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/ssl_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/utilities}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/Curve25519}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/GladmanAES}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/codec}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/host/uvc/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device/class}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs/r0.10c/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/sdio/realtek/sdio_host/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/audio}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/i2s}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/xmodem}""/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.871229625" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="CONFIG_PLATFORM_8195A"/>
|
||||||
|
<listOptionValue builtIn="false" value="GCC_ARMCM3"/>
|
||||||
|
<listOptionValue builtIn="false" value="ARDUINO_SDK"/>
|
||||||
|
<listOptionValue builtIn="false" value="M3"/>
|
||||||
|
<listOptionValue builtIn="false" value="F_CPU=166666666L"/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.1097260516" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.default" valueType="enumerated"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other.1918788929" name="Other compiler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other" useByScannerDiscovery="true" value="-fsigned-char -Wno-pointer-sign -fno-common -fomit-frame-pointer -fno-short-enums" valueType="string"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.otherwarnings.1397843782" name="Other warning flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.otherwarnings" useByScannerDiscovery="true" value="-Wno-pointer-sign" valueType="string"/>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1036286501" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1725581254" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths.622689061" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/RTL00_SDKV35a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/inc/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/project/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/common/bsp}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/os/os_dep/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/driver}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/network/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/platform}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/api/wifi/rtw_wpa_supplicant/src}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/iotdemokit}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/google}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/framework}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/example/wlan_fast_connect}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/api}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/hal_ext}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/mbed/targets/hal/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/lwip}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/src/include/ipv4}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/lwip/lwip_v1.4.1/port/realtek}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/test}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/cmsis/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/rtl8195a}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/rtl_std_lib/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/osdep}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hci}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/wlan/realtek/src/hal/OUTSRC}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/wlan/realtek/wlan_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/polarssl-1.3.8/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/network/ssl/ssl_ram_map/rom}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/utilities}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/Curve25519}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/apple/WACServer/External/GladmanAES}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/media/codec}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/host/uvc/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/usb_class/device/class}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/file_system/fatfs/r0.10c/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/sdio/realtek/sdio_host/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/audio}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/drivers/i2s}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/common/application/xmodem}""/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1034580488" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="CONFIG_PLATFORM_8195A"/>
|
||||||
|
<listOptionValue builtIn="false" value="GCC_ARMCM3"/>
|
||||||
|
<listOptionValue builtIn="false" value="ARDUINO_SDK"/>
|
||||||
|
<listOptionValue builtIn="false" value="M3"/>
|
||||||
|
<listOptionValue builtIn="false" value="F_CPU=166666666L"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1413280155" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker.2073509096" name="Cross ARM C Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.linker">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections.1330221263" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.gcsections" value="true" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool command="arm-none-eabi-gcc" id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.367171641" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.libs.1271016801" name="Libraries (-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.libs" valueType="libs">
|
||||||
|
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="_platform_new"/>
|
||||||
|
<listOptionValue builtIn="false" value="_wlan"/>
|
||||||
|
<listOptionValue builtIn="false" value="_p2p"/>
|
||||||
|
<listOptionValue builtIn="false" value="_wps"/>
|
||||||
|
<listOptionValue builtIn="false" value="_rtlstd"/>
|
||||||
|
<listOptionValue builtIn="false" value="_websocket"/>
|
||||||
|
<listOptionValue builtIn="false" value="_xmodem"/>
|
||||||
|
<listOptionValue builtIn="false" value="m"/>
|
||||||
|
<listOptionValue builtIn="false" value="c"/>
|
||||||
|
<listOptionValue builtIn="false" value="nosys"/>
|
||||||
|
<listOptionValue builtIn="false" value="gcc"/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths.317142608" name="Library search path (-L)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.paths" valueType="libPaths">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/RTL00_SDKV35a/LibAutoMake}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjSDK}/component/soc/realtek/8195a/misc/bsp/lib/common/GCC}""/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections.111439063" name="Remove unused sections (-Xlinker --gc-sections)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.gcsections" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano.1329248724" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile.1284968374" name="Script files (-T)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.scriptfile" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="rlx8195A-symbol-v03-img2.ld"/>
|
||||||
|
</option>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nostart.1476094258" name="Do not use standard start files (-nostartfiles)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nostart" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nodeflibs.2076626840" name="Do not use default libraries (-nodefaultlibs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nodeflibs" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nostdlibs.1865632827" name="No startup or default libs (-nostdlib)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.nostdlibs" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.other.1946658101" name="Other linker flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.other" value="-mcpu=cortex-m3 -mthumb -g -Os -Wl,--gc-sections -Wl,--cref -Wl,--entry=Reset_Handler -Wl,--no-enum-size-warning -Wl,--no-wchar-size-warning" valueType="string"/>
|
||||||
|
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.196423171" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.311737518" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash.1878502371" name="Cross ARM GNU Create Flash Image" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createflash"/>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting.1243114149" name="Cross ARM GNU Create Listing" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.createlisting">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.1892656289" name="Display source (--source|-S)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders.1427543789" name="Display all headers (--all-headers|-x)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.allheaders" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle.1923228436" name="Demangle names (--demangle|-C)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.demangle" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers.1957054986" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.linenumbers" value="true" valueType="boolean"/>
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide.2086194051" name="Wide lines (--wide|-w)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.wide" value="true" valueType="boolean"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize.1851158034" name="Cross ARM GNU Print Size" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.printsize">
|
||||||
|
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format.1717049342" name="Size format" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.printsize.format"/>
|
||||||
|
</tool>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry excluding="RTL00_SDKV35a/project|project/realtek_ameba1_va0_example/disasm_to_c_boot|component/soc/realtek/8195a/misc/gcc_utility|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_1.c|component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F|doc|project/realtek_ameba1_va0_example/example_sources|build|project/realtek_ameba1_va0_example/GCC-RELEASE|component/common/network/lwip/lwip_v1.5.0.beta|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_4.c|component1|component/common/network/lwip/lwip_v1.3.2|flasher|component/os/freertos/freertos_v8.1.2/Source/portable/IAR|component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3_MPU|component/common/network/lwip/lwip_v1.4.1/port/stm32f2x7|component/os/freertos/freertos_v8.1.2/Demo|component/os/freertos/freertos_v8.1.2/Source/portable/RVDS|component/soc/realtek/8195a/misc/iar_utility|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_3.c|tools|component/common/network/ssl/polarssl-1.3.8/ssl_self_test.c|component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_2.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
|
||||||
|
<externalSettings containerId="RTL00_SDKV35a;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.1893880750" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">
|
||||||
|
<externalSetting>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/RTL00_SDKV35a"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/RTL00_SDKV35a/LibAutoMake"/>
|
||||||
|
<entry flags="RESOLVED" kind="libraryFile" name="RTL00_SDKV35a" srcPrefixMapping="" srcRootPath=""/>
|
||||||
|
</externalSetting>
|
||||||
|
</externalSettings>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="ilg.gnuarmeclipse.managedbuild.packs"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="sdk-ameba-rtl8710af-v3.5a_without_NDA_GCC_V1.0.0.cdt.managedbuild.target.gnu.mingw.exe.478591374" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||||
|
<configuration configurationName="Multiple configurations">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/sdk-ameba-rtl8710af-v3.5a_without_NDA_GCC_V1.0.0"/>
|
||||||
|
</configuration>
|
||||||
|
<configuration configurationName="AutoMake">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/RTL00_SDKV35a"/>
|
||||||
|
</configuration>
|
||||||
|
<configuration configurationName="Debug"/>
|
||||||
|
<configuration configurationName="Release">
|
||||||
|
<resource resourceType="PROJECT" workspacePath="/RTL00_SDKV35a"/>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1640084941;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.421691648">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1725581254;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1413280155">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.119146776;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1036286501">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1328486011;cdt.managedbuild.tool.gnu.c.compiler.input.1770660294">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1390387922;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1624349386">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.450606865;cdt.managedbuild.tool.gnu.c.compiler.input.1191704832">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1871560757;cdt.managedbuild.tool.gnu.cpp.compiler.input.1539036791">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.117920953;cdt.managedbuild.tool.gnu.cpp.compiler.input.919033704">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1154716753;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.188668818">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.788201990;cdt.managedbuild.tool.gnu.cpp.compiler.input.399931222">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.15138288;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1929075018">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.128381215;cdt.managedbuild.tool.gnu.c.compiler.input.793217918">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||||
|
<buildTargets>
|
||||||
|
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>mingw32-make.exe</buildCommand>
|
||||||
|
<buildArguments>-s -j6</buildArguments>
|
||||||
|
<buildTarget>all</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>clean</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="flashburn" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>flashburn</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="reset" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>reset</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="test" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>test</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="readfullflash" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>mingw32-make.exe</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>readfullflash</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="debug" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>mingw32-make.exe</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>debug</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="flash" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>mingw32-make.exe</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>flash</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="ramdebug" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>mingw32-make.exe</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>ramdebug</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="runram" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>mingw32-make.exe</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>runram</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
<target name="mp" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>mingw32-make.exe</buildCommand>
|
||||||
|
<buildArguments>-s</buildArguments>
|
||||||
|
<buildTarget>mp</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>false</runAllBuilders>
|
||||||
|
</target>
|
||||||
|
</buildTargets>
|
||||||
|
</storageModule>
|
||||||
|
</cproject>
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/AutoMake/
|
118
.project
Normal file
118
.project
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>RTL00MP3</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
<project>RTL00_SDKV35a</project>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
</natures>
|
||||||
|
<linkedResources>
|
||||||
|
<link>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>2</type>
|
||||||
|
<locationURI>PARENT-1-PROJECT_LOC/RTL00_SDKV35a</locationURI>
|
||||||
|
</link>
|
||||||
|
</linkedResources>
|
||||||
|
<filteredResources>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640799</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>5</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-*.h</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640809</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>5</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-*.c</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640809</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-AutoMake</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640809</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-build</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640819</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-flasher</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640819</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-LibAutoMake</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640829</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-project</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640829</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-.git</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
<filter>
|
||||||
|
<id>1477406640829</id>
|
||||||
|
<name>RTL00_SDKV35a</name>
|
||||||
|
<type>10</type>
|
||||||
|
<matcher>
|
||||||
|
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||||
|
<arguments>1.0-name-matches-false-false-.settings</arguments>
|
||||||
|
</matcher>
|
||||||
|
</filter>
|
||||||
|
</filteredResources>
|
||||||
|
</projectDescription>
|
3
.settings/ilg.gnuarmeclipse.managedbuild.cross.prefs
Normal file
3
.settings/ilg.gnuarmeclipse.managedbuild.cross.prefs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
buildTools.path=D\:\\MCU\\GNU_Tools_ARM_Embedded\\5.4_2016q2\\bin
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
toolchain.path.1287942917=D\:\\MCU\\GNU_Tools_ARM_Embedded\\5.4_2016q2\\
|
36
.settings/language.settings.xml
Normal file
36
.settings/language.settings.xml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<project>
|
||||||
|
<configuration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404" name="Debug">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1001032304453773253" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
<configuration id="cdt.managedbuild.config.gnu.mingw.exe.release.510381534" name="Release">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1001032304453773253" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
<configuration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235" name="AutoMake">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-927373990012451590" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
67
.settings/org.eclipse.cdt.codan.core.prefs
Normal file
67
.settings/org.eclipse.cdt.codan.core.prefs
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
|
||||||
|
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
|
||||||
|
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
|
||||||
|
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.checkers.noreturn=Error
|
||||||
|
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
|
||||||
|
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
52
.settings/org.eclipse.cdt.core.prefs
Normal file
52
.settings/org.eclipse.cdt.core.prefs
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/MINGW_HOME/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/MINGW_HOME/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/MINGW_HOME/value=C\:\\MinGW
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/MSYS_HOME/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/MSYS_HOME/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/MSYS_HOME/value=C\:\\MinGW\\msys\\1.0
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/OCD_PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/OCD_PATH/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/OCD_PATH/value=D\:\\MCU\\OpenOCD\\bin
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/PATH/operation=replace
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/PATH/value=${TL_PATH}\\bin;${MINGW_HOME}\\mingw64\\bin;${MINGW_HOME}\\bin;${MSYS_HOME}\\bin;${OCD_PATH};C\:/Program Files (x86)/Java/jre1.8.0_101/bin/client;C\:/Program Files (x86)/Java/jre1.8.0_101/bin;C\:/Program Files (x86)/Java/jre1.8.0_101/lib/i386;C\:\\MinGW\\mingw64\\bin;C\:\\MinGW\\msys\\1.0\\bin;C\:\\MinGW\\bin;D\:\\MCU\\STMicroelectronics\\st_toolset\\asm;C\:\\Python27;C\:\\Utils\\FarUtils;C\:\\Utils\\FarUtils\\HIEW810;C\:\\Windows;C\:\\Windows\\system32;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0;D\:\\MCU\\Microchip\\xc32\\v1.42\\bin;D\:\\MCU\\Microchip\\mplabc30\\v3.31\\bin;D\:\\MCU\\Microchip\\MPLAB C32 Suite\\bin;D\:\\MCU\\Microchip\\mplabc32\\v1.12\\bin;D\:\\MCU\\Microchip\\mcc18\\mpasm;D\:\\MCU\\Microchip\\mcc18\\bin;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\binC\:\\Program Files (x86)\\Git\\cmd;C\:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C\:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C\:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C\:\\Program Files (x86)\\Common Files\\Acronis\\SnapAPI;C\:\\Program Files (x86)\\Windows Live\\Shared;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit;C\:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn;C\:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn;C\:\\Program Files\\Microsoft DNX\\Dnvm;C\:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\X86\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\X86\\bin;C\:\\Users\\PVV\\.dnx\\bin;C\:\\ProgramData\\chocolatey\\bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\QuickTime\\QTSystem;C\:\\Program Files\\nodejs;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\bin;C\:\\Program Files (x86)\\Git\\cmd;D\:\\MentorGraphics\\Sourcery_CodeBench_Lite_for_MIPS_ELF\\bin;C\:\\Eclipse
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/TL_PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/TL_PATH/operation=replace
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\5.4_2016q2
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/append=true
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/appendContributed=true
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/MINGW_HOME/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/MINGW_HOME/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/MINGW_HOME/value=C\:\\MinGW
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/MSYS_HOME/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/MSYS_HOME/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/MSYS_HOME/value=C\:\\MinGW\\msys\\1.0
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/OCD_PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/OCD_PATH/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/OCD_PATH/value=D\:\\MCU\\OpenOCD\\bin
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/PATH/operation=replace
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/PATH/value=${TL_PATH}\\bin;${MINGW_HOME}\\mingw64\\bin;${MINGW_HOME}\\bin;${MSYS_HOME}\\bin;${OCD_PATH};C\:/Program Files (x86)/Java/jre1.8.0_101/bin/client;C\:/Program Files (x86)/Java/jre1.8.0_101/bin;C\:/Program Files (x86)/Java/jre1.8.0_101/lib/i386;C\:\\MinGW\\mingw64\\bin;C\:\\MinGW\\msys\\1.0\\bin;C\:\\MinGW\\bin;D\:\\MCU\\STMicroelectronics\\st_toolset\\asm;C\:\\Python27;C\:\\Utils\\FarUtils;C\:\\Utils\\FarUtils\\HIEW810;C\:\\Windows;C\:\\Windows\\system32;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0;D\:\\MCU\\Microchip\\xc32\\v1.42\\bin;D\:\\MCU\\Microchip\\mplabc30\\v3.31\\bin;D\:\\MCU\\Microchip\\MPLAB C32 Suite\\bin;D\:\\MCU\\Microchip\\mplabc32\\v1.12\\bin;D\:\\MCU\\Microchip\\mcc18\\mpasm;D\:\\MCU\\Microchip\\mcc18\\bin;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\binC\:\\Program Files (x86)\\Git\\cmd;C\:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C\:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C\:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C\:\\Program Files (x86)\\Common Files\\Acronis\\SnapAPI;C\:\\Program Files (x86)\\Windows Live\\Shared;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit;C\:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn;C\:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn;C\:\\Program Files\\Microsoft DNX\\Dnvm;C\:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\X86\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\X86\\bin;C\:\\Users\\PVV\\.dnx\\bin;C\:\\ProgramData\\chocolatey\\bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\QuickTime\\QTSystem;C\:\\Program Files\\nodejs;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\bin;C\:\\Program Files (x86)\\Git\\cmd;D\:\\MentorGraphics\\Sourcery_CodeBench_Lite_for_MIPS_ELF\\bin;C\:\\Eclipse
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/TL_PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/TL_PATH/operation=replace
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\5.4_2016q2
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/append=true
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/appendContributed=true
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/MINGW_HOME/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/MINGW_HOME/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/MINGW_HOME/value=C\:\\MinGW
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/MSYS_HOME/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/MSYS_HOME/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/MSYS_HOME/value=C\:\\MinGW\\msys\\1.0
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/OCD_PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/OCD_PATH/operation=append
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/OCD_PATH/value=D\:\\MCU\\OpenOCD\\bin
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH/operation=replace
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH/value=${TL_PATH}\\bin;${MINGW_HOME}\\mingw64\\bin;${MINGW_HOME}\\bin;${MSYS_HOME}\\bin;${OCD_PATH};C\:/Program Files (x86)/Java/jre1.8.0_101/bin/client;C\:/Program Files (x86)/Java/jre1.8.0_101/bin;C\:/Program Files (x86)/Java/jre1.8.0_101/lib/i386;C\:\\MinGW\\mingw64\\bin;C\:\\MinGW\\msys\\1.0\\bin;C\:\\MinGW\\bin;D\:\\MCU\\STMicroelectronics\\st_toolset\\asm;C\:\\Python27;C\:\\Utils\\FarUtils;C\:\\Utils\\FarUtils\\HIEW810;C\:\\Windows;C\:\\Windows\\system32;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0;D\:\\MCU\\Microchip\\xc32\\v1.42\\bin;D\:\\MCU\\Microchip\\mplabc30\\v3.31\\bin;D\:\\MCU\\Microchip\\MPLAB C32 Suite\\bin;D\:\\MCU\\Microchip\\mplabc32\\v1.12\\bin;D\:\\MCU\\Microchip\\mcc18\\mpasm;D\:\\MCU\\Microchip\\mcc18\\bin;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\binC\:\\Program Files (x86)\\Git\\cmd;C\:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C\:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C\:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C\:\\Program Files (x86)\\Common Files\\Acronis\\SnapAPI;C\:\\Program Files (x86)\\Windows Live\\Shared;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit;C\:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn;C\:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn;C\:\\Program Files\\Microsoft DNX\\Dnvm;C\:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\X86\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\X86\\bin;C\:\\Users\\PVV\\.dnx\\bin;C\:\\ProgramData\\chocolatey\\bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\QuickTime\\QTSystem;C\:\\Program Files\\nodejs;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\bin;C\:\\Program Files (x86)\\Git\\cmd;D\:\\MentorGraphics\\Sourcery_CodeBench_Lite_for_MIPS_ELF\\bin;C\:\\Eclipse
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/TL_PATH/delimiter=;
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/TL_PATH/operation=replace
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\5.4_2016q2
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/append=true
|
||||||
|
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/appendContributed=true
|
25
.settings/org.eclipse.cdt.managedbuilder.core.prefs
Normal file
25
.settings/org.eclipse.cdt.managedbuilder.core.prefs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/CPATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/CPATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/CPLUS_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/CPLUS_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/C_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/C_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/append=true
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/appendContributed=true
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/CPATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/CPATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/CPLUS_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/CPLUS_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/C_INCLUDE_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/C_INCLUDE_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/append=true
|
||||||
|
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/appendContributed=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/LIBRARY_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/LIBRARY_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/append=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/appendContributed=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/LIBRARY_PATH/delimiter=;
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/LIBRARY_PATH/operation=remove
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/append=true
|
||||||
|
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/appendContributed=true
|
2
.settings/org.eclipse.core.resources.prefs
Normal file
2
.settings/org.eclipse.core.resources.prefs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
2
.settings/org.eclipse.ltk.core.refactoring.prefs
Normal file
2
.settings/org.eclipse.ltk.core.refactoring.prefs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
3
JLink-RTL00ConsoleROM.bat
Normal file
3
JLink-RTL00ConsoleROM.bat
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher\RTL00ConsoleROM.JLinkScript
|
3
JLink-RdFullFlash.bat
Normal file
3
JLink-RdFullFlash.bat
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher/RTL_FFlash.JLinkScript
|
3
JLink-Reset.bat
Normal file
3
JLink-Reset.bat
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 flasher\RTL_Reset.JLinkScript
|
3
JLink-RunRAM.bat
Normal file
3
JLink-RunRAM.bat
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher\RTL_RunRAM.JLinkScript
|
6
JLinkGDB-RdFullFlash.bat
Normal file
6
JLinkGDB-RdFullFlash.bat
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.2_2015q4\bin;D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 1000
|
||||||
|
arm-none-eabi-gdb.exe -x flasher/gdb_rdflash.jlink
|
||||||
|
taskkill /F /IM JLinkGDBServer.exe
|
||||||
|
|
15
JLinkGDB-RunRAM.bat
Normal file
15
JLinkGDB-RunRAM.bat
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.2_2015q4\bin;D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
@if exist build\obj\build.axf goto run
|
||||||
|
echo File 'build\obj\build.axf' not found!
|
||||||
|
echo Build project...
|
||||||
|
mingw32-make.exe -f Makefile all
|
||||||
|
@if not exist build\obj\build.axf goto err
|
||||||
|
:run
|
||||||
|
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 1000
|
||||||
|
arm-none-eabi-gdb.exe -x flasher/gdb_run_ram.jlink
|
||||||
|
taskkill /F /IM JLinkGDBServer.exe
|
||||||
|
goto end
|
||||||
|
:err
|
||||||
|
echo Error!
|
||||||
|
:end
|
18
JLinkGDB-WrFlash.bat
Normal file
18
JLinkGDB-WrFlash.bat
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.2_2015q4\bin;D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
@if not %1x==x goto xxx
|
||||||
|
set img_file=build/bin/ram_all.bin
|
||||||
|
:xxx
|
||||||
|
echo define call1>flasher/flash_file.jlink
|
||||||
|
echo SetFirwareSize %img_file%>>flasher/flash_file.jlink
|
||||||
|
echo end>>flasher/flash_file.jlink
|
||||||
|
echo define call2>>flasher/flash_file.jlink
|
||||||
|
echo FlasherWrite %img_file% 0 $Image1Size>>flasher/flash_file.jlink
|
||||||
|
echo end>>flasher/flash_file.jlink
|
||||||
|
echo define call3>>flasher/flash_file.jlink
|
||||||
|
echo FlasherWrite %img_file% $Image2Addr $Image2Size>>flasher/flash_file.jlink
|
||||||
|
echo end>>flasher/flash_file.jlink
|
||||||
|
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 3500
|
||||||
|
arm-none-eabi-gdb.exe -x flasher/gdb_wrflash.jlink build/bin/ram_all.bin
|
||||||
|
taskkill /F /IM JLinkGDBServer.exe
|
||||||
|
|
6
JLinkGDBServer.bat
Normal file
6
JLinkGDBServer.bat
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.2_2015q4\bin;D:\MCU\SEGGER\JLink_V610a;%PATH%
|
||||||
|
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 1000
|
||||||
|
arm-none-eabi-gdb.exe -x flasher/gdb_init.jlink
|
||||||
|
taskkill /F /IM JLinkGDBServer.exe
|
||||||
|
|
4
JlinkOpenOCD.bat
Normal file
4
JlinkOpenOCD.bat
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
@echo off
|
||||||
|
PATH=D:\MCU\OpenOCD;%PATH%
|
||||||
|
taskkill /F /IM openocd.exe
|
||||||
|
start openocd -f interface\Jlink.cfg -f flasher\ameba1.cfg
|
477
LICENSES
Normal file
477
LICENSES
Normal file
|
@ -0,0 +1,477 @@
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org/>
|
||||||
|
|
||||||
|
License component (LwIP 1.4.1):
|
||||||
|
|
||||||
|
Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
3. The name of the author may not be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
|
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
This file is part of the lwIP TCP/IP stack.
|
||||||
|
|
||||||
|
Author: Adam Dunkels <adam@sics.se>
|
||||||
|
|
||||||
|
|
||||||
|
License component (FreeRTOS 8.1.2):
|
||||||
|
|
||||||
|
The FreeRTOS source code is licensed by a *modified* GNU General Public
|
||||||
|
License (GPL). The modification is provided in the form of an exception.
|
||||||
|
|
||||||
|
NOTE: The modification to the GPL is included to allow you to distribute a
|
||||||
|
combined work that includes FreeRTOS without being obliged to provide the source
|
||||||
|
code for proprietary components outside of the FreeRTOS kernel.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
The FreeRTOS GPL Exception Text:
|
||||||
|
|
||||||
|
Any FreeRTOS source code, whether modified or in it's original release form,
|
||||||
|
or whether in whole or in part, can only be distributed by you under the terms
|
||||||
|
of the GNU General Public License plus this exception. An independent module is
|
||||||
|
a module which is not derived from or based on FreeRTOS.
|
||||||
|
|
||||||
|
Clause 1:
|
||||||
|
|
||||||
|
Linking FreeRTOS statically or dynamically with other modules is making a
|
||||||
|
combined work based on FreeRTOS. Thus, the terms and conditions of the GNU
|
||||||
|
General Public License cover the whole combination.
|
||||||
|
|
||||||
|
As a special exception, the copyright holder of FreeRTOS gives you permission
|
||||||
|
to link FreeRTOS with independent modules that communicate with FreeRTOS
|
||||||
|
solely through the FreeRTOS API interface, regardless of the license terms of
|
||||||
|
these independent modules, and to copy and distribute the resulting combined
|
||||||
|
work under terms of your choice, provided that
|
||||||
|
|
||||||
|
+ Every copy of the combined work is accompanied by a written statement that
|
||||||
|
details to the recipient the version of FreeRTOS used and an offer by yourself
|
||||||
|
to provide the FreeRTOS source code (including any modifications you may have
|
||||||
|
made) should the recipient request it.
|
||||||
|
|
||||||
|
+ The combined work is not itself an RTOS, scheduler, kernel or related product.
|
||||||
|
|
||||||
|
+ The independent modules add significant and primary functionality to FreeRTOS
|
||||||
|
and do not merely extend the existing functionality already present in FreeRTOS.
|
||||||
|
|
||||||
|
Clause 2:
|
||||||
|
|
||||||
|
FreeRTOS may not be used for any competitive or comparative purpose, including the
|
||||||
|
publication of any form of run time or compile time metric, without the express
|
||||||
|
permission of Real Time Engineers Ltd. (this is the norm within the industry and
|
||||||
|
is intended to ensure information accuracy).
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
The standard GPL exception text:
|
||||||
|
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library General
|
||||||
|
Public License instead of this License.
|
||||||
|
|
||||||
|
License component (libmad 8.1.2):
|
||||||
|
|
||||||
|
libmad - MPEG audio decoder library
|
||||||
|
Copyright (C) 2000-2004 Underbit Technologies, Inc.
|
||||||
|
|
||||||
|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
License component (SDK Realtek):
|
||||||
|
Not found on sdk-ameba-rtl8710af-v3.5a_without_NDA_GCC_V1.0.0.zip
|
||||||
|
https://www.pine64.org/?page_id=946 -> Software & SDK
|
||||||
|
-> Ameba RTL8710AF SDK ver v3.5a GCC ver 1.0.0- without NDA
|
||||||
|
|
52
Makefile
Normal file
52
Makefile
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
all: ram_all
|
||||||
|
mp: ram_all_mp
|
||||||
|
|
||||||
|
.PHONY: ram_all
|
||||||
|
ram_all:
|
||||||
|
@$(MAKE) -f sdkbuild.mk
|
||||||
|
@$(MAKE) -f flasher.mk genbin1 genbin23
|
||||||
|
|
||||||
|
.PHONY: ram_all_mp
|
||||||
|
ram_all_mp:
|
||||||
|
@$(MAKE) -f sdkbuild.mk mp
|
||||||
|
@$(MAKE) -f flasher.mk mp
|
||||||
|
|
||||||
|
.PHONY: clean clean_all
|
||||||
|
clean:
|
||||||
|
@$(MAKE) -f sdkbuild.mk clean
|
||||||
|
|
||||||
|
clean_all:
|
||||||
|
@$(MAKE) -f sdkbuild.mk clean_all
|
||||||
|
|
||||||
|
.PHONY: debug ramdebug
|
||||||
|
debug:
|
||||||
|
@$(MAKE) -f application.mk debug
|
||||||
|
|
||||||
|
ramdebug:
|
||||||
|
@$(MAKE) -f application.mk ramdebug
|
||||||
|
|
||||||
|
.PHONY: flashburn runram reset test readfullflash
|
||||||
|
flashburn:
|
||||||
|
JLinkGDB-WrFlash.bat build/bin/ram_all.bin
|
||||||
|
#@$(MAKE) -f flasher.mk flashburn
|
||||||
|
|
||||||
|
runram:
|
||||||
|
JLink-RunRAM.bat
|
||||||
|
#@$(MAKE) --f flasher.mk runram
|
||||||
|
|
||||||
|
reset:
|
||||||
|
JLink-Reset.bat
|
||||||
|
#@make -f flasher.mk reset
|
||||||
|
|
||||||
|
test:
|
||||||
|
@make -f flasher.mk test
|
||||||
|
|
||||||
|
readfullflash:
|
||||||
|
JLink-RdFullFlash.bat
|
||||||
|
#@make -f flasher.mk readfullflash
|
||||||
|
|
||||||
|
.PHONY: prerequirement
|
||||||
|
prerequirement:
|
||||||
|
# @$(file >DEPENDENCY_LIST.txt,$(DEPENDENCY_LIST))
|
||||||
|
|
57
README.md
Normal file
57
README.md
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
# RTL00(RTL8710AF) Test MP3 AmebaV3.5a GCC
|
||||||
|
---
|
||||||
|
|
||||||
|
MP3 stereo player V0004<br>
|
||||||
|
RTL00 module (RTL8710AF)<br>
|
||||||
|
|
||||||
|
Толко Тест!<br>
|
||||||
|
|
||||||
|
PWM Out GC_2 and PE_2 (2 канала по 96Bit на один исходный sample 48 кГц)<br>
|
||||||
|
|
||||||
|
Console command (RX/TX GB1/GB0 38400 baud):<br>
|
||||||
|
|
||||||
|
ATW0=SSID - задать имя AP<br>
|
||||||
|
ATW1=PASSPHRASE - задать пароль AP<br>
|
||||||
|
ATWC - Connect to an AES AP<br>
|
||||||
|
ATWD - DisConnect AP<br>
|
||||||
|
ATWS=URL,PORT - задать канал web-radio или http файл<br>
|
||||||
|
. Sample: ATWS=icecast.omroep.nl/3fm-sb-mp3,80<br>
|
||||||
|
. ATWS=meuk.spritesserver.nl/Ii.Romanzeandante.mp3,80<br>
|
||||||
|
. ATWS=?, ATWS=close, ATWS=save, ATWS=read<br>
|
||||||
|
. ATWS=x,0 и ATWS=save - отключить старт<br>
|
||||||
|
ATST - Mem/Task Info<br>
|
||||||
|
ATOF - Отключить MP3<br>
|
||||||
|
|
||||||
|
ATSD=hexaddr,count - Damp памяти/регистров с адреса...<br>
|
||||||
|
ATWD=hexaddr,hexdata - Записать dword по адресу<br>
|
||||||
|
|
||||||
|
|
||||||
|
По умолчанию, в качестве JTAG используется J-Link STLink V2.<br>
|
||||||
|
|
||||||
|
Используемое ПО<br>
|
||||||
|
|
||||||
|
JTAG/SWD Drivers:<br>
|
||||||
|
* [ST-Link](http://www.st.com/web/catalog/tools/FM146/CL1984/SC724/SS1677/PF251168?sc=internet/evalboard/product/251168.jsp)<br>
|
||||||
|
* [SEEGER J-Link Software and Documentation Pack](https://www.segger.com/downloads/jlink)<br>
|
||||||
|
* [Converting ST-LINK on-board into a J-Link](https://www.segger.com/jlink-st-link.html)<br>
|
||||||
|
System:<br>
|
||||||
|
* [MinGW](https://sourceforge.net/projects/mingw-w64/)<br>
|
||||||
|
* [GNU ARM Embedded Toolchain](https://launchpad.net/gcc-arm-embedded/+download)<br>
|
||||||
|
* [OpenOCD: Open On-Chip Debugger](https://sourceforge.net/projects/gnuarmeclipse/files/OpenOCD/)<br>
|
||||||
|
Eclipse:<br>
|
||||||
|
* [Eclipse IDE for C/C++ Developers](https://eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunasr1a)<br>
|
||||||
|
* [GNU ARM Eclipse Plug-ins](http://gnuarmeclipse.github.io/downloads/)<br>
|
||||||
|
* [GNU ARM Eclipse OpenOCD](http://gnuarmeclipse.github.io/openocd/install/)<br>
|
||||||
|
|
||||||
|
Изначальные версии для дополнений исходников и SDK:<br>
|
||||||
|
от [PADI IoT Stamp Resources – PINE64](https://www.pine64.org/?page_id=946):<br>
|
||||||
|
* [sdk-ameba-rtl8710af-v3.5a_without_NDA_GCC_V1.0.0.zip](https://yadi.sk/d/dfIwqNkZv6m63)<br>
|
||||||
|
от [Realtek IoT/Arduino Solution](http://www.amebaiot.com/en/):<br>
|
||||||
|
* [sdk-ameba1-v3.4b3_without_NDA.zip](https://yadi.sk/d/Yt7iS1KBvUAV9)<br>
|
||||||
|
из GitHub:<br>
|
||||||
|
* [Ameba8195/Arduino: This is Arduino SDK for Ameba Arduino board](https://github.com/Ameba8195/Arduino)<br>
|
||||||
|
+ [rtl_ameba_gcc_sample](https://github.com/eggman/rtl_ameba_gcc_sample)<br>
|
||||||
|
+ [rebane rtl8710_openocd](https://bitbucket.org/rebane/rtl8710_openocd/src)<br>
|
||||||
|
|
||||||
|
Доп.информация: [esp8266.ru/forum](https://esp8266.ru/forum/threads/rtl00-mp3-player.1697/)
|
||||||
|
|
BIN
RTL00_MP3_SCH.gif
Normal file
BIN
RTL00_MP3_SCH.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
92
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_ethernet.c
Normal file
92
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_ethernet.c
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "log_service.h"
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#include <lwip_netconf.h>
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
#include <lwip/sockets.h>
|
||||||
|
#include <lwip/tcpip.h>
|
||||||
|
#include "wifi_conf.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define _AT_DHCP_ETHERNET_MII_ "ATE0"
|
||||||
|
#define _AT_SET_DEFAULT_INTERFACE "ATE1"
|
||||||
|
|
||||||
|
#if CONFIG_ETHERNET
|
||||||
|
extern int dhcp_ethernet_mii;
|
||||||
|
extern int ethernet_if_default;
|
||||||
|
extern struct netif xnetif[NET_IF_NUM];
|
||||||
|
|
||||||
|
void fATE0(void *arg)
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
char *argv[MAX_ARGC] = {0};
|
||||||
|
printf("[ATE0]:DHCP configure for ethernet\n\r");
|
||||||
|
if(!arg){
|
||||||
|
printf("[ATE0]Usage to disable DHCP: ATE0=0\n");
|
||||||
|
printf("[ATE0]Usage to enable DHCP: ATE0=1\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if('0' == *(char *)arg)
|
||||||
|
{
|
||||||
|
dhcp_ethernet_mii = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if('1' == *(char *)arg)
|
||||||
|
{
|
||||||
|
dhcp_ethernet_mii = 1;
|
||||||
|
LwIP_DHCP(NET_IF_NUM - 1, DHCP_START);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("[ATE0]Usage to disable DHCP: ATE0=0\n");
|
||||||
|
printf("[ATE0]Usage to enable DHCP: ATE0=1\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fATE1(void *arg)
|
||||||
|
{
|
||||||
|
int argc;
|
||||||
|
char *argv[MAX_ARGC] = {0};
|
||||||
|
printf("[ATE1]:Set/check the default interface\n\r");
|
||||||
|
if(!arg){
|
||||||
|
if(ethernet_if_default)
|
||||||
|
printf("Ethernet is the default interface\n");
|
||||||
|
else
|
||||||
|
printf("wlan is the default interface\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if('0' == *(char *)arg)
|
||||||
|
{
|
||||||
|
ethernet_if_default = 0;
|
||||||
|
printf("wlan is set to the default interface\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
else if('1' == *(char *)arg)
|
||||||
|
{
|
||||||
|
ethernet_if_default = 1;
|
||||||
|
printf("ethernet is set to the default interface\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("[ATE0]Usage to check the default interface: ATE1\n");
|
||||||
|
printf("[ATE0]Usage to set ethernet as default interface: ATE1=1\n");
|
||||||
|
printf("[ATE0]Usage to set wlan as default interface: ATE1=0\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log_item_t at_ethernet_items[ ] = {
|
||||||
|
{"ATE0", fATE0,},
|
||||||
|
{"ATE1", fATE1,}
|
||||||
|
};
|
||||||
|
|
||||||
|
void at_ethernet_init(void)
|
||||||
|
{
|
||||||
|
log_service_add_table(at_ethernet_items, sizeof(at_ethernet_items)/sizeof(at_ethernet_items[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
log_module_init(at_ethernet_init);
|
||||||
|
|
||||||
|
#endif
|
2151
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_lwip.c
Normal file
2151
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_lwip.c
Normal file
File diff suppressed because it is too large
Load diff
100
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_lwip.h
Normal file
100
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_lwip.h
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
#ifndef __ATCMD_LWIP_H__
|
||||||
|
#define __ATCMD_LWIP_H__
|
||||||
|
|
||||||
|
#include <platform_opts.h>
|
||||||
|
#ifdef CONFIG_AT_LWIP
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include <lwip/opt.h>
|
||||||
|
#include "lwip/sockets.h"
|
||||||
|
#include "lwip/api.h"
|
||||||
|
#include "lwip/sys.h"
|
||||||
|
#include "lwip/igmp.h"
|
||||||
|
#include "lwip/inet.h"
|
||||||
|
#include "lwip/tcp.h"
|
||||||
|
#include "lwip/raw.h"
|
||||||
|
#include "lwip/udp.h"
|
||||||
|
#include "lwip/tcpip.h"
|
||||||
|
#include "lwip/pbuf.h"
|
||||||
|
#include "lwip/netdb.h"
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define _AT_TRANSPORT_MODE_ "ATP1"
|
||||||
|
#define _AT_TRANSPORT_LOCAL_PORT_ "ATP2"
|
||||||
|
#define _AT_TRANSPORT_REMOTE_IP_ "ATP3"
|
||||||
|
#define _AT_TRANSPORT_REMOTE_PORT_ "ATP4"
|
||||||
|
#define _AT_TRANSPORT_START_SERVER_ "ATP5"
|
||||||
|
#define _AT_TRANSPORT_START_CLIENT_ "ATP6"
|
||||||
|
#define _AT_TRANSPORT_SHOW_SETTING_ "ATP?"
|
||||||
|
#define _AT_TRANSPORT_RECEIVE_DATA_ "ATR0"
|
||||||
|
#define _AT_TRANSPORT_RECEIVE_PACKET_SIZE_ "ATR1"
|
||||||
|
#define _AT_TRANSPORT_WRITE_DATA_ "ATRA"
|
||||||
|
#define _AT_TRANSPORT_WRITE_PACKET_SIZE_ "ATRB"
|
||||||
|
|
||||||
|
#define NODE_MODE_TCP 0
|
||||||
|
#define NODE_MODE_UDP 1
|
||||||
|
|
||||||
|
#define NODE_ROLE_SERVER 0
|
||||||
|
#define NODE_ROLE_CLIENT 1
|
||||||
|
#define NODE_ROLE_SEED 2
|
||||||
|
|
||||||
|
#define INVALID_SOCKET_ID (-1)
|
||||||
|
|
||||||
|
//parameters
|
||||||
|
#ifndef NET_IF_NUM
|
||||||
|
#define NET_IF_NUM 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ATCMD_LWIP_TASK_PRIORITY (tskIDLE_PRIORITY + 1)
|
||||||
|
|
||||||
|
#if ATCMD_VER == ATVER_2
|
||||||
|
|
||||||
|
#define SERVER "127.0.0.1"
|
||||||
|
|
||||||
|
#define NUM_NS (MEMP_NUM_NETCONN) //maximum number of node and seed, same as NUM_SOCKETS
|
||||||
|
|
||||||
|
#define ETH_MAX_MTU 1500
|
||||||
|
|
||||||
|
#define INVALID_CON_ID (-1)
|
||||||
|
|
||||||
|
#define RECV_SELECT_TIMEOUT_SEC (0)
|
||||||
|
#define RECV_SELECT_TIMEOUT_USEC (20000) //20ms
|
||||||
|
|
||||||
|
typedef struct ns
|
||||||
|
{
|
||||||
|
int con_id;
|
||||||
|
int sockfd;
|
||||||
|
s8_t role;
|
||||||
|
int protocol;
|
||||||
|
u32_t addr;
|
||||||
|
u16_t port;
|
||||||
|
u32_t local_addr;
|
||||||
|
u16_t local_port;
|
||||||
|
xTaskHandle handletask;
|
||||||
|
struct ns* next;
|
||||||
|
struct ns* nextseed;
|
||||||
|
} node;
|
||||||
|
|
||||||
|
extern xTaskHandle atcmd_lwip_tt_task;
|
||||||
|
extern xSemaphoreHandle atcmd_lwip_tt_sema;
|
||||||
|
extern volatile int atcmd_lwip_tt_datasize;
|
||||||
|
extern volatile int atcmd_lwip_tt_lasttickcnt;
|
||||||
|
#define ATCMD_LWIP_TT_MAX_DELAY_TIME_MS (20) //transparent transmission interval
|
||||||
|
|
||||||
|
extern int atcmd_lwip_is_tt_mode(void);
|
||||||
|
extern void atcmd_lwip_set_tt_mode(int enable);
|
||||||
|
int atcmd_lwip_send_data(node *curnode, u8 *data, u16 data_sz, struct sockaddr_in cli_addr);
|
||||||
|
int atcmd_lwip_receive_data(node *curnode, u8 *buffer, u16 buffer_size, int *recv_size,
|
||||||
|
u8_t *udp_clientaddr, u16_t *udp_clientport);
|
||||||
|
node* create_node(int mode, s8_t role);
|
||||||
|
void init_node_pool(void);
|
||||||
|
void delete_node(node *n);
|
||||||
|
int hang_node(node* insert_node);
|
||||||
|
int hang_seednode(node* main_node ,node* insert_node);
|
||||||
|
node *seek_node(int con_id);
|
||||||
|
node *tryget_node(int n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //#ifdef CONFIG_AT_LWIP
|
||||||
|
#endif //#ifndef __ATCMD_LWIP_H__
|
1268
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_sys.c
Normal file
1268
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_sys.c
Normal file
File diff suppressed because it is too large
Load diff
6
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_sys.h
Normal file
6
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_sys.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef __ATCMD_SYS_H__
|
||||||
|
#define __ATCMD_SYS_H__
|
||||||
|
#ifdef CONFIG_AT_SYS
|
||||||
|
#endif //
|
||||||
|
|
||||||
|
#endif
|
2727
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_wifi.c
Normal file
2727
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_wifi.c
Normal file
File diff suppressed because it is too large
Load diff
171
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_wifi.h
Normal file
171
RTL00_SDKV35a/component/common/api/at_cmd/atcmd_wifi.h
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
#ifndef __ATCMD_WIFI_H__
|
||||||
|
#define __ATCMD_WIFI_H__
|
||||||
|
#include <platform_opts.h>
|
||||||
|
#ifdef CONFIG_AT_WIFI
|
||||||
|
#include "main.h"
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
#ifdef USE_FLASH_EEP
|
||||||
|
#include "flash_eep.h"
|
||||||
|
#include "feep_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WLAN0_NAME
|
||||||
|
#define WLAN0_NAME "wlan0"
|
||||||
|
#endif
|
||||||
|
#ifndef WLAN1_NAME
|
||||||
|
#define WLAN1_NAME "wlan1"
|
||||||
|
#endif
|
||||||
|
/* Give default value if not defined */
|
||||||
|
#ifndef NET_IF_NUM
|
||||||
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
|
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
|
||||||
|
#else
|
||||||
|
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN))
|
||||||
|
#endif // end of CONFIG_CONCURRENT_MODE
|
||||||
|
#endif // end of NET_IF_NUM
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#ifndef IP_ADDR0
|
||||||
|
#define IP_ADDR0 192
|
||||||
|
#define IP_ADDR1 168
|
||||||
|
#define IP_ADDR2 3
|
||||||
|
#define IP_ADDR3 80
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#ifndef NETMASK_ADDR0
|
||||||
|
#define NETMASK_ADDR0 255
|
||||||
|
#define NETMASK_ADDR1 255
|
||||||
|
#define NETMASK_ADDR2 255
|
||||||
|
#define NETMASK_ADDR3 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#ifndef GW_ADDR0
|
||||||
|
#define GW_ADDR0 192
|
||||||
|
#define GW_ADDR1 168
|
||||||
|
#define GW_ADDR2 3
|
||||||
|
#define GW_ADDR3 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#ifndef AP_IP_ADDR0
|
||||||
|
#define AP_IP_ADDR0 192
|
||||||
|
#define AP_IP_ADDR1 168
|
||||||
|
#define AP_IP_ADDR2 43
|
||||||
|
#define AP_IP_ADDR3 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#ifndef AP_NETMASK_ADDR0
|
||||||
|
#define AP_NETMASK_ADDR0 255
|
||||||
|
#define AP_NETMASK_ADDR1 255
|
||||||
|
#define AP_NETMASK_ADDR2 255
|
||||||
|
#define AP_NETMASK_ADDR3 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#ifndef AP_GW_ADDR0
|
||||||
|
#define AP_GW_ADDR0 192
|
||||||
|
#define AP_GW_ADDR1 168
|
||||||
|
#define AP_GW_ADDR2 43
|
||||||
|
#define AP_GW_ADDR3 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // CONFIG_AT_WIFI
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||||
|
|
||||||
|
#include "wifi_structures.h"
|
||||||
|
#include <wlan_fast_connect/example_wlan_fast_connect.h>
|
||||||
|
typedef struct _UART_LOG_CONF_{
|
||||||
|
u32 BaudRate;
|
||||||
|
u8 DataBits;
|
||||||
|
u8 StopBits;
|
||||||
|
u8 Parity;
|
||||||
|
u8 FlowControl;
|
||||||
|
}UART_LOG_CONF, *PUART_LOG_CONF;
|
||||||
|
|
||||||
|
#define ATCMD_WIFI_CONN_STORE_MAX_NUM (1)
|
||||||
|
struct atcmd_wifi_conf{
|
||||||
|
struct wlan_fast_reconnect reconn[ATCMD_WIFI_CONN_STORE_MAX_NUM];
|
||||||
|
int32_t auto_enable;
|
||||||
|
rtw_wifi_setting_t setting;
|
||||||
|
int32_t reconn_num;
|
||||||
|
int32_t reconn_last_index;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ATCMD_LWIP_CONN_STORE_MAX_NUM (1)
|
||||||
|
struct atcmd_lwip_conn_info{
|
||||||
|
int32_t role; //client, server or seed
|
||||||
|
uint32_t protocol; //tcp or udp
|
||||||
|
uint32_t remote_addr; //remote ip
|
||||||
|
uint32_t remote_port; //remote port
|
||||||
|
uint32_t local_addr; //locale ip, not used yet
|
||||||
|
uint32_t local_port; //locale port, not used yet
|
||||||
|
uint32_t reserved; //reserve for further use
|
||||||
|
};
|
||||||
|
struct atcmd_lwip_conf {
|
||||||
|
int32_t enable; //enable or not
|
||||||
|
int32_t conn_num;
|
||||||
|
int32_t last_index;
|
||||||
|
int32_t reserved; //reserve for further use
|
||||||
|
struct atcmd_lwip_conn_info conn[ATCMD_LWIP_CONN_STORE_MAX_NUM];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
AT_PARTITION_ALL = 0,
|
||||||
|
AT_PARTITION_UART = FEEP_ID_UART_CFG,
|
||||||
|
AT_PARTITION_WIFI = FEEP_ID_WIFI_CFG,
|
||||||
|
AT_PARTITION_LWIP = FEEP_ID_LWIP_CFG
|
||||||
|
} AT_PARTITION;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
AT_PARTITION_READ = 0,
|
||||||
|
AT_PARTITION_WRITE = 1,
|
||||||
|
AT_PARTITION_ERASE = 2
|
||||||
|
} AT_PARTITION_OP;
|
||||||
|
|
||||||
|
//first segment for uart
|
||||||
|
#define UART_SETTING_BACKUP_SECTOR (0x8000)
|
||||||
|
#define UART_CONF_DATA_OFFSET (0)
|
||||||
|
#define UART_CONF_DATA_SIZE ((((sizeof(UART_LOG_CONF)-1)>>2) + 1)<<2)
|
||||||
|
|
||||||
|
//second segment for wifi config
|
||||||
|
#define WIFI_CONF_DATA_OFFSET (UART_CONF_DATA_OFFSET+UART_CONF_DATA_SIZE)
|
||||||
|
#define WIFI_CONF_DATA_SIZE ((((sizeof(struct atcmd_wifi_conf)-1)>>2) + 1)<<2)
|
||||||
|
|
||||||
|
//fouth segment for lwip config
|
||||||
|
#define LWIP_CONF_DATA_OFFSET (WIFI_CONF_DATA_OFFSET+WIFI_CONF_DATA_SIZE)
|
||||||
|
#define LWIP_CONF_DATA_SIZE ((((sizeof(struct atcmd_lwip_conf)-1)>>2) + 1)<<2)
|
||||||
|
|
||||||
|
extern void atcmd_update_partition_info(AT_PARTITION id, AT_PARTITION_OP ops, u8 *data, u16 len);
|
||||||
|
|
||||||
|
#define ATSTRING_LEN (LOG_SERVICE_BUFLEN)
|
||||||
|
extern char at_string[ATSTRING_LEN];
|
||||||
|
|
||||||
|
extern unsigned char gAT_Echo; // default echo on
|
||||||
|
//extern void uart_at_lock(void);
|
||||||
|
//extern void uart_at_unlock(void);
|
||||||
|
extern void uart_at_send_string(char *str);
|
||||||
|
extern void uart_at_send_buf(u8 *buf, u32 len);
|
||||||
|
|
||||||
|
#define at_printf(fmt, args...) do{\
|
||||||
|
/*uart_at_lock();*/\
|
||||||
|
snprintf(at_string, ATSTRING_LEN, fmt, ##args); \
|
||||||
|
uart_at_send_string(at_string);\
|
||||||
|
/*uart_at_unlock();*/\
|
||||||
|
}while(0)
|
||||||
|
#define at_print_data(data, size) do{\
|
||||||
|
/*uart_at_lock();*/\
|
||||||
|
uart_at_send_buf(data, size);\
|
||||||
|
/*uart_at_unlock();*/\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define at_printf(fmt, args...) do{printf(fmt, ##args);}while(0)
|
||||||
|
#define at_print_data(data, size) do{__rtl_memDump(data, size, NULL);}while(0)
|
||||||
|
#endif//#if CONFIG_EXAMPLE_UART_ATCMD
|
||||||
|
|
||||||
|
#endif
|
497
RTL00_SDKV35a/component/common/api/at_cmd/log_service.c
Normal file
497
RTL00_SDKV35a/component/common/api/at_cmd/log_service.c
Normal file
|
@ -0,0 +1,497 @@
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
|
||||||
|
#include "freertos_pmu.h"
|
||||||
|
#endif
|
||||||
|
#include "log_service.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "wifi_util.h"
|
||||||
|
#include "atcmd_wifi.h"
|
||||||
|
#include "osdep_api.h"
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||||
|
#include "atcmd_lwip.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SUPPORT_LOG_SERVICE
|
||||||
|
//======================================================
|
||||||
|
struct list_head log_hash[ATC_INDEX_NUM];
|
||||||
|
#ifdef CONFIG_AT_USR
|
||||||
|
extern void at_user_init(void);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_AT_WIFI
|
||||||
|
extern void at_wifi_init(void);
|
||||||
|
#endif
|
||||||
|
//extern void at_fs_init(void);
|
||||||
|
|
||||||
|
#ifdef CONFIG_AT_SYS
|
||||||
|
extern void at_sys_init(void);
|
||||||
|
#endif
|
||||||
|
#if CONFIG_ETHERNET
|
||||||
|
extern void at_ethernet_init(void);
|
||||||
|
#endif
|
||||||
|
#if CONFIG_GOOGLE_NEST
|
||||||
|
extern void at_google_init(void);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_AT_LWIP
|
||||||
|
extern void at_transport_init(void);
|
||||||
|
#endif
|
||||||
|
//extern void at_app_init(void);
|
||||||
|
#if CONFIG_ALINK
|
||||||
|
extern void at_cloud_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
char log_buf[LOG_SERVICE_BUFLEN];
|
||||||
|
#if CONFIG_LOG_HISTORY
|
||||||
|
char log_history[LOG_HISTORY_LEN][LOG_SERVICE_BUFLEN];
|
||||||
|
static unsigned int log_history_count = 0;
|
||||||
|
#endif
|
||||||
|
xSemaphoreHandle log_rx_interrupt_sema = NULL;
|
||||||
|
#if CONFIG_LOG_SERVICE_LOCK
|
||||||
|
xSemaphoreHandle log_service_sema = NULL;
|
||||||
|
#endif
|
||||||
|
extern xSemaphoreHandle uart_rx_interrupt_sema;
|
||||||
|
|
||||||
|
#if CONFIG_INIC_EN
|
||||||
|
extern unsigned char inic_cmd_ioctl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__ICCARM__)
|
||||||
|
#pragma section=".data.log_init"
|
||||||
|
|
||||||
|
unsigned int __log_init_begin__;
|
||||||
|
unsigned int __log_init_end__;
|
||||||
|
#elif defined ( __CC_ARM ) || defined(__GNUC__)
|
||||||
|
//#pragma section=".data.log_init"
|
||||||
|
log_init_t* __log_init_begin__;
|
||||||
|
log_init_t* __log_init_end__;
|
||||||
|
log_init_t log_init_table[] = {
|
||||||
|
|
||||||
|
#ifdef CONFIG_AT_WIFI
|
||||||
|
at_wifi_init,
|
||||||
|
#endif
|
||||||
|
// at_fs_init,
|
||||||
|
#ifdef CONFIG_AT_SYS
|
||||||
|
at_sys_init,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ETHERNET
|
||||||
|
at_ethernet_init
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_GOOGLE_NEST
|
||||||
|
at_google_init
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TRANSPORT
|
||||||
|
at_transport_init
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ALINK
|
||||||
|
at_cloud_init
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_AT_USR
|
||||||
|
at_user_init
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// at_app_init
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
#error "not implement, add to linker script"
|
||||||
|
extern unsigned int __log_init_begin__;
|
||||||
|
extern unsigned int __log_init_end__;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define USE_STRSEP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//======================================================
|
||||||
|
int hash_index(char *str)
|
||||||
|
{
|
||||||
|
unsigned int seed = 131; // 31 131 1313 13131 131313 etc..
|
||||||
|
unsigned int hash = 0;
|
||||||
|
|
||||||
|
while (*str)
|
||||||
|
{
|
||||||
|
hash = hash * seed + (*str++);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (hash & 0x7FFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_add_new_command(log_item_t *new)
|
||||||
|
{
|
||||||
|
int index = hash_index(new->log_cmd)%ATC_INDEX_NUM;
|
||||||
|
|
||||||
|
list_add(&new->node, &log_hash[index]);
|
||||||
|
}
|
||||||
|
void start_log_service(void);
|
||||||
|
void log_service_init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
#if defined (__ICCARM__)
|
||||||
|
log_init_t *log_init_table;
|
||||||
|
__log_init_begin__ = (unsigned int)__section_begin(".data.log_init");
|
||||||
|
__log_init_end__ = (unsigned int)__section_end(".data.log_init");
|
||||||
|
log_init_table = (log_init_t *)__log_init_begin__;
|
||||||
|
#elif defined(__CC_ARM) || defined(__GNUC__)
|
||||||
|
__log_init_begin__ = log_init_table;
|
||||||
|
__log_init_end__ = log_init_table + sizeof(log_init_table);
|
||||||
|
#else
|
||||||
|
#error "not implement"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
for(i=0;i<ATC_INDEX_NUM;i++)
|
||||||
|
INIT_LIST_HEAD(&log_hash[i]);
|
||||||
|
|
||||||
|
for(i=0;i<(__log_init_end__-__log_init_begin__)/sizeof(log_init_t); i++)
|
||||||
|
log_init_table[i]();
|
||||||
|
|
||||||
|
/* Initial uart rx swmaphore*/
|
||||||
|
vSemaphoreCreateBinary(log_rx_interrupt_sema);
|
||||||
|
xSemaphoreTake(log_rx_interrupt_sema, 1/portTICK_RATE_MS);
|
||||||
|
#if CONFIG_LOG_SERVICE_LOCK
|
||||||
|
log_service_lock_init();
|
||||||
|
#endif
|
||||||
|
start_log_service();
|
||||||
|
}
|
||||||
|
|
||||||
|
//sizeof(log_items)/sizeof(log_items[0])
|
||||||
|
void log_service_add_table(log_item_t *tbl, int len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
log_add_new_command(&tbl[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* log_action(char *cmd)
|
||||||
|
{
|
||||||
|
int search_cnt=0;
|
||||||
|
int index = hash_index(cmd)%ATC_INDEX_NUM;
|
||||||
|
struct list_head *head = &log_hash[index];
|
||||||
|
struct list_head *iterator;
|
||||||
|
log_item_t *item;
|
||||||
|
void *act = NULL;
|
||||||
|
|
||||||
|
list_for_each(iterator, head) {
|
||||||
|
item = list_entry(iterator, log_item_t, node);
|
||||||
|
search_cnt++;
|
||||||
|
if( strcmp(item->log_cmd, cmd) == 0){
|
||||||
|
//printf("%s match %s, search cnt %d\n\r", cmd, item->log_cmd, search_cnt);
|
||||||
|
act = (void*)item->at_act;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return act;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* log_handler(char *cmd)
|
||||||
|
{
|
||||||
|
log_act_t action=NULL;
|
||||||
|
char buf[LOG_SERVICE_BUFLEN] = {0};
|
||||||
|
char *copy=buf;
|
||||||
|
char *token = NULL;
|
||||||
|
char *param = NULL;
|
||||||
|
char tok[5] = {0};//'\0'
|
||||||
|
#if CONFIG_LOG_HISTORY
|
||||||
|
strcpy(log_history[((log_history_count++)%LOG_HISTORY_LEN)], log_buf);
|
||||||
|
#endif
|
||||||
|
strncpy(copy, cmd,LOG_SERVICE_BUFLEN-1);
|
||||||
|
|
||||||
|
#if defined(USE_STRSEP)
|
||||||
|
token = _strsep(©, "=");
|
||||||
|
param = copy;
|
||||||
|
#else
|
||||||
|
token = strtok(copy, "=");
|
||||||
|
param = strtok(NULL, NULL);
|
||||||
|
#endif
|
||||||
|
if(token && (strlen(token) <= 4))
|
||||||
|
strcpy(tok, token);
|
||||||
|
else{
|
||||||
|
//printf("\n\rAT Cmd format error!\n");
|
||||||
|
return NULL;
|
||||||
|
};
|
||||||
|
//printf(" Command %s \n\r ", tok);
|
||||||
|
//printf(" Param %s \n\r", param);
|
||||||
|
action = (log_act_t)log_action(tok);
|
||||||
|
|
||||||
|
if(action){
|
||||||
|
action(param);
|
||||||
|
}
|
||||||
|
return (void*)action;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_param(char *buf, char **argv)
|
||||||
|
{
|
||||||
|
int argc = 1;
|
||||||
|
char str_buf[LOG_SERVICE_BUFLEN] = "\0";
|
||||||
|
int str_count = 0;
|
||||||
|
int buf_cnt = 0;
|
||||||
|
|
||||||
|
if(buf == NULL)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
while((argc < MAX_ARGC) && (*buf != '\0')) {
|
||||||
|
while((*buf == ',') || (*buf == '[') || (*buf == ']')){
|
||||||
|
if((*buf == ',') && (*(buf+1) == ',')){
|
||||||
|
argv[argc] = NULL;
|
||||||
|
argc++;
|
||||||
|
}
|
||||||
|
*buf = '\0';
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*buf == '\0')
|
||||||
|
break;
|
||||||
|
else if(*buf == '"'){
|
||||||
|
memset(str_buf,'\0',LOG_SERVICE_BUFLEN);
|
||||||
|
str_count = 0;
|
||||||
|
buf_cnt = 0;
|
||||||
|
*buf = '\0';
|
||||||
|
buf ++;
|
||||||
|
if(*buf == '\0')
|
||||||
|
break;
|
||||||
|
argv[argc] = buf;
|
||||||
|
while((*buf != '"')&&(*buf != '\0')){
|
||||||
|
if(*buf == '\\'){
|
||||||
|
buf ++;
|
||||||
|
buf_cnt++;
|
||||||
|
}
|
||||||
|
str_buf[str_count] = *buf;
|
||||||
|
str_count++;
|
||||||
|
buf_cnt++;
|
||||||
|
buf ++;
|
||||||
|
}
|
||||||
|
*buf = '\0';
|
||||||
|
memcpy(buf-buf_cnt,str_buf,buf_cnt);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
argv[argc] = buf;
|
||||||
|
}
|
||||||
|
argc++;
|
||||||
|
buf++;
|
||||||
|
|
||||||
|
while( (*buf != ',')&&(*buf != '\0')&&(*buf != '[')&&(*buf != ']') )
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
exit:
|
||||||
|
return argc;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char gDbgLevel = AT_DBG_ERROR;
|
||||||
|
unsigned int gDbgFlag = 0xFFFFFFFF;
|
||||||
|
void at_set_debug_level(unsigned char newDbgLevel)
|
||||||
|
{
|
||||||
|
gDbgLevel = newDbgLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void at_set_debug_mask(unsigned int newDbgFlag)
|
||||||
|
{
|
||||||
|
gDbgFlag = newDbgFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SUPPORT_INTERACTIVE_MODE
|
||||||
|
extern char uart_buf[64];
|
||||||
|
void legency_interactive_handler(unsigned char argc, unsigned char **argv)
|
||||||
|
{
|
||||||
|
#if 0 //defined(CONFIG_PLATFORM_8195A)
|
||||||
|
if(argc<1)
|
||||||
|
{
|
||||||
|
DiagPrintf("Wrong argument number!\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DiagPrintf("Wlan Normal Mode\n");
|
||||||
|
|
||||||
|
WlanNormal( argc, argv);
|
||||||
|
#else
|
||||||
|
strncpy(uart_buf, log_buf, 63);//uart_buf[64]
|
||||||
|
xSemaphoreGive(uart_rx_interrupt_sema);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
#ifndef WLAN0_NAME
|
||||||
|
#define WLAN0_NAME "wlan0"
|
||||||
|
#endif
|
||||||
|
#ifndef WLAN1_NAME
|
||||||
|
#define WLAN1_NAME "wlan1"
|
||||||
|
#endif
|
||||||
|
int mp_commnad_handler(char *cmd)
|
||||||
|
{
|
||||||
|
char buf[64] = {0};
|
||||||
|
char *token = NULL;
|
||||||
|
|
||||||
|
//strcpy(buf, cmd);
|
||||||
|
strncpy(buf, cmd, (64-1));
|
||||||
|
token = strtok(buf, " ");
|
||||||
|
if(token && (strcmp(buf, "iwpriv") == 0)){
|
||||||
|
token = strtok(NULL, "");
|
||||||
|
wext_private_command(WLAN0_NAME, token, 1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
void print_help_msg(void){
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
extern void print_wlan_help(void);
|
||||||
|
print_wlan_help();
|
||||||
|
#endif
|
||||||
|
//add other help message print here
|
||||||
|
}
|
||||||
|
|
||||||
|
int print_help_handler(char *cmd){
|
||||||
|
if(strcmp(cmd, "help") == 0){
|
||||||
|
print_help_msg();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CONFIG_LOG_SERVICE_LOCK
|
||||||
|
void log_service_lock(void)
|
||||||
|
{
|
||||||
|
RtlDownSema(&log_service_sema);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 log_service_lock_timeout(u32 ms)
|
||||||
|
{
|
||||||
|
return RtlDownSemaWithTimeout(&log_service_sema, ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_service_unlock(void)
|
||||||
|
{
|
||||||
|
RtlUpSema(&log_service_sema);
|
||||||
|
}
|
||||||
|
|
||||||
|
void log_service_lock_init(void){
|
||||||
|
RtlInitSema(&log_service_sema, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void log_service(void *param)
|
||||||
|
{
|
||||||
|
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\rStart LOG SERVICE MODE\n\r");
|
||||||
|
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\r# ");
|
||||||
|
while(1){
|
||||||
|
while(xSemaphoreTake(log_rx_interrupt_sema, portMAX_DELAY) != pdTRUE);
|
||||||
|
#if CONFIG_LOG_SERVICE_LOCK
|
||||||
|
log_service_lock();
|
||||||
|
#endif
|
||||||
|
if(log_handler((char *)log_buf) == NULL){
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
if(mp_commnad_handler((char *)log_buf) < 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if SUPPORT_INTERACTIVE_MODE
|
||||||
|
print_help_handler((char *)log_buf);
|
||||||
|
legency_interactive_handler(NULL, NULL);
|
||||||
|
#if CONFIG_LOG_SERVICE_LOCK
|
||||||
|
log_service_unlock();
|
||||||
|
#endif
|
||||||
|
continue;
|
||||||
|
#else
|
||||||
|
if(print_help_handler((char *)log_buf) < 0){
|
||||||
|
at_printf("\r\nunknown command '%s'", log_buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log_buf[0] = '\0';
|
||||||
|
#if CONFIG_INIC_EN
|
||||||
|
inic_cmd_ioctl = 0;
|
||||||
|
#endif
|
||||||
|
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\n\r[MEM] After do cmd, available heap %d+%d\n\r", xPortGetFreeHeapSize(), tcm_heap_freeSpace());
|
||||||
|
_AT_DBG_MSG(AT_FLAG_COMMON, AT_DBG_ALWAYS, "\r\n\n# "); //"#" is needed for mp tool
|
||||||
|
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||||
|
if(atcmd_lwip_is_tt_mode())
|
||||||
|
at_printf(STR_END_OF_ATDATA_RET);
|
||||||
|
else
|
||||||
|
at_printf(STR_END_OF_ATCMD_RET);
|
||||||
|
#endif
|
||||||
|
#if CONFIG_LOG_SERVICE_LOCK
|
||||||
|
log_service_unlock();
|
||||||
|
#endif
|
||||||
|
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
|
||||||
|
release_wakelock(WAKELOCK_LOGUART);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define STACKSIZE 1280
|
||||||
|
void start_log_service(void)
|
||||||
|
{
|
||||||
|
xTaskHandle CreatedTask;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
#if CONFIG_USE_TCM_HEAP
|
||||||
|
extern void *tcm_heap_malloc(int size);
|
||||||
|
void *stack_addr = tcm_heap_malloc(STACKSIZE * sizeof(int));
|
||||||
|
|
||||||
|
if(stack_addr == NULL){
|
||||||
|
}
|
||||||
|
|
||||||
|
result = xTaskGenericCreate(
|
||||||
|
log_service,
|
||||||
|
( signed portCHAR * ) "log_service",
|
||||||
|
STACKSIZE,
|
||||||
|
NULL,
|
||||||
|
tskIDLE_PRIORITY + 5,
|
||||||
|
&CreatedTask,
|
||||||
|
stack_addr,
|
||||||
|
NULL);
|
||||||
|
#else
|
||||||
|
result = xTaskCreate( log_service, ( signed portCHAR * ) "log_service", STACKSIZE, NULL, tskIDLE_PRIORITY + 5, &CreatedTask );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(result != pdPASS) {
|
||||||
|
printf("\n\r%s xTaskCreate failed", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void fAT_exit(void *arg){
|
||||||
|
printf("\n\rLeave LOG SERVICE");
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
#if CONFIG_LOG_HISTORY
|
||||||
|
void fAT_log(void *arg){
|
||||||
|
int i = 0;
|
||||||
|
printf("[AT]log history:\n\n\r");
|
||||||
|
if(log_history_count > LOG_HISTORY_LEN){
|
||||||
|
for(i=0; i<4; i++)
|
||||||
|
printf(" %s\n\r", log_history[((log_history_count+i)%LOG_HISTORY_LEN)]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
for(i=0; i<(log_history_count-1); i++)
|
||||||
|
printf(" %s\n\r", log_history[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
log_item_t at_log_items[ ] = {
|
||||||
|
{"AT--", fAT_exit,},
|
||||||
|
#if CONFIG_LOG_HISTORY
|
||||||
|
{"AT??", fAT_log,},
|
||||||
|
#endif
|
||||||
|
{"ATxx", fAT_exit,}
|
||||||
|
};
|
||||||
|
void at_log_init(void)
|
||||||
|
{
|
||||||
|
log_service_add_table(at_log_items, sizeof(at_log_items)/sizeof(at_log_items[0]));
|
||||||
|
}
|
||||||
|
log_module_init(at_log_init);
|
||||||
|
#endif
|
123
RTL00_SDKV35a/component/common/api/at_cmd/log_service.h
Normal file
123
RTL00_SDKV35a/component/common/api/at_cmd/log_service.h
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
#ifndef LOG_SERVICE_H
|
||||||
|
#define LOG_SERVICE_H
|
||||||
|
|
||||||
|
#include "dlist.h"
|
||||||
|
/*
|
||||||
|
* Include user defined options first. Anything not defined in these files
|
||||||
|
* will be set to standard values. Override anything you dont like!
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#include "platform_stdlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ICCARM__
|
||||||
|
#define STRINGIFY(s) #s
|
||||||
|
#define SECTION(_name) _Pragma( STRINGIFY(location=_name))
|
||||||
|
#define log_module_init(fn) \
|
||||||
|
SECTION(".data.log_init") __root static void* log_##fn = (void*)fn
|
||||||
|
#elif defined(__CC_ARM)
|
||||||
|
#define log_module_init(fn) \
|
||||||
|
static void* log_##fn __attribute__((section(".data.log_init"))) = (void*)fn;
|
||||||
|
#define DiagPrintf printf
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define log_module_init(fn) \
|
||||||
|
static void* log_##fn __attribute__((section(".data.log_init"))) = (void*)fn;
|
||||||
|
#else
|
||||||
|
#error "not implement"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ATC_INDEX_NUM 32
|
||||||
|
|
||||||
|
#ifndef SUPPORT_LOG_SERVICE
|
||||||
|
#define SUPPORT_LOG_SERVICE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//LOG_SERVICE_BUFLEN: default, only 63 bytes could be used for keeping input
|
||||||
|
// cmd, the last byte is for string end ('\0').
|
||||||
|
#ifndef LOG_SERVICE_BUFLEN
|
||||||
|
#define LOG_SERVICE_BUFLEN 64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_LOG_HISTORY
|
||||||
|
#define CONFIG_LOG_HISTORY 0
|
||||||
|
#if CONFIG_LOG_HISTORY
|
||||||
|
#define LOG_HISTORY_LEN 5
|
||||||
|
#endif
|
||||||
|
#endif //#ifndef CONFIG_LOG_HISTORY
|
||||||
|
|
||||||
|
#ifndef MAX_ARGC
|
||||||
|
#define MAX_ARGC 12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_LOG_SERVICE_LOCK
|
||||||
|
#define CONFIG_LOG_SERVICE_LOCK 0 // //to protect log_buf[], only one command processed per time
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AT_BIT(n) (1<<n)
|
||||||
|
#define AT_FLAG_DUMP AT_BIT(0)
|
||||||
|
#define AT_FLAG_EDIT AT_BIT(1)
|
||||||
|
#define AT_FLAG_ADC AT_BIT(2)
|
||||||
|
#define AT_FLAG_GPIO AT_BIT(3)
|
||||||
|
#define AT_FLAG_OTA AT_BIT(4)
|
||||||
|
#define AT_FLAG_NFC AT_BIT(5)
|
||||||
|
#define AT_FLAG_OS AT_BIT(6)
|
||||||
|
#define AT_FLAG_LWIP AT_BIT(7)
|
||||||
|
#define AT_FLAG_COMMON AT_BIT(8)
|
||||||
|
#define AT_FLAG_WIFI AT_BIT(9)
|
||||||
|
|
||||||
|
enum{
|
||||||
|
AT_DBG_OFF = 0,
|
||||||
|
AT_DBG_ALWAYS,
|
||||||
|
AT_DBG_ERROR,
|
||||||
|
AT_DBG_WARNING,
|
||||||
|
AT_DBG_INFO
|
||||||
|
};
|
||||||
|
|
||||||
|
extern unsigned char gDbgLevel;
|
||||||
|
extern unsigned int gDbgFlag;
|
||||||
|
|
||||||
|
#define AT_PRINTK(fmt, args...) printf(fmt"\r\n",## args)
|
||||||
|
#define _AT_PRINTK(fmt, args...) printf(fmt,## args)
|
||||||
|
#define AT_DBG_MSG(flag, level, fmt, args...) \
|
||||||
|
do{ \
|
||||||
|
if(((flag) & gDbgFlag) && (level <= gDbgLevel)){ \
|
||||||
|
AT_PRINTK(fmt,## args); \
|
||||||
|
} \
|
||||||
|
}while(0)
|
||||||
|
#define _AT_DBG_MSG(flag, level, fmt, args...) \
|
||||||
|
do{ \
|
||||||
|
if(((flag) & gDbgFlag) && (level <= gDbgLevel)){ \
|
||||||
|
_AT_PRINTK(fmt,## args); \
|
||||||
|
} \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#ifndef SUPPORT_INTERACTIVE_MODE
|
||||||
|
#define SUPPORT_INTERACTIVE_MODE 0
|
||||||
|
#endif //#ifndef SUPPORT_INTERACTIVE_MODE
|
||||||
|
|
||||||
|
typedef void (*log_init_t)(void);
|
||||||
|
typedef void (*log_act_t)(void*);
|
||||||
|
typedef struct _at_command_item_{
|
||||||
|
char *log_cmd;
|
||||||
|
log_act_t at_act;
|
||||||
|
struct list_head node;
|
||||||
|
}log_item_t;
|
||||||
|
|
||||||
|
void log_service_add_table(log_item_t *tbl, int len);
|
||||||
|
int parse_param(char *buf, char **argv);
|
||||||
|
void at_set_debug_mask(unsigned int newDbgFlag);
|
||||||
|
void at_set_debug_level(unsigned char newDbgLevel);
|
||||||
|
void log_service_init(void);
|
||||||
|
#if CONFIG_LOG_SERVICE_LOCK
|
||||||
|
void log_service_lock_init(void);
|
||||||
|
void log_service_lock(void);
|
||||||
|
u32 log_service_lock_timeout(u32 ms);
|
||||||
|
void log_service_unlock(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define C_NUM_AT_CMD 4 //"ATxx", 4 characters
|
||||||
|
#define C_NUM_AT_CMD_DLT 1 //"=", 1 charater
|
||||||
|
#define STR_END_OF_ATCMD_RET "\r\n# " //each AT command response will end with this string
|
||||||
|
#define STR_END_OF_ATDATA_RET "\r\n> " //data transparent transmission indicator
|
||||||
|
#endif
|
406
RTL00_SDKV35a/component/common/api/lwip_netconf.c
Normal file
406
RTL00_SDKV35a/component/common/api/lwip_netconf.c
Normal file
|
@ -0,0 +1,406 @@
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "lwip/mem.h"
|
||||||
|
#include "lwip/memp.h"
|
||||||
|
#include "lwip/dhcp.h"
|
||||||
|
#include "lwip/dns.h"
|
||||||
|
#include "ethernetif.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
#include "wifi_ind.h"
|
||||||
|
#endif
|
||||||
|
#if defined(STM32F2XX)
|
||||||
|
#include "stm322xg_eval_lcd.h"
|
||||||
|
#elif defined(STM32F4XX)
|
||||||
|
#include "stm324xg_eval_lcd.h"
|
||||||
|
#endif
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#ifndef IP_ADDR0
|
||||||
|
#define IP_ADDR0 192
|
||||||
|
#define IP_ADDR1 168
|
||||||
|
#define IP_ADDR2 1
|
||||||
|
#define IP_ADDR3 80
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#ifndef NETMASK_ADDR0
|
||||||
|
#define NETMASK_ADDR0 255
|
||||||
|
#define NETMASK_ADDR1 255
|
||||||
|
#define NETMASK_ADDR2 255
|
||||||
|
#define NETMASK_ADDR3 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#ifndef GW_ADDR0
|
||||||
|
#define GW_ADDR0 192
|
||||||
|
#define GW_ADDR1 168
|
||||||
|
#define GW_ADDR2 1
|
||||||
|
#define GW_ADDR3 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#ifndef AP_IP_ADDR0
|
||||||
|
#define AP_IP_ADDR0 192
|
||||||
|
#define AP_IP_ADDR1 168
|
||||||
|
#define AP_IP_ADDR2 43
|
||||||
|
#define AP_IP_ADDR3 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#ifndef AP_NETMASK_ADDR0
|
||||||
|
#define AP_NETMASK_ADDR0 255
|
||||||
|
#define AP_NETMASK_ADDR1 255
|
||||||
|
#define AP_NETMASK_ADDR2 255
|
||||||
|
#define AP_NETMASK_ADDR3 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#ifndef AP_GW_ADDR0
|
||||||
|
#define AP_GW_ADDR0 192
|
||||||
|
#define AP_GW_ADDR1 168
|
||||||
|
#define AP_GW_ADDR2 43
|
||||||
|
#define AP_GW_ADDR3 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Static IP ADDRESS FOR ETHERNET*/
|
||||||
|
#ifndef ETH_IP_ADDR0
|
||||||
|
#define ETH_IP_ADDR0 192
|
||||||
|
#define ETH_IP_ADDR1 168
|
||||||
|
#define ETH_IP_ADDR2 0
|
||||||
|
#define ETH_IP_ADDR3 80
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*NETMASK FOR ETHERNET*/
|
||||||
|
#ifndef ETH_NETMASK_ADDR0
|
||||||
|
#define ETH_NETMASK_ADDR0 255
|
||||||
|
#define ETH_NETMASK_ADDR1 255
|
||||||
|
#define ETH_NETMASK_ADDR2 255
|
||||||
|
#define ETH_NETMASK_ADDR3 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*Gateway address for ethernet*/
|
||||||
|
#ifndef ETH_GW_ADDR0
|
||||||
|
#define ETH_GW_ADDR0 192
|
||||||
|
#define ETH_GW_ADDR1 168
|
||||||
|
#define ETH_GW_ADDR2 0
|
||||||
|
#define ETH_GW_ADDR3 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
#define MAX_DHCP_TRIES 5
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
struct netif xnetif[NET_IF_NUM]; /* network interface structure */
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief Initializes the lwIP stack
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
extern int error_flag;
|
||||||
|
extern rtw_mode_t wifi_mode;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int lwip_init_done = 0;
|
||||||
|
|
||||||
|
void LwIP_Init(void)
|
||||||
|
{
|
||||||
|
struct ip_addr ipaddr;
|
||||||
|
struct ip_addr netmask;
|
||||||
|
struct ip_addr gw;
|
||||||
|
int8_t idx = 0;
|
||||||
|
/* Create tcp_ip stack thread */
|
||||||
|
tcpip_init( NULL, NULL );
|
||||||
|
|
||||||
|
/* - netif_add(struct netif *netif, struct ip_addr *ipaddr,
|
||||||
|
struct ip_addr *netmask, struct ip_addr *gw,
|
||||||
|
void *state, err_t (* init)(struct netif *netif),
|
||||||
|
err_t (* input)(struct pbuf *p, struct netif *netif))
|
||||||
|
|
||||||
|
Adds your network interface to the netif_list. Allocate a struct
|
||||||
|
netif and pass a pointer to this structure as the first argument.
|
||||||
|
Give pointers to cleared ip_addr structures when using DHCP,
|
||||||
|
or fill them with sane numbers otherwise. The state pointer may be NULL.
|
||||||
|
|
||||||
|
The init function pointer must point to a initialization function for
|
||||||
|
your ethernet netif interface. The following code illustrates it's use.*/
|
||||||
|
//printf("NET_IF_NUM:%d\n\r",NET_IF_NUM);
|
||||||
|
for(idx=NET_IF_NUM - 1;idx>=0;idx--){
|
||||||
|
if(idx==0){
|
||||||
|
IP4_ADDR(&ipaddr, IP_ADDR0, IP_ADDR1, IP_ADDR2, IP_ADDR3);
|
||||||
|
IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1 , NETMASK_ADDR2, NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
IP4_ADDR(&ipaddr, AP_IP_ADDR0, AP_IP_ADDR1, AP_IP_ADDR2, AP_IP_ADDR3);
|
||||||
|
IP4_ADDR(&netmask, AP_NETMASK_ADDR0, AP_NETMASK_ADDR1 , AP_NETMASK_ADDR2, AP_NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, AP_GW_ADDR0, AP_GW_ADDR1, AP_GW_ADDR2, AP_GW_ADDR3);
|
||||||
|
}
|
||||||
|
#if CONFIG_ETHERNET
|
||||||
|
if(idx == NET_IF_NUM - 1)
|
||||||
|
{
|
||||||
|
IP4_ADDR(&ipaddr, ETH_IP_ADDR0, ETH_IP_ADDR1, ETH_IP_ADDR2, ETH_IP_ADDR3);
|
||||||
|
IP4_ADDR(&netmask, ETH_NETMASK_ADDR0, ETH_NETMASK_ADDR1 , ETH_NETMASK_ADDR2, ETH_NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, ETH_GW_ADDR0, ETH_GW_ADDR1, ETH_GW_ADDR2, ETH_GW_ADDR3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
xnetif[idx].name[0] = 'r';
|
||||||
|
xnetif[idx].name[1] = '0'+idx;
|
||||||
|
|
||||||
|
#if CONFIG_ETHERNET
|
||||||
|
if(idx == NET_IF_NUM - 1)
|
||||||
|
netif_add(&xnetif[idx], &ipaddr, &netmask, &gw, NULL, ðernetif_mii_init, &tcpip_input);
|
||||||
|
else
|
||||||
|
netif_add(&xnetif[idx], &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input);
|
||||||
|
#else
|
||||||
|
netif_add(&xnetif[idx], &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input);
|
||||||
|
#endif
|
||||||
|
printf("interface %d is initialized\n", idx);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Registers the default network interface. */
|
||||||
|
netif_set_default(&xnetif[0]);
|
||||||
|
|
||||||
|
/* When the netif is fully configured this function must be called.*/
|
||||||
|
for(idx = 0;idx < NET_IF_NUM;idx++)
|
||||||
|
netif_set_up(&xnetif[idx]);
|
||||||
|
|
||||||
|
lwip_init_done = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LwIP_DHCP_Process_Handle
|
||||||
|
* @param None
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
uint8_t LwIP_DHCP(uint8_t idx, uint8_t dhcp_state) {
|
||||||
|
struct ip_addr ipaddr;
|
||||||
|
struct ip_addr netmask;
|
||||||
|
struct ip_addr gw;
|
||||||
|
uint32_t IPaddress;
|
||||||
|
uint8_t iptab[4];
|
||||||
|
uint8_t DHCP_state;
|
||||||
|
int mscnt = 0;
|
||||||
|
struct netif *pnetif = NULL;
|
||||||
|
|
||||||
|
DHCP_state = dhcp_state;
|
||||||
|
|
||||||
|
#if !CONFIG_ETHERNET
|
||||||
|
if (idx > 1)
|
||||||
|
idx = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pnetif = &xnetif[idx];
|
||||||
|
if (DHCP_state == 0) {
|
||||||
|
pnetif->ip_addr.addr = 0;
|
||||||
|
pnetif->netmask.addr = 0;
|
||||||
|
pnetif->gw.addr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
//printf("\n\r ========DHCP_state:%d============\n\r",DHCP_state);
|
||||||
|
switch (DHCP_state) {
|
||||||
|
case DHCP_START: {
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_BEACON_AFTER_DHCP, wifi_rx_beacon_hdl);
|
||||||
|
#endif
|
||||||
|
dhcp_start(pnetif);
|
||||||
|
IPaddress = 0;
|
||||||
|
DHCP_state = DHCP_WAIT_ADDRESS;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DHCP_WAIT_ADDRESS: {
|
||||||
|
/* Read the new IP address */
|
||||||
|
IPaddress = pnetif->ip_addr.addr;
|
||||||
|
|
||||||
|
if (IPaddress != 0) {
|
||||||
|
DHCP_state = DHCP_ADDRESS_ASSIGNED;
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_BEACON_AFTER_DHCP, wifi_rx_beacon_hdl, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Stop DHCP */
|
||||||
|
// dhcp_stop(pnetif); /* can not stop, need to renew, Robbie*/
|
||||||
|
iptab[0] = (uint8_t) (IPaddress >> 24);
|
||||||
|
iptab[1] = (uint8_t) (IPaddress >> 16);
|
||||||
|
iptab[2] = (uint8_t) (IPaddress >> 8);
|
||||||
|
iptab[3] = (uint8_t) (IPaddress);
|
||||||
|
printf("Interface %d IP address: %d.%d.%d.%d\n", idx, iptab[3],
|
||||||
|
iptab[2], iptab[1], iptab[0]);
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
error_flag = RTW_NO_ERROR;
|
||||||
|
#endif
|
||||||
|
return DHCP_ADDRESS_ASSIGNED;
|
||||||
|
} else {
|
||||||
|
/* DHCP timeout */
|
||||||
|
if (pnetif->dhcp->tries > MAX_DHCP_TRIES) {
|
||||||
|
DHCP_state = DHCP_TIMEOUT;
|
||||||
|
|
||||||
|
/* Stop DHCP */
|
||||||
|
dhcp_stop(pnetif);
|
||||||
|
|
||||||
|
/* Static address used */
|
||||||
|
IP4_ADDR(&ipaddr, IP_ADDR0, IP_ADDR1, IP_ADDR2, IP_ADDR3);
|
||||||
|
IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1, NETMASK_ADDR2, NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
|
||||||
|
netif_set_addr(pnetif, &ipaddr, &netmask, &gw);
|
||||||
|
|
||||||
|
iptab[0] = IP_ADDR3;
|
||||||
|
iptab[1] = IP_ADDR2;
|
||||||
|
iptab[2] = IP_ADDR1;
|
||||||
|
iptab[3] = IP_ADDR0;
|
||||||
|
printf("Interface %d DHCP timeout\n", idx);
|
||||||
|
printf("Static IP address: %d.%d.%d.%d\n", iptab[3], iptab[2], iptab[1], iptab[0]);
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
error_flag = RTW_DHCP_FAIL;
|
||||||
|
#endif
|
||||||
|
return DHCP_TIMEOUT;
|
||||||
|
} else {
|
||||||
|
//sys_msleep(DHCP_FINE_TIMER_MSECS);
|
||||||
|
vTaskDelay(DHCP_FINE_TIMER_MSECS);
|
||||||
|
dhcp_fine_tmr();
|
||||||
|
mscnt += DHCP_FINE_TIMER_MSECS;
|
||||||
|
if (mscnt >= DHCP_COARSE_TIMER_SECS * 1000) {
|
||||||
|
dhcp_coarse_tmr();
|
||||||
|
mscnt = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DHCP_RELEASE_IP:
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_BEACON_AFTER_DHCP, wifi_rx_beacon_hdl);
|
||||||
|
#endif
|
||||||
|
printf("LwIP_DHCP: Release ip\n");
|
||||||
|
dhcp_release_unicast(pnetif);
|
||||||
|
return DHCP_RELEASE_IP;
|
||||||
|
case DHCP_STOP:
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_BEACON_AFTER_DHCP, wifi_rx_beacon_hdl);
|
||||||
|
#endif
|
||||||
|
printf("LwIP_DHCP: dhcp stop.\n");
|
||||||
|
dhcp_stop(pnetif);
|
||||||
|
return DHCP_STOP;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* LwIP_GetMAC(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
return (uint8_t *) (pnetif->hwaddr);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* LwIP_GetIP(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
return (uint8_t *) &(pnetif->ip_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* LwIP_GetGW(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
return (uint8_t *) &(pnetif->gw);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* LwIP_GetMASK(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
return (uint8_t *) &(pnetif->netmask);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* LwIP_GetBC(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
return (uint8_t *) &(pnetif->dhcp->offered_bc_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if LWIP_DNS
|
||||||
|
void LwIP_GetDNS(struct ip_addr* dns)
|
||||||
|
{
|
||||||
|
*dns = dns_getserver(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LwIP_SetDNS(struct ip_addr* dns)
|
||||||
|
{
|
||||||
|
dns_setserver(0, dns);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
void LwIP_UseStaticIP(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
struct ip_addr ipaddr;
|
||||||
|
struct ip_addr netmask;
|
||||||
|
struct ip_addr gw;
|
||||||
|
|
||||||
|
/* Static address used */
|
||||||
|
if(pnetif->name[1] == '0'){
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
if(wifi_mode == RTW_MODE_STA){
|
||||||
|
IP4_ADDR(&ipaddr, IP_ADDR0 ,IP_ADDR1 , IP_ADDR2 , IP_ADDR3 );
|
||||||
|
IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1, NETMASK_ADDR2, NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
|
||||||
|
}
|
||||||
|
else if(wifi_mode == RTW_MODE_AP){
|
||||||
|
IP4_ADDR(&ipaddr, AP_IP_ADDR0, AP_IP_ADDR1, AP_IP_ADDR2, AP_IP_ADDR3);
|
||||||
|
IP4_ADDR(&netmask, AP_NETMASK_ADDR0, AP_NETMASK_ADDR1 , AP_NETMASK_ADDR2, AP_NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, AP_GW_ADDR0, AP_GW_ADDR1, AP_GW_ADDR2, AP_GW_ADDR3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}else{
|
||||||
|
IP4_ADDR(&ipaddr, AP_IP_ADDR0, AP_IP_ADDR1, AP_IP_ADDR2, AP_IP_ADDR3);
|
||||||
|
IP4_ADDR(&netmask, AP_NETMASK_ADDR0, AP_NETMASK_ADDR1 , AP_NETMASK_ADDR2, AP_NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, AP_GW_ADDR0, AP_GW_ADDR1, AP_GW_ADDR2, AP_GW_ADDR3);
|
||||||
|
}
|
||||||
|
|
||||||
|
netif_set_addr(pnetif, &ipaddr , &netmask, &gw);
|
||||||
|
}
|
||||||
|
#if LWIP_AUTOIP
|
||||||
|
#include <lwip/autoip.h>
|
||||||
|
|
||||||
|
void LwIP_AUTOIP(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
uint8_t *ip = LwIP_GetIP(pnetif);
|
||||||
|
|
||||||
|
autoip_start(pnetif);
|
||||||
|
|
||||||
|
while((pnetif->autoip->state == AUTOIP_STATE_PROBING) || (pnetif->autoip->state == AUTOIP_STATE_ANNOUNCING)) {
|
||||||
|
vTaskDelay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*((uint32_t *) ip) == 0) {
|
||||||
|
struct ip_addr ipaddr;
|
||||||
|
struct ip_addr netmask;
|
||||||
|
struct ip_addr gw;
|
||||||
|
|
||||||
|
printf("AUTOIP timeout\n");
|
||||||
|
|
||||||
|
/* Static address used */
|
||||||
|
IP4_ADDR(&ipaddr, IP_ADDR0 ,IP_ADDR1 , IP_ADDR2 , IP_ADDR3 );
|
||||||
|
IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1, NETMASK_ADDR2, NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
|
||||||
|
netif_set_addr(pnetif, &ipaddr , &netmask, &gw);
|
||||||
|
printf("Static IP address : %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Link-local address: %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if LWIP_IPV6
|
||||||
|
/* Get IPv6 address with lwip 1.5.0 */
|
||||||
|
void LwIP_AUTOIP_IPv6(struct netif *pnetif)
|
||||||
|
{
|
||||||
|
uint8_t *ipv6 = (uint8_t *) &(pnetif->ip6_addr[0].addr[0]);
|
||||||
|
|
||||||
|
netif_create_ip6_linklocal_address(pnetif, 1);
|
||||||
|
printf("IPv6 link-local address: %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
|
||||||
|
ipv6[0], ipv6[1], ipv6[2], ipv6[3], ipv6[4], ipv6[5], ipv6[6], ipv6[7],
|
||||||
|
ipv6[8], ipv6[9], ipv6[10], ipv6[11], ipv6[12], ipv6[13], ipv6[14], ipv6[15]);
|
||||||
|
}
|
||||||
|
#endif
|
91
RTL00_SDKV35a/component/common/api/lwip_netconf.h
Normal file
91
RTL00_SDKV35a/component/common/api/lwip_netconf.h
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file netconf.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @version V1.1.0
|
||||||
|
* @date 07-October-2011
|
||||||
|
* @brief This file contains all the functions prototypes for the netconf.c
|
||||||
|
* file.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||||
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||||
|
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||||
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||||
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||||
|
*
|
||||||
|
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __NETCONF_H
|
||||||
|
#define __NETCONF_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "tcpip.h"
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#include "autoconf.h"
|
||||||
|
|
||||||
|
// macros
|
||||||
|
/* Give default value if not defined */
|
||||||
|
#ifndef NET_IF_NUM
|
||||||
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
|
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
|
||||||
|
#else
|
||||||
|
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN))
|
||||||
|
#endif // end of CONFIG_CONCURRENT_MODE
|
||||||
|
#endif // end of NET_IF_NUM
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DHCP_START=0,
|
||||||
|
DHCP_WAIT_ADDRESS,
|
||||||
|
DHCP_ADDRESS_ASSIGNED,
|
||||||
|
DHCP_RELEASE_IP,
|
||||||
|
DHCP_STOP,
|
||||||
|
DHCP_TIMEOUT
|
||||||
|
} DHCP_State_TypeDef;
|
||||||
|
|
||||||
|
/* Extern functions ------------------------------------------------------------*/
|
||||||
|
void wifi_rx_beacon_hdl( char* buf, int buf_len, int flags, void* userdata);
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
void LwIP_Init(void);
|
||||||
|
uint8_t LwIP_DHCP(uint8_t idx, uint8_t dhcp_state);
|
||||||
|
unsigned char* LwIP_GetMAC(struct netif *pnetif);
|
||||||
|
unsigned char* LwIP_GetIP(struct netif *pnetif);
|
||||||
|
unsigned char* LwIP_GetGW(struct netif *pnetif);
|
||||||
|
uint8_t* LwIP_GetMASK(struct netif *pnetif);
|
||||||
|
uint8_t* LwIP_GetBC(struct netif *pnetif);
|
||||||
|
#if LWIP_DNS
|
||||||
|
void LwIP_GetDNS(struct ip_addr* dns);
|
||||||
|
void LwIP_SetDNS(struct ip_addr* dns);
|
||||||
|
#endif
|
||||||
|
void LwIP_UseStaticIP(struct netif *pnetif);
|
||||||
|
#if LWIP_AUTOIP
|
||||||
|
void LwIP_AUTOIP(struct netif *pnetif);
|
||||||
|
#endif
|
||||||
|
#if LWIP_IPV6
|
||||||
|
void LwIP_AUTOIP_IPv6(struct netif *pnetif);
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __NETCONF_H */
|
||||||
|
|
||||||
|
|
||||||
|
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
304
RTL00_SDKV35a/component/common/api/network/include/lwipopts.h.0
Normal file
304
RTL00_SDKV35a/component/common/api/network/include/lwipopts.h.0
Normal file
|
@ -0,0 +1,304 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file lwipopts.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @version V1.1.0
|
||||||
|
* @date 07-October-2011
|
||||||
|
* @brief lwIP Options Configuration.
|
||||||
|
* This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h
|
||||||
|
* and contains the lwIP configuration for the STM32F2x7 demonstration.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||||
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||||
|
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||||
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||||
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||||
|
*
|
||||||
|
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LWIPOPTS_H__
|
||||||
|
#define __LWIPOPTS_H__
|
||||||
|
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#define WIFI_LOGO_CERTIFICATION_CONFIG 0 //for ping 10k test buffer setting
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
|
||||||
|
* critical regions during buffer allocation, deallocation and memory
|
||||||
|
* allocation and deallocation.
|
||||||
|
*/
|
||||||
|
#define SYS_LIGHTWEIGHT_PROT 1
|
||||||
|
|
||||||
|
/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
|
||||||
|
should be used instead */
|
||||||
|
#define LWIP_COMPAT_MUTEX 1
|
||||||
|
|
||||||
|
#define ETHARP_TRUST_IP_MAC 0
|
||||||
|
#define IP_REASSEMBLY 1
|
||||||
|
#define IP_FRAG 1
|
||||||
|
#define ARP_QUEUEING 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
|
||||||
|
* use lwIP facilities.
|
||||||
|
*/
|
||||||
|
#define NO_SYS 0
|
||||||
|
|
||||||
|
/* ---------- Memory options ---------- */
|
||||||
|
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||||
|
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||||
|
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||||
|
#define MEM_ALIGNMENT 4
|
||||||
|
|
||||||
|
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||||
|
a lot of data that needs to be copied, this should be set high. */
|
||||||
|
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||||
|
#define MEM_SIZE (10*1024) //for ping 10k test
|
||||||
|
#else
|
||||||
|
#define MEM_SIZE (5*1024)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||||
|
sends a lot of data out of ROM (or other static memory), this
|
||||||
|
should be set high. */
|
||||||
|
#define MEMP_NUM_PBUF 100
|
||||||
|
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||||
|
per active UDP "connection". */
|
||||||
|
#define MEMP_NUM_UDP_PCB 6
|
||||||
|
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||||
|
connections. */
|
||||||
|
#define MEMP_NUM_TCP_PCB 10
|
||||||
|
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||||
|
connections. */
|
||||||
|
#define MEMP_NUM_TCP_PCB_LISTEN 5
|
||||||
|
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||||
|
segments. */
|
||||||
|
#define MEMP_NUM_TCP_SEG 20
|
||||||
|
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||||
|
timeouts. */
|
||||||
|
#define MEMP_NUM_SYS_TIMEOUT 10
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- Pbuf options ---------- */
|
||||||
|
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||||
|
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||||
|
#define PBUF_POOL_SIZE 30 //for ping 10k test
|
||||||
|
#else
|
||||||
|
#define PBUF_POOL_SIZE 20
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.*/
|
||||||
|
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||||
|
#define IP_REASS_MAX_PBUFS 30 //for ping 10k test
|
||||||
|
#else
|
||||||
|
#define IP_REASS_MAX_PBUFS 10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||||
|
#define PBUF_POOL_BUFSIZE 500
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- TCP options ---------- */
|
||||||
|
#define LWIP_TCP 1
|
||||||
|
#define TCP_TTL 255
|
||||||
|
|
||||||
|
/* Controls if TCP should queue segments that arrive out of
|
||||||
|
order. Define to 0 if your device is low on memory. */
|
||||||
|
#define TCP_QUEUE_OOSEQ 1
|
||||||
|
|
||||||
|
/* TCP Maximum segment size. */
|
||||||
|
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
|
||||||
|
|
||||||
|
/* TCP sender buffer space (bytes). */
|
||||||
|
#define TCP_SND_BUF (5*TCP_MSS)
|
||||||
|
|
||||||
|
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
|
||||||
|
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
|
||||||
|
|
||||||
|
#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
|
||||||
|
|
||||||
|
/* TCP receive window. */
|
||||||
|
#define TCP_WND (2*TCP_MSS)
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- ICMP options ---------- */
|
||||||
|
#define LWIP_ICMP 1
|
||||||
|
|
||||||
|
/* ---------- ARP options ----------- */
|
||||||
|
#define LWIP_ARP 1
|
||||||
|
|
||||||
|
/* ---------- DHCP options ---------- */
|
||||||
|
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||||
|
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
|
||||||
|
turning this on does currently not work. */
|
||||||
|
#define LWIP_DHCP 1
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- UDP options ---------- */
|
||||||
|
#define LWIP_UDP 1
|
||||||
|
#define UDP_TTL 255
|
||||||
|
/* ---------- DNS options ---------- */
|
||||||
|
#define LWIP_DNS 1
|
||||||
|
|
||||||
|
/* ---------- UPNP options --------- */
|
||||||
|
#define LWIP_UPNP 0
|
||||||
|
|
||||||
|
/* Support Multicast */
|
||||||
|
#define LWIP_IGMP 1
|
||||||
|
#define LWIP_RAND() rand()
|
||||||
|
|
||||||
|
/* Support TCP Keepalive */
|
||||||
|
#define LWIP_TCP_KEEPALIVE 1
|
||||||
|
|
||||||
|
/*LWIP_UART_ADAPTER==1: Enable LWIP_UART_ADAPTER when CONFIG_GAGENT is enabled,
|
||||||
|
because some GAGENT functions denpond on the following macro definitions.*/
|
||||||
|
#define LWIP_UART_ADAPTER 0
|
||||||
|
|
||||||
|
#if LWIP_UART_ADAPTER
|
||||||
|
#undef LWIP_SO_SNDTIMEO
|
||||||
|
#define LWIP_SO_SNDTIMEO 1
|
||||||
|
|
||||||
|
#undef SO_REUSE
|
||||||
|
#define SO_REUSE 1
|
||||||
|
|
||||||
|
#undef MEMP_NUM_NETCONN
|
||||||
|
#define MEMP_NUM_NETCONN 10
|
||||||
|
|
||||||
|
#undef TCP_WND
|
||||||
|
#define TCP_WND (4*TCP_MSS)
|
||||||
|
|
||||||
|
#define TCP_KEEPIDLE_DEFAULT 10000UL
|
||||||
|
#define TCP_KEEPINTVL_DEFAULT 1000UL
|
||||||
|
#define TCP_KEEPCNT_DEFAULT 10U
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||||
|
#undef LWIP_SO_SNDTIMEO
|
||||||
|
#define LWIP_SO_SNDTIMEO 1
|
||||||
|
|
||||||
|
#undef SO_REUSE
|
||||||
|
#define SO_REUSE 1
|
||||||
|
|
||||||
|
#undef MEMP_NUM_NETCONN
|
||||||
|
#define MEMP_NUM_NETCONN 10
|
||||||
|
|
||||||
|
#undef MEMP_NUM_TCP_PCB
|
||||||
|
#define MEMP_NUM_TCP_PCB (MEMP_NUM_NETCONN)
|
||||||
|
|
||||||
|
#undef MEMP_NUM_UDP_PCB
|
||||||
|
#define MEMP_NUM_UDP_PCB (MEMP_NUM_NETCONN)
|
||||||
|
|
||||||
|
#undef TCP_WND
|
||||||
|
#define TCP_WND (4*TCP_MSS)
|
||||||
|
|
||||||
|
#define TCP_KEEPIDLE_DEFAULT 10000UL
|
||||||
|
#define TCP_KEEPINTVL_DEFAULT 1000UL
|
||||||
|
#define TCP_KEEPCNT_DEFAULT 10U
|
||||||
|
|
||||||
|
#define ERRNO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ---------- Statistics options ---------- */
|
||||||
|
#define LWIP_STATS 0
|
||||||
|
#define LWIP_PROVIDE_ERRNO 1
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
--------------------------------------
|
||||||
|
---------- Checksum options ----------
|
||||||
|
--------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
|
||||||
|
- To use this feature let the following define uncommented.
|
||||||
|
- To disable it and process by CPU comment the the checksum.
|
||||||
|
*/
|
||||||
|
//Do checksum by lwip - WLAN nic does not support Checksum offload
|
||||||
|
//#define CHECKSUM_BY_HARDWARE
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CHECKSUM_BY_HARDWARE
|
||||||
|
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
|
||||||
|
#define CHECKSUM_GEN_IP 0
|
||||||
|
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
|
||||||
|
#define CHECKSUM_GEN_UDP 0
|
||||||
|
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
|
||||||
|
#define CHECKSUM_GEN_TCP 0
|
||||||
|
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_IP 0
|
||||||
|
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_UDP 0
|
||||||
|
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_TCP 0
|
||||||
|
#else
|
||||||
|
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
|
||||||
|
#define CHECKSUM_GEN_IP 1
|
||||||
|
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
|
||||||
|
#define CHECKSUM_GEN_UDP 1
|
||||||
|
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
|
||||||
|
#define CHECKSUM_GEN_TCP 1
|
||||||
|
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_IP 1
|
||||||
|
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_UDP 1
|
||||||
|
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_TCP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
----------------------------------------------
|
||||||
|
---------- Sequential layer options ----------
|
||||||
|
----------------------------------------------
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
|
||||||
|
*/
|
||||||
|
#define LWIP_NETCONN 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------------------
|
||||||
|
---------- Socket options ----------
|
||||||
|
------------------------------------
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
||||||
|
*/
|
||||||
|
#define LWIP_SOCKET 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
-----------------------------------
|
||||||
|
---------- DEBUG options ----------
|
||||||
|
-----------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LWIP_DEBUG 0
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
---------------------------------
|
||||||
|
---------- OS options ----------
|
||||||
|
---------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TCPIP_THREAD_STACKSIZE 1000
|
||||||
|
#define TCPIP_MBOX_SIZE 6
|
||||||
|
#define DEFAULT_UDP_RECVMBOX_SIZE 6
|
||||||
|
#define DEFAULT_TCP_RECVMBOX_SIZE 6
|
||||||
|
#define DEFAULT_RAW_RECVMBOX_SIZE 6
|
||||||
|
#define DEFAULT_ACCEPTMBOX_SIZE 6
|
||||||
|
#define DEFAULT_THREAD_STACKSIZE 500
|
||||||
|
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __LWIPOPTS_H__ */
|
||||||
|
|
||||||
|
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
312
RTL00_SDKV35a/component/common/api/network/include/lwipopts.h.1
Normal file
312
RTL00_SDKV35a/component/common/api/network/include/lwipopts.h.1
Normal file
|
@ -0,0 +1,312 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file lwipopts.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @version V1.1.0
|
||||||
|
* @date 07-October-2011
|
||||||
|
* @brief lwIP Options Configuration.
|
||||||
|
* This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h
|
||||||
|
* and contains the lwIP configuration for the STM32F2x7 demonstration.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||||
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||||
|
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||||
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||||
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||||
|
*
|
||||||
|
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LWIPOPTS_H__
|
||||||
|
#define __LWIPOPTS_H__
|
||||||
|
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#define WIFI_LOGO_CERTIFICATION_CONFIG 0 //for ping 10k test buffer setting
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
|
||||||
|
* critical regions during buffer allocation, deallocation and memory
|
||||||
|
* allocation and deallocation.
|
||||||
|
*/
|
||||||
|
#define SYS_LIGHTWEIGHT_PROT 1
|
||||||
|
|
||||||
|
/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
|
||||||
|
should be used instead */
|
||||||
|
#define LWIP_COMPAT_MUTEX 1
|
||||||
|
|
||||||
|
#define ETHARP_TRUST_IP_MAC 0
|
||||||
|
#define IP_REASSEMBLY 1
|
||||||
|
#define IP_FRAG 1
|
||||||
|
#define ARP_QUEUEING 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
|
||||||
|
* use lwIP facilities.
|
||||||
|
*/
|
||||||
|
#define NO_SYS 0
|
||||||
|
|
||||||
|
/* ---------- Memory options ---------- */
|
||||||
|
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||||
|
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||||
|
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||||
|
#define MEM_ALIGNMENT 4
|
||||||
|
|
||||||
|
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||||
|
a lot of data that needs to be copied, this should be set high. */
|
||||||
|
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||||
|
#define MEM_SIZE (10*1024) //for ping 10k test
|
||||||
|
#else
|
||||||
|
#define MEM_SIZE (5*1024)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||||
|
sends a lot of data out of ROM (or other static memory), this
|
||||||
|
should be set high. */
|
||||||
|
#define MEMP_NUM_PBUF 100
|
||||||
|
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||||
|
per active UDP "connection". */
|
||||||
|
#define MEMP_NUM_UDP_PCB 6
|
||||||
|
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||||
|
connections. */
|
||||||
|
#define MEMP_NUM_TCP_PCB 10
|
||||||
|
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||||
|
connections. */
|
||||||
|
#define MEMP_NUM_TCP_PCB_LISTEN 5
|
||||||
|
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||||
|
segments. */
|
||||||
|
#define MEMP_NUM_TCP_SEG 20
|
||||||
|
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||||
|
timeouts. */
|
||||||
|
#define MEMP_NUM_SYS_TIMEOUT 10
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- Pbuf options ---------- */
|
||||||
|
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||||
|
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||||
|
#define PBUF_POOL_SIZE 30 //for ping 10k test
|
||||||
|
#else
|
||||||
|
#define PBUF_POOL_SIZE 20
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.*/
|
||||||
|
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||||
|
#define IP_REASS_MAX_PBUFS 30 //for ping 10k test
|
||||||
|
#else
|
||||||
|
#define IP_REASS_MAX_PBUFS 10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||||
|
#define PBUF_POOL_BUFSIZE 500
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- TCP options ---------- */
|
||||||
|
#define LWIP_TCP 1
|
||||||
|
#define TCP_TTL 255
|
||||||
|
|
||||||
|
/* Controls if TCP should queue segments that arrive out of
|
||||||
|
order. Define to 0 if your device is low on memory. */
|
||||||
|
#define TCP_QUEUE_OOSEQ 1
|
||||||
|
|
||||||
|
/* TCP Maximum segment size. */
|
||||||
|
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
|
||||||
|
|
||||||
|
/* TCP sender buffer space (bytes). */
|
||||||
|
#define TCP_SND_BUF (5*TCP_MSS)
|
||||||
|
|
||||||
|
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
|
||||||
|
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
|
||||||
|
|
||||||
|
#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
|
||||||
|
|
||||||
|
/* TCP receive window. */
|
||||||
|
#define TCP_WND (2*TCP_MSS)
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- ICMP options ---------- */
|
||||||
|
#define LWIP_ICMP 1
|
||||||
|
|
||||||
|
/* ---------- ARP options ----------- */
|
||||||
|
#define LWIP_ARP 1
|
||||||
|
|
||||||
|
/* ---------- DHCP options ---------- */
|
||||||
|
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||||
|
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
|
||||||
|
turning this on does currently not work. */
|
||||||
|
#define LWIP_DHCP 1
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- UDP options ---------- */
|
||||||
|
#define LWIP_UDP 1
|
||||||
|
#define UDP_TTL 255
|
||||||
|
/* ---------- DNS options ---------- */
|
||||||
|
#define LWIP_DNS 1
|
||||||
|
|
||||||
|
/* ---------- UPNP options --------- */
|
||||||
|
#define LWIP_UPNP 0
|
||||||
|
|
||||||
|
/* Support Multicast */
|
||||||
|
#define LWIP_IGMP 1
|
||||||
|
#define LWIP_RAND() rand()
|
||||||
|
|
||||||
|
/* Support TCP Keepalive */
|
||||||
|
#define LWIP_TCP_KEEPALIVE 1
|
||||||
|
|
||||||
|
/*LWIP_UART_ADAPTER==1: Enable LWIP_UART_ADAPTER when CONFIG_GAGENT is enabled,
|
||||||
|
because some GAGENT functions denpond on the following macro definitions.*/
|
||||||
|
#if CONFIG_EXAMPLE_UART_ADAPTER
|
||||||
|
#define LWIP_UART_ADAPTER 1
|
||||||
|
#else
|
||||||
|
#define LWIP_UART_ADAPTER 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LWIP_UART_ADAPTER
|
||||||
|
#undef LWIP_SO_SNDTIMEO
|
||||||
|
#define LWIP_SO_SNDTIMEO 1
|
||||||
|
|
||||||
|
#undef SO_REUSE
|
||||||
|
#define SO_REUSE 1
|
||||||
|
|
||||||
|
#undef MEMP_NUM_NETCONN
|
||||||
|
#define MEMP_NUM_NETCONN 10
|
||||||
|
|
||||||
|
#undef TCP_WND
|
||||||
|
#define TCP_WND (4*TCP_MSS)
|
||||||
|
|
||||||
|
#define TCP_KEEPIDLE_DEFAULT 10000UL
|
||||||
|
#define TCP_KEEPINTVL_DEFAULT 1000UL
|
||||||
|
#define TCP_KEEPCNT_DEFAULT 10U
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||||
|
#undef LWIP_SO_SNDTIMEO
|
||||||
|
#define LWIP_SO_SNDTIMEO 1
|
||||||
|
|
||||||
|
#undef SO_REUSE
|
||||||
|
#define SO_REUSE 1
|
||||||
|
|
||||||
|
#undef MEMP_NUM_NETCONN
|
||||||
|
#define MEMP_NUM_NETCONN 10
|
||||||
|
|
||||||
|
#undef MEMP_NUM_TCP_PCB
|
||||||
|
#define MEMP_NUM_TCP_PCB (MEMP_NUM_NETCONN)
|
||||||
|
|
||||||
|
#undef MEMP_NUM_UDP_PCB
|
||||||
|
#define MEMP_NUM_UDP_PCB (MEMP_NUM_NETCONN)
|
||||||
|
|
||||||
|
#undef TCP_WND
|
||||||
|
#define TCP_WND (4*TCP_MSS)
|
||||||
|
|
||||||
|
#define TCP_KEEPIDLE_DEFAULT 10000UL
|
||||||
|
#define TCP_KEEPINTVL_DEFAULT 1000UL
|
||||||
|
#define TCP_KEEPCNT_DEFAULT 10U
|
||||||
|
|
||||||
|
#define ERRNO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ---------- Statistics options ---------- */
|
||||||
|
#define LWIP_STATS 0
|
||||||
|
#define LWIP_PROVIDE_ERRNO 1
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
--------------------------------------
|
||||||
|
---------- Checksum options ----------
|
||||||
|
--------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
|
||||||
|
- To use this feature let the following define uncommented.
|
||||||
|
- To disable it and process by CPU comment the the checksum.
|
||||||
|
*/
|
||||||
|
//Do checksum by lwip - WLAN nic does not support Checksum offload
|
||||||
|
//#define CHECKSUM_BY_HARDWARE
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CHECKSUM_BY_HARDWARE
|
||||||
|
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
|
||||||
|
#define CHECKSUM_GEN_IP 0
|
||||||
|
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
|
||||||
|
#define CHECKSUM_GEN_UDP 0
|
||||||
|
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
|
||||||
|
#define CHECKSUM_GEN_TCP 0
|
||||||
|
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_IP 0
|
||||||
|
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_UDP 0
|
||||||
|
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_TCP 0
|
||||||
|
#else
|
||||||
|
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
|
||||||
|
#define CHECKSUM_GEN_IP 1
|
||||||
|
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
|
||||||
|
#define CHECKSUM_GEN_UDP 1
|
||||||
|
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
|
||||||
|
#define CHECKSUM_GEN_TCP 1
|
||||||
|
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_IP 1
|
||||||
|
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_UDP 1
|
||||||
|
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
|
||||||
|
#define CHECKSUM_CHECK_TCP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
----------------------------------------------
|
||||||
|
---------- Sequential layer options ----------
|
||||||
|
----------------------------------------------
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
|
||||||
|
*/
|
||||||
|
#define LWIP_NETCONN 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------------------
|
||||||
|
---------- Socket options ----------
|
||||||
|
------------------------------------
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
||||||
|
*/
|
||||||
|
#define LWIP_SOCKET 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
-----------------------------------
|
||||||
|
---------- DEBUG options ----------
|
||||||
|
-----------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LWIP_DEBUG 0
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
---------------------------------
|
||||||
|
---------- OS options ----------
|
||||||
|
---------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TCPIP_THREAD_STACKSIZE 1000
|
||||||
|
#define TCPIP_MBOX_SIZE 6
|
||||||
|
#define DEFAULT_UDP_RECVMBOX_SIZE 6
|
||||||
|
#define DEFAULT_TCP_RECVMBOX_SIZE 6
|
||||||
|
#define DEFAULT_RAW_RECVMBOX_SIZE 6
|
||||||
|
#define DEFAULT_ACCEPTMBOX_SIZE 6
|
||||||
|
#define DEFAULT_THREAD_STACKSIZE 500
|
||||||
|
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
|
||||||
|
|
||||||
|
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
|
||||||
|
* by your system, set this to 0 and include <sys/time.h> in cc.h */
|
||||||
|
#if defined(_SYS__TIMEVAL_H_)
|
||||||
|
#define LWIP_TIMEVAL_PRIVATE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __LWIPOPTS_H__ */
|
||||||
|
|
||||||
|
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
68
RTL00_SDKV35a/component/common/api/network/include/main.h.0
Normal file
68
RTL00_SDKV35a/component/common/api/network/include/main.h.0
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
#ifndef MAIN_H
|
||||||
|
#define MAIN_H
|
||||||
|
|
||||||
|
#include <autoconf.h>
|
||||||
|
|
||||||
|
//#define CONFIG_WLAN 1
|
||||||
|
|
||||||
|
|
||||||
|
/* Header file declaration*/
|
||||||
|
void wlan_network();
|
||||||
|
|
||||||
|
|
||||||
|
/* Interactive Mode */
|
||||||
|
#define SERIAL_DEBUG_RX 1
|
||||||
|
#if defined(__ICCARM__)
|
||||||
|
static
|
||||||
|
#endif
|
||||||
|
char uart_buf[64];
|
||||||
|
|
||||||
|
|
||||||
|
/* WLAN and Netork */
|
||||||
|
#define STA_MODE_SSID "ap" /* Set SSID here */
|
||||||
|
#define AP_MODE_SSID "wlan_ap_ssid" /* Set SSID here */
|
||||||
|
#define AP_DEFAULT_CH 6
|
||||||
|
#define WLAN0_NAME "wlan0"
|
||||||
|
#define WLAN1_NAME "wlan1"
|
||||||
|
#define WPA_PASSPHRASE "1234567890" /* Max 32 cahracters */
|
||||||
|
#define WEP40_KEY {0x12, 0x34, 0x56, 0x78, 0x90}
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#define IP_ADDR0 192
|
||||||
|
#define IP_ADDR1 168
|
||||||
|
#define IP_ADDR2 3
|
||||||
|
#define IP_ADDR3 80
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#define NETMASK_ADDR0 255
|
||||||
|
#define NETMASK_ADDR1 255
|
||||||
|
#define NETMASK_ADDR2 255
|
||||||
|
#define NETMASK_ADDR3 0
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#define GW_ADDR0 192
|
||||||
|
#define GW_ADDR1 168
|
||||||
|
#define GW_ADDR2 3
|
||||||
|
#define GW_ADDR3 1
|
||||||
|
|
||||||
|
/*******************************************/
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#define AP_IP_ADDR0 192
|
||||||
|
#define AP_IP_ADDR1 168
|
||||||
|
#define AP_IP_ADDR2 43
|
||||||
|
#define AP_IP_ADDR3 1
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#define AP_NETMASK_ADDR0 255
|
||||||
|
#define AP_NETMASK_ADDR1 255
|
||||||
|
#define AP_NETMASK_ADDR2 255
|
||||||
|
#define AP_NETMASK_ADDR3 0
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#define AP_GW_ADDR0 192
|
||||||
|
#define AP_GW_ADDR1 168
|
||||||
|
#define AP_GW_ADDR2 43
|
||||||
|
#define AP_GW_ADDR3 1
|
||||||
|
|
||||||
|
#endif
|
68
RTL00_SDKV35a/component/common/api/network/include/main.h.1
Normal file
68
RTL00_SDKV35a/component/common/api/network/include/main.h.1
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
#ifndef MAIN_H
|
||||||
|
#define MAIN_H
|
||||||
|
|
||||||
|
#include <autoconf.h>
|
||||||
|
|
||||||
|
//#define CONFIG_WLAN 1
|
||||||
|
|
||||||
|
|
||||||
|
/* Header file declaration*/
|
||||||
|
void wlan_network();
|
||||||
|
|
||||||
|
|
||||||
|
/* Interactive Mode */
|
||||||
|
#define SERIAL_DEBUG_RX 1
|
||||||
|
#if defined(__ICCARM__)
|
||||||
|
static
|
||||||
|
#endif
|
||||||
|
extern char uart_buf[64];
|
||||||
|
|
||||||
|
|
||||||
|
/* WLAN and Netork */
|
||||||
|
#define STA_MODE_SSID "ap" /* Set SSID here */
|
||||||
|
#define AP_MODE_SSID "wlan_ap_ssid" /* Set SSID here */
|
||||||
|
#define AP_DEFAULT_CH 6
|
||||||
|
#define WLAN0_NAME "wlan0"
|
||||||
|
#define WLAN1_NAME "wlan1"
|
||||||
|
#define WPA_PASSPHRASE "1234567890" /* Max 32 cahracters */
|
||||||
|
#define WEP40_KEY {0x12, 0x34, 0x56, 0x78, 0x90}
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#define IP_ADDR0 192
|
||||||
|
#define IP_ADDR1 168
|
||||||
|
#define IP_ADDR2 3
|
||||||
|
#define IP_ADDR3 80
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#define NETMASK_ADDR0 255
|
||||||
|
#define NETMASK_ADDR1 255
|
||||||
|
#define NETMASK_ADDR2 255
|
||||||
|
#define NETMASK_ADDR3 0
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#define GW_ADDR0 192
|
||||||
|
#define GW_ADDR1 168
|
||||||
|
#define GW_ADDR2 3
|
||||||
|
#define GW_ADDR3 1
|
||||||
|
|
||||||
|
/*******************************************/
|
||||||
|
|
||||||
|
/*Static IP ADDRESS*/
|
||||||
|
#define AP_IP_ADDR0 192
|
||||||
|
#define AP_IP_ADDR1 168
|
||||||
|
#define AP_IP_ADDR2 43
|
||||||
|
#define AP_IP_ADDR3 1
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#define AP_NETMASK_ADDR0 255
|
||||||
|
#define AP_NETMASK_ADDR1 255
|
||||||
|
#define AP_NETMASK_ADDR2 255
|
||||||
|
#define AP_NETMASK_ADDR3 0
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#define AP_GW_ADDR0 192
|
||||||
|
#define AP_GW_ADDR1 168
|
||||||
|
#define AP_GW_ADDR2 43
|
||||||
|
#define AP_GW_ADDR3 1
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,21 @@
|
||||||
|
//----------------------------------------------------------------------------//
|
||||||
|
#ifndef __MAIN_TEST_H
|
||||||
|
#define __MAIN_TEST_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported test functions ------------------------------------------------------- */
|
||||||
|
void do_ping_test(char *ip, int size, int count, int interval);
|
||||||
|
void do_ping_call(char *ip, int loop, int count);
|
||||||
|
void interactive_question(char *question, char *choice, char *buf, int buf_size);
|
||||||
|
void start_interactive_mode(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __MAIN_TEST_H
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------//
|
50
RTL00_SDKV35a/component/common/api/network/include/netconf.h
Normal file
50
RTL00_SDKV35a/component/common/api/network/include/netconf.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file netconf.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @version V1.1.0
|
||||||
|
* @date 07-October-2011
|
||||||
|
* @brief This file contains all the functions prototypes for the netconf.c
|
||||||
|
* file.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||||
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||||
|
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||||
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||||
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||||
|
*
|
||||||
|
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __NETCONF_H
|
||||||
|
#define __NETCONF_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// TODO: remove this file
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
#if 0
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
void LwIP_Init(void);
|
||||||
|
void LwIP_DHCP(void);
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __NETCONF_H */
|
||||||
|
|
||||||
|
|
||||||
|
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
#ifndef __RTL8195A_IT_H_
|
||||||
|
#define __RTL8195A_IT_H_
|
||||||
|
|
||||||
|
|
||||||
|
int irq_alloc_wlan(void *contex);
|
||||||
|
|
||||||
|
#endif //__RTL8195A_IT_H_
|
46
RTL00_SDKV35a/component/common/api/network/include/util.h
Normal file
46
RTL00_SDKV35a/component/common/api/network/include/util.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef _UTIL_H
|
||||||
|
#define _UTIL_H
|
||||||
|
|
||||||
|
#include <wireless.h>
|
||||||
|
#include <wlan_intf.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wifi_util.h"
|
||||||
|
#if 0
|
||||||
|
typedef enum _WIFI_EVENT_INDICATE{
|
||||||
|
WIFI_EVENT_CONNECT = 0,
|
||||||
|
WIFI_EVENT_DISCONNECT = 1,
|
||||||
|
WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
|
||||||
|
}WIFI_EVENT_INDICATE;
|
||||||
|
|
||||||
|
int wext_get_ssid(const char *ifname, __u8 *ssid);
|
||||||
|
int wext_set_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
|
||||||
|
int wext_set_auth_param(const char *ifname, __u16 idx, __u32 value);
|
||||||
|
int wext_set_key_ext(const char *ifname, __u16 alg, const __u8 *addr, int key_idx, int set_tx, const __u8 *seq, __u16 seq_len, __u8 *key, __u16 key_len);
|
||||||
|
int wext_get_enc_ext(const char *ifname, __u16 *alg);
|
||||||
|
int wext_set_passphrase(const char *ifname, const __u8 *passphrase, __u16 passphrase_len);
|
||||||
|
int wext_get_passphrase(const char *ifname, __u8 *passphrase);
|
||||||
|
int wext_set_mode(const char *ifname, int mode);
|
||||||
|
int wext_get_mode(const char *ifname, int *mode);
|
||||||
|
int wext_set_ap_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
|
||||||
|
int wext_set_country(const char *ifname, char *country_code);
|
||||||
|
int wext_get_rssi(const char *ifname, int *rssi);
|
||||||
|
int wext_set_channel(const char *ifname, __u8 ch);
|
||||||
|
int wext_get_channel(const char *ifname, __u8 *ch);
|
||||||
|
int wext_set_scan(const char *ifname, char *buf, __u16 buf_len);
|
||||||
|
int wext_get_scan(const char *ifname, char *buf, __u16 buf_len);
|
||||||
|
int wext_mp_command(const char *ifname, char *cmd, int show_msg);
|
||||||
|
int wext_wifi_priv(const char *ifname, int argc, char **argv);
|
||||||
|
void wext_wlan_indicate(unsigned int cmd, union iwreq_data *wrqu, char *extra);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define wext_handshake_done rltk_wlan_handshake_done
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _UTIL_H */
|
222
RTL00_SDKV35a/component/common/api/network/src/ping_test.c
Normal file
222
RTL00_SDKV35a/component/common/api/network/src/ping_test.c
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
#include <lwip/sockets.h>
|
||||||
|
#if LWIP_SOCKET
|
||||||
|
#include <lwip/raw.h>
|
||||||
|
#include <lwip/icmp.h>
|
||||||
|
#include <lwip/inet_chksum.h>
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
|
||||||
|
//#define PING_IP "192.168.0.1"
|
||||||
|
#define PING_IP "192.168.159.1"
|
||||||
|
#define PING_TO 1000
|
||||||
|
#define PING_ID 0xABCD
|
||||||
|
#define BUF_SIZE 10000
|
||||||
|
#define STACKSIZE 1024
|
||||||
|
|
||||||
|
static unsigned short ping_seq = 0;
|
||||||
|
static int infinite_loop, ping_count, data_size, ping_interval, ping_call;
|
||||||
|
static char ping_ip[16];
|
||||||
|
|
||||||
|
static void generate_ping_echo(unsigned char *buf, int size)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct icmp_echo_hdr *pecho;
|
||||||
|
|
||||||
|
for(i = 0; i < size; i ++) {
|
||||||
|
buf[sizeof(struct icmp_echo_hdr) + i] = (unsigned char) i;
|
||||||
|
}
|
||||||
|
|
||||||
|
pecho = (struct icmp_echo_hdr *) buf;
|
||||||
|
ICMPH_TYPE_SET(pecho, ICMP_ECHO);
|
||||||
|
ICMPH_CODE_SET(pecho, 0);
|
||||||
|
pecho->chksum = 0;
|
||||||
|
pecho->id = PING_ID;
|
||||||
|
pecho->seqno = htons(++ ping_seq);
|
||||||
|
|
||||||
|
//Checksum includes icmp header and data. Need to calculate after fill up icmp header
|
||||||
|
pecho->chksum = inet_chksum(pecho, sizeof(struct icmp_echo_hdr) + size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ping_test(void *param)
|
||||||
|
//void ping_test()
|
||||||
|
{
|
||||||
|
int i, ping_socket;
|
||||||
|
int pint_timeout = PING_TO;
|
||||||
|
struct sockaddr_in to_addr, from_addr;
|
||||||
|
int from_addr_len = sizeof(struct sockaddr);
|
||||||
|
int ping_size, reply_size;
|
||||||
|
unsigned char *ping_buf, *reply_buf;
|
||||||
|
unsigned int ping_time, reply_time;
|
||||||
|
struct ip_hdr *iphdr;
|
||||||
|
struct icmp_echo_hdr *pecho;
|
||||||
|
|
||||||
|
if(data_size > BUF_SIZE){
|
||||||
|
printf("[ERROR] %s: data size error, can't exceed %d\n",__func__,BUF_SIZE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ping size = icmp header(8 bytes) + data size
|
||||||
|
ping_size = sizeof(struct icmp_echo_hdr) + data_size;
|
||||||
|
|
||||||
|
ping_buf = pvPortMalloc(ping_size);
|
||||||
|
if(NULL == ping_buf){
|
||||||
|
printf("[ERROR] %s: Allocate ping_buf failed\n",__func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reply_buf = pvPortMalloc(ping_size);
|
||||||
|
if(NULL == reply_buf){
|
||||||
|
vPortFree(ping_buf);
|
||||||
|
printf("[ERROR] %s: Allocate reply_buf failed\n",__func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("[%s] PING %s %d(%d) bytes of data\n", __FUNCTION__, ping_ip, data_size, sizeof(struct ip_hdr) + sizeof(struct icmp_echo_hdr) + data_size);
|
||||||
|
|
||||||
|
for(i = 0; (i < ping_count) || (infinite_loop == 1); i ++) {
|
||||||
|
ping_socket = socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP);
|
||||||
|
#ifdef CONFIG_LWIP_1_5_0
|
||||||
|
struct timeval timeout;
|
||||||
|
timeout.tv_sec = pint_timeout / 1000;
|
||||||
|
timeout.tv_usec = pint_timeout % 1000 * 1000;
|
||||||
|
setsockopt(ping_socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
|
||||||
|
#else
|
||||||
|
setsockopt(ping_socket, SOL_SOCKET, SO_RCVTIMEO, &pint_timeout, sizeof(pint_timeout));
|
||||||
|
#endif
|
||||||
|
to_addr.sin_len = sizeof(to_addr);
|
||||||
|
to_addr.sin_family = AF_INET;
|
||||||
|
to_addr.sin_addr.s_addr = inet_addr(ping_ip);
|
||||||
|
|
||||||
|
generate_ping_echo(ping_buf, data_size);
|
||||||
|
sendto(ping_socket, ping_buf, ping_size, 0, (struct sockaddr *) &to_addr, sizeof(to_addr));
|
||||||
|
|
||||||
|
ping_time = xTaskGetTickCount();
|
||||||
|
if((reply_size = recvfrom(ping_socket, reply_buf, ping_size, 0, (struct sockaddr *) &from_addr, (socklen_t *) &from_addr_len))
|
||||||
|
>= (int)(sizeof(struct ip_hdr) + sizeof(struct icmp_echo_hdr))) {
|
||||||
|
|
||||||
|
reply_time = xTaskGetTickCount();
|
||||||
|
iphdr = (struct ip_hdr *)reply_buf;
|
||||||
|
pecho = (struct icmp_echo_hdr *)(reply_buf + (IPH_HL(iphdr) * 4));
|
||||||
|
|
||||||
|
if((pecho->id == PING_ID) && (pecho->seqno == htons(ping_seq))) {
|
||||||
|
printf("[%s] %d bytes from %s: icmp_seq=%d time=%d ms\n", __FUNCTION__, reply_size - sizeof(struct ip_hdr), inet_ntoa(from_addr.sin_addr), htons(pecho->seqno), (reply_time - ping_time) * portTICK_RATE_MS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("[%s] Request timeout for icmp_seq %d\n", __FUNCTION__, ping_seq);
|
||||||
|
|
||||||
|
close(ping_socket);
|
||||||
|
vTaskDelay(ping_interval * configTICK_RATE_HZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
vPortFree(ping_buf);
|
||||||
|
vPortFree(reply_buf);
|
||||||
|
|
||||||
|
if(!ping_call)
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_ping_call(char *ip, int loop, int count)
|
||||||
|
{
|
||||||
|
ping_call = 1;
|
||||||
|
ping_seq = 0;
|
||||||
|
data_size = 120;
|
||||||
|
ping_interval = 1;
|
||||||
|
infinite_loop = loop;
|
||||||
|
ping_count = count;
|
||||||
|
strcpy(ping_ip, ip);
|
||||||
|
ping_test(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_ping(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int argv_count = 2;
|
||||||
|
|
||||||
|
if(argc < 2)
|
||||||
|
goto Exit;
|
||||||
|
|
||||||
|
//ping cmd default value
|
||||||
|
infinite_loop = 0;
|
||||||
|
ping_count = 4;
|
||||||
|
data_size = 32;
|
||||||
|
ping_interval = 1;
|
||||||
|
ping_call = 1;
|
||||||
|
ping_seq = 0;
|
||||||
|
|
||||||
|
while(argv_count<=argc){
|
||||||
|
//first operation
|
||||||
|
if(argv_count == 2){
|
||||||
|
memset(ping_ip, 0, sizeof(ping_ip));
|
||||||
|
strncpy(ping_ip, argv[argv_count-1], (strlen(argv[argv_count-1])>16)?16:strlen(argv[argv_count-1]));
|
||||||
|
argv_count++;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(strcmp(argv[argv_count-1], "-t") == 0){
|
||||||
|
infinite_loop = 1;
|
||||||
|
argv_count++;
|
||||||
|
}
|
||||||
|
else if(strcmp(argv[argv_count-1], "-n") == 0){
|
||||||
|
if(argc < (argv_count+1))
|
||||||
|
goto Exit;
|
||||||
|
ping_count = (int) atoi(argv[argv_count]);
|
||||||
|
argv_count+=2;
|
||||||
|
}
|
||||||
|
else if(strcmp(argv[argv_count-1], "-l") == 0){
|
||||||
|
if(argc < (argv_count+1))
|
||||||
|
goto Exit;
|
||||||
|
data_size = (int) atoi(argv[argv_count]);
|
||||||
|
argv_count+=2;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ping_test(NULL);
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
printf("[ATWI] Usage: ATWI=[host],[options]\n");
|
||||||
|
printf("\t-t\tPing the specified host until stopped\n");
|
||||||
|
printf("\t-n\t# Number of echo requests to send (default 4 times)\n");
|
||||||
|
printf("\t-l\t# Send buffer size (default 32 bytes)\n");
|
||||||
|
printf("\tExample:\n");
|
||||||
|
printf("\t\tATWI=192.168.1.2,-n,100,-l,5000\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_ping_test(char *ip, int size, int count, int interval)
|
||||||
|
{
|
||||||
|
if((sizeof(struct icmp_echo_hdr) + size) > BUF_SIZE) {
|
||||||
|
printf("%s BUF_SIZE(%d) is too small\n", __FUNCTION__, BUF_SIZE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ip == NULL)
|
||||||
|
strcpy(ping_ip, PING_IP);
|
||||||
|
else
|
||||||
|
strcpy(ping_ip, ip);
|
||||||
|
|
||||||
|
ping_call = 0;
|
||||||
|
ping_seq = 0;
|
||||||
|
data_size = size;
|
||||||
|
ping_interval = interval;
|
||||||
|
|
||||||
|
if(count == 0) {
|
||||||
|
infinite_loop = 1;
|
||||||
|
ping_count = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
infinite_loop = 0;
|
||||||
|
ping_count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xTaskCreate(ping_test, ((const signed char*)"ping_test"), STACKSIZE, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
|
||||||
|
printf("%s xTaskCreate failed\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
#endif // LWIP_SOCKET
|
110
RTL00_SDKV35a/component/common/api/network/src/rtl8195a_it.c
Normal file
110
RTL00_SDKV35a/component/common/api/network/src/rtl8195a_it.c
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
#include "rtl8195a.h"
|
||||||
|
#include <main.h>
|
||||||
|
#include "rtl8195a_it.h"
|
||||||
|
|
||||||
|
/* os dependent*/
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <diag.h>
|
||||||
|
#define printf DiagPrintf
|
||||||
|
|
||||||
|
/*-----------------------------Global Variable ---------------------*/
|
||||||
|
//#ifdef CONFIG_WLAN
|
||||||
|
//#ifdef CONFIG_ISR_THREAD_MODE_INTERRUPT
|
||||||
|
extern xSemaphoreHandle *pExportWlanIrqSemaphore;
|
||||||
|
//#endif
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_WLAN
|
||||||
|
#ifdef CONFIG_ISR_THREAD_MODE_INTERRUPT
|
||||||
|
|
||||||
|
//TODO: chris
|
||||||
|
#define IRQ_HANDLED 1
|
||||||
|
#define IRQ_NONE 0
|
||||||
|
|
||||||
|
int wlan_Interrupt (
|
||||||
|
IN VOID* Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if 1
|
||||||
|
|
||||||
|
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
|
||||||
|
printf("wlan interrupt\n");
|
||||||
|
/* This semaphore is initialized once wlan interrupt handler thread is created and initialized*/
|
||||||
|
if(!pExportWlanIrqSemaphore)
|
||||||
|
{
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
xSemaphoreGiveFromISR( *pExportWlanIrqSemaphore, &xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
/* Switch tasks if necessary. */
|
||||||
|
if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
|
{
|
||||||
|
printf("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
#else
|
||||||
|
struct dvobj_priv *dvobj = (struct dvobj_priv *)Data;
|
||||||
|
_adapter *adapter = dvobj->if1;
|
||||||
|
DBG_8192C("Dma isr\n");
|
||||||
|
|
||||||
|
if (dvobj->irq_enabled == 0) {
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
DBG_871X("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
if(rtw_hal_interrupt_handler(adapter) == _FAIL)
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
//return IRQ_NONE;
|
||||||
|
DBG_871X("%s(%d)\n", __FUNCTION__, __LINE__);
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
lextra_bus_dma_Interrupt (
|
||||||
|
IN VOID* Data
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function register interrupt handler and is called by wlan driver
|
||||||
|
* Return 0 if success, Others if fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
int irq_alloc_wlan(void *contex)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
IRQ_HANDLE IrqHandle = {0};
|
||||||
|
|
||||||
|
printf("Register Interrupt\n");
|
||||||
|
IrqHandle.Data = (u32) (contex);
|
||||||
|
IrqHandle.IrqNum = WL_DMA_IRQ;
|
||||||
|
IrqHandle.IrqFun = (IRQ_FUN)wlan_Interrupt;
|
||||||
|
//IrqHandle.IrqFun = (IRQ_FUN)lextra_bus_dma_Interrupt;
|
||||||
|
IrqHandle.Priority = 0;
|
||||||
|
|
||||||
|
InterruptRegister(&IrqHandle);
|
||||||
|
InterruptEn(&IrqHandle);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
* Hello World
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "main_test.h"
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
#include "wifi_conf.h"
|
||||||
|
#include "wlan_intf.h"
|
||||||
|
#include "wifi_constants.h"
|
||||||
|
#endif
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
//#include "wifi_interactive_ext.h"
|
||||||
|
|
||||||
|
#ifndef CONFIG_INIT_NET
|
||||||
|
#define CONFIG_INIT_NET 1
|
||||||
|
#endif
|
||||||
|
#ifndef CONFIG_INTERACTIVE_MODE
|
||||||
|
#define CONFIG_INTERACTIVE_MODE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define STACKSIZE (512 + 768)
|
||||||
|
|
||||||
|
xSemaphoreHandle uart_rx_interrupt_sema = NULL;
|
||||||
|
|
||||||
|
void init_thread(void *param)
|
||||||
|
{
|
||||||
|
|
||||||
|
#if CONFIG_INIT_NET
|
||||||
|
#if CONFIG_LWIP_LAYER
|
||||||
|
/* Initilaize the LwIP stack */
|
||||||
|
// DBG_8195A("\nLwIP Init\n");
|
||||||
|
LwIP_Init();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if CONFIG_WIFI_IND_USE_THREAD
|
||||||
|
wifi_manager_init();
|
||||||
|
#endif
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
// DBG_8195A("\nWiFi_on(RTW_MODE_STA)\n");
|
||||||
|
wifi_on(RTW_MODE_STA);
|
||||||
|
#if CONFIG_AUTO_RECONNECT
|
||||||
|
//setup reconnection flag
|
||||||
|
// u8 mode;
|
||||||
|
// if(wifi_get_autoreconnect(&mode) > 0 && mode != 1)
|
||||||
|
wifi_set_autoreconnect(1);
|
||||||
|
#endif
|
||||||
|
// printf("\n\r%s(%d), Available heap %d\n\r", __FUNCTION__, __LINE__, xPortGetFreeHeapSize());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_INTERACTIVE_MODE
|
||||||
|
/* Initial uart rx swmaphore*/
|
||||||
|
vSemaphoreCreateBinary(uart_rx_interrupt_sema);
|
||||||
|
xSemaphoreTake(uart_rx_interrupt_sema, 1/portTICK_RATE_MS);
|
||||||
|
start_interactive_mode();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Kill init thread after all init tasks done */
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wlan_network()
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
void *stack_addr = tcm_heap_malloc(STACKSIZE*sizeof(int));
|
||||||
|
if(stack_addr == NULL){
|
||||||
|
printf("%s: Out of TCM heap!\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
if (xTaskGenericCreate(
|
||||||
|
init_thread,
|
||||||
|
(const char *)"init",
|
||||||
|
STACKSIZE,
|
||||||
|
NULL,
|
||||||
|
tskIDLE_PRIORITY + 3 + PRIORITIE_OFFSET,
|
||||||
|
NULL,
|
||||||
|
stack_addr,
|
||||||
|
NULL) != pdTRUE)
|
||||||
|
printf("%s: xTaskCreate(init_thread) failed\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(xTaskCreate(init_thread, ((const char*)"init"), STACKSIZE, NULL, tskIDLE_PRIORITY + 3 + PRIORITIE_OFFSET, NULL) != pdPASS) // +3
|
||||||
|
printf("%s: xTaskCreate(init_thread) failed\n", __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
}
|
262
RTL00_SDKV35a/component/common/api/platform/dlist.h
Normal file
262
RTL00_SDKV35a/component/common/api/platform/dlist.h
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
#ifndef __LIST_H
|
||||||
|
#define __LIST_H
|
||||||
|
|
||||||
|
#if defined ( __CC_ARM )
|
||||||
|
#ifndef inline
|
||||||
|
#define inline __inline
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This file is from Linux Kernel (include/linux/list.h)
|
||||||
|
* and modified by simply removing hardware prefetching of list items.
|
||||||
|
* Here by copyright, credits attributed to wherever they belong.
|
||||||
|
* Kulesh Shanmugasundaram (kulesh [squiggly] isis.poly.edu)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Simple doubly linked list implementation.
|
||||||
|
*
|
||||||
|
* Some of the internal functions ("__xxx") are useful when
|
||||||
|
* manipulating whole lists rather than single entries, as
|
||||||
|
* sometimes we already know the next/prev entries and we can
|
||||||
|
* generate better code by using them directly rather than
|
||||||
|
* using the generic single-entry routines.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct list_head {
|
||||||
|
struct list_head *next, *prev;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||||
|
|
||||||
|
#define LIST_HEAD(name) \
|
||||||
|
struct list_head name = LIST_HEAD_INIT(name)
|
||||||
|
|
||||||
|
#define INIT_LIST_HEAD(ptr) do { \
|
||||||
|
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert a new entry between two known consecutive entries.
|
||||||
|
*
|
||||||
|
* This is only for internal list manipulation where we know
|
||||||
|
* the prev/next entries already!
|
||||||
|
*/
|
||||||
|
static inline void __list_add(struct list_head *new,
|
||||||
|
struct list_head *prev,
|
||||||
|
struct list_head *next)
|
||||||
|
{
|
||||||
|
next->prev = new;
|
||||||
|
new->next = next;
|
||||||
|
new->prev = prev;
|
||||||
|
prev->next = new;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_add - add a new entry
|
||||||
|
* @new: new entry to be added
|
||||||
|
* @head: list head to add it after
|
||||||
|
*
|
||||||
|
* Insert a new entry after the specified head.
|
||||||
|
* This is good for implementing stacks.
|
||||||
|
*/
|
||||||
|
static inline void list_add(struct list_head *new, struct list_head *head)
|
||||||
|
{
|
||||||
|
__list_add(new, head, head->next);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_add_tail - add a new entry
|
||||||
|
* @new: new entry to be added
|
||||||
|
* @head: list head to add it before
|
||||||
|
*
|
||||||
|
* Insert a new entry before the specified head.
|
||||||
|
* This is useful for implementing queues.
|
||||||
|
*/
|
||||||
|
static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
||||||
|
{
|
||||||
|
__list_add(new, head->prev, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Delete a list entry by making the prev/next entries
|
||||||
|
* point to each other.
|
||||||
|
*
|
||||||
|
* This is only for internal list manipulation where we know
|
||||||
|
* the prev/next entries already!
|
||||||
|
*/
|
||||||
|
static inline void __list_del(struct list_head *prev, struct list_head *next)
|
||||||
|
{
|
||||||
|
next->prev = prev;
|
||||||
|
prev->next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_del - deletes entry from list.
|
||||||
|
* @entry: the element to delete from the list.
|
||||||
|
* Note: list_empty on entry does not return true after this, the entry is in an undefined state.
|
||||||
|
*/
|
||||||
|
static inline void list_del(struct list_head *entry)
|
||||||
|
{
|
||||||
|
__list_del(entry->prev, entry->next);
|
||||||
|
entry->next = (void *) 0;
|
||||||
|
entry->prev = (void *) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_del_init - deletes entry from list and reinitialize it.
|
||||||
|
* @entry: the element to delete from the list.
|
||||||
|
*/
|
||||||
|
static inline void list_del_init(struct list_head *entry)
|
||||||
|
{
|
||||||
|
__list_del(entry->prev, entry->next);
|
||||||
|
INIT_LIST_HEAD(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_move - delete from one list and add as another's head
|
||||||
|
* @list: the entry to move
|
||||||
|
* @head: the head that will precede our entry
|
||||||
|
*/
|
||||||
|
static inline void list_move(struct list_head *list, struct list_head *head)
|
||||||
|
{
|
||||||
|
__list_del(list->prev, list->next);
|
||||||
|
list_add(list, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_move_tail - delete from one list and add as another's tail
|
||||||
|
* @list: the entry to move
|
||||||
|
* @head: the head that will follow our entry
|
||||||
|
*/
|
||||||
|
static inline void list_move_tail(struct list_head *list,
|
||||||
|
struct list_head *head)
|
||||||
|
{
|
||||||
|
__list_del(list->prev, list->next);
|
||||||
|
list_add_tail(list, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_empty - tests whether a list is empty
|
||||||
|
* @head: the list to test.
|
||||||
|
*/
|
||||||
|
static inline int list_empty(struct list_head *head)
|
||||||
|
{
|
||||||
|
return head->next == head;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __list_splice(struct list_head *list,
|
||||||
|
struct list_head *head)
|
||||||
|
{
|
||||||
|
struct list_head *first = list->next;
|
||||||
|
struct list_head *last = list->prev;
|
||||||
|
struct list_head *at = head->next;
|
||||||
|
|
||||||
|
first->prev = head;
|
||||||
|
head->next = first;
|
||||||
|
|
||||||
|
last->next = at;
|
||||||
|
at->prev = last;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_splice - join two lists
|
||||||
|
* @list: the new list to add.
|
||||||
|
* @head: the place to add it in the first list.
|
||||||
|
*/
|
||||||
|
static inline void list_splice(struct list_head *list, struct list_head *head)
|
||||||
|
{
|
||||||
|
if (!list_empty(list))
|
||||||
|
__list_splice(list, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_splice_init - join two lists and reinitialise the emptied list.
|
||||||
|
* @list: the new list to add.
|
||||||
|
* @head: the place to add it in the first list.
|
||||||
|
*
|
||||||
|
* The list at @list is reinitialised
|
||||||
|
*/
|
||||||
|
static inline void list_splice_init(struct list_head *list,
|
||||||
|
struct list_head *head)
|
||||||
|
{
|
||||||
|
if (!list_empty(list)) {
|
||||||
|
__list_splice(list, head);
|
||||||
|
INIT_LIST_HEAD(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_entry - get the struct for this entry
|
||||||
|
* @ptr: the &struct list_head pointer.
|
||||||
|
* @type: the type of the struct this is embedded in.
|
||||||
|
* @member: the name of the list_struct within the struct.
|
||||||
|
*/
|
||||||
|
#define list_entry(ptr, type, member) \
|
||||||
|
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_first_entry - get the first element from a list
|
||||||
|
* @ptr: the list head to take the element from.
|
||||||
|
* @type: the type of the struct this is embedded in.
|
||||||
|
* @member: the name of the list_head within the struct.
|
||||||
|
*
|
||||||
|
* Note, that list is expected to be not empty.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define list_first_entry(ptr, type, member) \
|
||||||
|
list_entry((ptr)->next, type, member)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_for_each - iterate over a list
|
||||||
|
* @pos: the &struct list_head to use as a loop counter.
|
||||||
|
* @head: the head for your list.
|
||||||
|
*/
|
||||||
|
#define list_for_each(pos, head) \
|
||||||
|
for (pos = (head)->next; pos != (head); \
|
||||||
|
pos = pos->next)
|
||||||
|
/**
|
||||||
|
* list_for_each_prev - iterate over a list backwards
|
||||||
|
* @pos: the &struct list_head to use as a loop counter.
|
||||||
|
* @head: the head for your list.
|
||||||
|
*/
|
||||||
|
#define list_for_each_prev(pos, head) \
|
||||||
|
for (pos = (head)->prev; pos != (head); \
|
||||||
|
pos = pos->prev)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_for_each_safe - iterate over a list safe against removal of list entry
|
||||||
|
* @pos: the &struct list_head to use as a loop counter.
|
||||||
|
* @n: another &struct list_head to use as temporary storage
|
||||||
|
* @head: the head for your list.
|
||||||
|
*/
|
||||||
|
#define list_for_each_safe(pos, n, head) \
|
||||||
|
for (pos = (head)->next, n = pos->next; pos != (head); \
|
||||||
|
pos = n, n = pos->next)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_for_each_entry - iterate over list of given type
|
||||||
|
* @pos: the type * to use as a loop counter.
|
||||||
|
* @head: the head for your list.
|
||||||
|
* @member: the name of the list_struct within the struct.
|
||||||
|
*/
|
||||||
|
#define list_for_each_entry(pos, head, member, type) \
|
||||||
|
for (pos = list_entry((head)->next, type, member); \
|
||||||
|
&pos->member != (head); \
|
||||||
|
pos = list_entry(pos->member.next, type, member))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
|
||||||
|
* @pos: the type * to use as a loop counter.
|
||||||
|
* @n: another type * to use as temporary storage
|
||||||
|
* @head: the head for your list.
|
||||||
|
* @member: the name of the list_struct within the struct.
|
||||||
|
*/
|
||||||
|
#define list_for_each_entry_safe(pos, n, head, member, type) \
|
||||||
|
for (pos = list_entry((head)->next, type, member), \
|
||||||
|
n = list_entry(pos->member.next, type, member); \
|
||||||
|
&pos->member != (head); \
|
||||||
|
pos = n, n = list_entry(n->member.next, type, member))
|
||||||
|
|
||||||
|
#endif
|
247
RTL00_SDKV35a/component/common/api/platform/platform_stdlib.h
Normal file
247
RTL00_SDKV35a/component/common/api/platform/platform_stdlib.h
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright(c) 2007 - 2014 Realtek Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef __PLATFORM_STDLIB_H__
|
||||||
|
#define __PLATFORM_STDLIB_H__
|
||||||
|
|
||||||
|
#define USE_CLIB_PATCH 0
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
#define USE_RTL_ROM_CLIB 1
|
||||||
|
#else
|
||||||
|
#define USE_RTL_ROM_CLIB 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
|
#if defined (__IARSTDLIB__)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "diag.h"
|
||||||
|
|
||||||
|
#define strsep(str, delim) _strsep(str, delim)
|
||||||
|
#else
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "diag.h"
|
||||||
|
#include "strproc.h"
|
||||||
|
#include "basic_types.h"
|
||||||
|
#include "hal_misc.h"
|
||||||
|
#if USE_RTL_ROM_CLIB
|
||||||
|
#include "rtl_lib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef printf
|
||||||
|
#undef sprintf
|
||||||
|
#undef snprintf
|
||||||
|
#undef atoi
|
||||||
|
#undef memcmp
|
||||||
|
#undef memcpy
|
||||||
|
#undef memset
|
||||||
|
#undef strcmp
|
||||||
|
#undef strcpy
|
||||||
|
#undef strlen
|
||||||
|
#undef strncmp
|
||||||
|
#undef strncpy
|
||||||
|
#undef strsep
|
||||||
|
#undef strtok
|
||||||
|
#if USE_RTL_ROM_CLIB
|
||||||
|
#undef memchr
|
||||||
|
#undef memmove
|
||||||
|
#undef strcat
|
||||||
|
#undef strchr
|
||||||
|
#undef strncat
|
||||||
|
#undef strstr
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_RTL_ROM_CLIB
|
||||||
|
#define printf rtl_printf
|
||||||
|
#define sprintf rtl_sprintf
|
||||||
|
#define snprintf rtl_snprintf
|
||||||
|
#define memchr rtl_memchr
|
||||||
|
#define memcmp rtl_memcmp
|
||||||
|
#define memcpy rtl_memcpy
|
||||||
|
#define memmove rtl_memmove
|
||||||
|
#define memset rtl_memset
|
||||||
|
#define bzero(s,l) rtl_memset(s,0,l)
|
||||||
|
#define strcat rtl_strcat
|
||||||
|
#define strchr rtl_strchr
|
||||||
|
#define strcmp(s1, s2) rtl_strcmp((const char *)s1, (const char *)s2)
|
||||||
|
#define strcpy rtl_strcpy
|
||||||
|
#define strlen(str) rtl_strlen((const char *)str)
|
||||||
|
#define strncat rtl_strncat
|
||||||
|
#define strncmp(s1, s2, n) rtl_strncmp((const char *)s1, (const char *)s2, n)
|
||||||
|
#define strncpy rtl_strncpy
|
||||||
|
#define strstr rtl_strstr
|
||||||
|
#define strsep rtl_strsep
|
||||||
|
#define strtok rtl_strtok
|
||||||
|
#else
|
||||||
|
#if USE_CLIB_PATCH
|
||||||
|
extern int DiagSscanfPatch(const char *buf, const char *fmt, ...);
|
||||||
|
extern char* DiagStrtokPatch(char *str, const char* delim);
|
||||||
|
extern char* DiagStrstrPatch(char *string, char *substring);
|
||||||
|
extern int DiagSnPrintfPatch(char *buf, size_t size, const char *fmt, ...);
|
||||||
|
extern u32 DiagPrintfPatch(const char *fmt, ...);
|
||||||
|
extern u32 DiagSPrintfPatch(u8 *buf, const char *fmt, ...);
|
||||||
|
#define printf DiagPrintfPatch
|
||||||
|
#define sprintf DiagSPrintfPatch
|
||||||
|
#define snprintf DiagSnPrintfPatch
|
||||||
|
#define strstr(a, b) DiagStrstrPatch((char *)(a), (char *)(b))
|
||||||
|
#define strtok DiagStrtokPatch
|
||||||
|
#else
|
||||||
|
#define printf DiagPrintf
|
||||||
|
#define sprintf(fmt, arg...) DiagSPrintf((u8*)fmt, ##arg)
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
#define snprintf DiagSnPrintf // NULL function
|
||||||
|
#define strstr(str1, str2) prvStrStr(str1, str2) // NULL function
|
||||||
|
#endif
|
||||||
|
#define strtok(str, delim) _strsep(str, delim)
|
||||||
|
#endif
|
||||||
|
#define memcmp(dst, src, sz) _memcmp(dst, src, sz)
|
||||||
|
#define memcpy(dst, src, sz) _memcpy(dst, src, sz)
|
||||||
|
#define memset(dst, val, sz) _memset(dst, val, sz)
|
||||||
|
#define strchr(s, c) _strchr(s, c) // for B-cut ROM
|
||||||
|
#define strcmp(str1, str2) prvStrCmp((const unsigned char *) str1, (const unsigned char *) str2)
|
||||||
|
#define strcpy(dest, src) _strcpy(dest, src)
|
||||||
|
#define strlen(str) prvStrLen((const unsigned char *) str)
|
||||||
|
#define strncmp(str1, str2, cnt) _strncmp(str1, str2, cnt)
|
||||||
|
#define strncpy(dest, src, count) _strncpy(dest, src, count)
|
||||||
|
#define strsep(str, delim) _strsep(str, delim)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define atoi(str) prvAtoi(str)
|
||||||
|
#define strpbrk(cs, ct) _strpbrk(cs, ct) // for B-cut ROM
|
||||||
|
|
||||||
|
#if USE_CLIB_PATCH
|
||||||
|
#undef sscanf
|
||||||
|
#define sscanf DiagSscanfPatch
|
||||||
|
#else
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
#undef sscanf //_sscanf
|
||||||
|
//extern int DiagSscanfPatch(const char *buf, const char *fmt, ...);
|
||||||
|
//#define sscanf DiagSscanfPatch
|
||||||
|
#define sscanf sscanf // use libc sscanf
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif // defined (__IARSTDLIB__)
|
||||||
|
|
||||||
|
//
|
||||||
|
// memory management
|
||||||
|
//
|
||||||
|
extern void *pvPortMalloc( size_t xWantedSize );
|
||||||
|
extern void vPortFree( void *pv );
|
||||||
|
#undef malloc
|
||||||
|
#define malloc pvPortMalloc
|
||||||
|
#undef free
|
||||||
|
#define free vPortFree
|
||||||
|
#elif defined (CONFIG_PLATFORM_8711B)
|
||||||
|
#if defined (__IARSTDLIB__)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "diag.h"
|
||||||
|
|
||||||
|
#define strsep(str, delim) _strsep(str, delim)
|
||||||
|
#else
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "diag.h"
|
||||||
|
#include "strproc.h"
|
||||||
|
#include "basic_types.h"
|
||||||
|
#include "hal_misc.h"
|
||||||
|
|
||||||
|
#undef printf
|
||||||
|
#undef sprintf
|
||||||
|
#undef snprintf
|
||||||
|
#undef atoi
|
||||||
|
#undef memcmp
|
||||||
|
#undef memcpy
|
||||||
|
#undef memset
|
||||||
|
#undef strcmp
|
||||||
|
#undef strcpy
|
||||||
|
#undef strlen
|
||||||
|
#undef strncmp
|
||||||
|
#undef strncpy
|
||||||
|
#undef strsep
|
||||||
|
#undef strtok
|
||||||
|
|
||||||
|
#if USE_RTL_ROM_CLIB
|
||||||
|
#undef memchr
|
||||||
|
#undef memmove
|
||||||
|
#undef strcat
|
||||||
|
#undef strchr
|
||||||
|
#undef strncat
|
||||||
|
#undef strstr
|
||||||
|
|
||||||
|
#define printf rtl_printf
|
||||||
|
#define sprintf rtl_sprintf
|
||||||
|
#define snprintf rtl_snprintf
|
||||||
|
#define memchr rtl_memchr
|
||||||
|
#define memcmp rtl_memcmp
|
||||||
|
#define memcpy rtl_memcpy
|
||||||
|
#define memmove rtl_memmove
|
||||||
|
#define memset rtl_memset
|
||||||
|
#define strcat rtl_strcat
|
||||||
|
#define strchr rtl_strchr
|
||||||
|
#define strcmp(s1, s2) rtl_strcmp((const char *)s1, (const char *)s2)
|
||||||
|
#define strcpy rtl_strcpy
|
||||||
|
#define strlen(str) rtl_strlen((const char *)str)
|
||||||
|
#define strncat rtl_strncat
|
||||||
|
#define strncmp(s1, s2, n) rtl_strncmp((const char *)s1, (const char *)s2, n)
|
||||||
|
#define strncpy rtl_strncpy
|
||||||
|
#define strstr rtl_strstr
|
||||||
|
#define strsep rtl_strsep
|
||||||
|
#define strtok rtl_strtok
|
||||||
|
#else
|
||||||
|
#define printf DiagPrintf
|
||||||
|
#define sprintf(fmt, arg...) DiagSPrintf((u8*)fmt, ##arg)
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
#define snprintf DiagSnPrintf // NULL function
|
||||||
|
#define strstr(str1, str2) prvStrStr(str1, str2) // NULL function
|
||||||
|
#endif
|
||||||
|
#define strtok(str, delim) _strsep(str, delim)
|
||||||
|
|
||||||
|
#define memcmp(dst, src, sz) _memcmp(dst, src, sz)
|
||||||
|
#define memcpy(dst, src, sz) _memcpy(dst, src, sz)
|
||||||
|
#define memset(dst, val, sz) _memset(dst, val, sz)
|
||||||
|
#define strchr(s, c) _strchr(s, c) // for B-cut ROM
|
||||||
|
#define strcmp(str1, str2) prvStrCmp((const unsigned char *) str1, (const unsigned char *) str2)
|
||||||
|
#define strcpy(dest, src) _strcpy(dest, src)
|
||||||
|
#define strlen(str) prvStrLen((const unsigned char *) str)
|
||||||
|
#define strncmp(str1, str2, cnt) _strncmp(str1, str2, cnt)
|
||||||
|
#define strncpy(dest, src, count) _strncpy(dest, src, count)
|
||||||
|
#define strsep(str, delim) _strsep(str, delim)
|
||||||
|
|
||||||
|
#define atoi(str) prvAtoi(str)
|
||||||
|
#define strpbrk(cs, ct) _strpbrk(cs, ct) // for B-cut ROM
|
||||||
|
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
#undef sscanf
|
||||||
|
#define sscanf _sscanf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif // defined (__IARSTDLIB__)
|
||||||
|
|
||||||
|
//
|
||||||
|
// memory management
|
||||||
|
//
|
||||||
|
extern void *pvPortMalloc( size_t xWantedSize );
|
||||||
|
extern void vPortFree( void *pv );
|
||||||
|
#define malloc pvPortMalloc
|
||||||
|
#define free vPortFree
|
||||||
|
#elif defined(USE_STM322xG_EVAL) || defined(USE_STM324xG_EVAL) || defined(STM32F10X_XL)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif //__PLATFORM_STDLIB_H__
|
918
RTL00_SDKV35a/component/common/api/platform/stdlib_patch.c
Normal file
918
RTL00_SDKV35a/component/common/api/platform/stdlib_patch.c
Normal file
|
@ -0,0 +1,918 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
this is the c lib patch, It can help when the clib provided by IAR
|
||||||
|
does not work well.
|
||||||
|
|
||||||
|
How to use this:
|
||||||
|
1.You must include platform_stdlib.h in you source file。
|
||||||
|
2.There is a macro USE_CLIB_PATCH in platform_stdlib.h should be opened.
|
||||||
|
|
||||||
|
If there is some problems using this patch,
|
||||||
|
You'd better check if you code runs into these functions:
|
||||||
|
|
||||||
|
DiagSscanfPatch
|
||||||
|
DiagStrtokPatch
|
||||||
|
DiagStrstrPatch
|
||||||
|
DiagSnPrintfPatch
|
||||||
|
DiagPrintfPatch
|
||||||
|
DiagSPrintfPatch
|
||||||
|
DiagPrintfPatch
|
||||||
|
DiagSPrintfPatch
|
||||||
|
DiagSnPrintfPatch
|
||||||
|
DiagStrstrPatch
|
||||||
|
DiagStrtokPatch
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifndef CONFIG_PLATFORM_8711B
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#define DiagPutChar HalSerialPutcRtl8195a
|
||||||
|
|
||||||
|
#define IN
|
||||||
|
#define NULL 0
|
||||||
|
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
typedef unsigned int SIZE_T;
|
||||||
|
typedef unsigned long long u64;
|
||||||
|
typedef unsigned int u32;
|
||||||
|
typedef unsigned short int u16;
|
||||||
|
typedef unsigned char u8;
|
||||||
|
typedef signed long long s64;
|
||||||
|
typedef signed int s32;
|
||||||
|
typedef signed short int s16;
|
||||||
|
typedef unsigned char bool;
|
||||||
|
|
||||||
|
|
||||||
|
#define in_range(c, lo, up) ((u8)c >= lo && (u8)c <= up)
|
||||||
|
#define isprint(c) in_range(c, 0x20, 0x7f)
|
||||||
|
#define isdigit(c) in_range(c, '0', '9')
|
||||||
|
#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
|
||||||
|
#define islower(c) in_range(c, 'a', 'z')
|
||||||
|
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v' || c == ',')
|
||||||
|
#define ULLONG_MAX (~0ULL)
|
||||||
|
#define USHRT_MAX ((u16)(~0U))
|
||||||
|
#define KSTRTOX_OVERFLOW (1U << 31)
|
||||||
|
#define SHRT_MAX ((s16)(USHRT_MAX>>1))
|
||||||
|
|
||||||
|
static inline char _tolower(const char c)
|
||||||
|
{
|
||||||
|
return c | 0x20;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
|
||||||
|
extern s64 div_s64(s64 dividend, s32 divisor);
|
||||||
|
extern inline char _tolower(const char c);
|
||||||
|
extern u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder);
|
||||||
|
extern u64 div_u64(u64 dividend, u32 divisor);
|
||||||
|
extern unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p);
|
||||||
|
extern const char *_parse_integer_fixup_radix(const char *s, unsigned int *base);
|
||||||
|
extern char *skip_spaces(const char *str);
|
||||||
|
extern int skip_atoi(const char **s);
|
||||||
|
extern void HalSerialPutcRtl8195a(u8 c);
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned long long simple_strtoull_patch(const char *cp, char **endp, unsigned int base)
|
||||||
|
{
|
||||||
|
unsigned long long result;
|
||||||
|
unsigned int rv;
|
||||||
|
|
||||||
|
cp = _parse_integer_fixup_radix(cp, &base);
|
||||||
|
rv = _parse_integer(cp, base, &result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long long simple_strtoll_patch(const char *cp, char **endp, unsigned int base)
|
||||||
|
{
|
||||||
|
if(*cp == '-')
|
||||||
|
return -simple_strtoull_patch(cp + 1, endp, base);
|
||||||
|
|
||||||
|
return simple_strtoull_patch(cp, endp, base);
|
||||||
|
}
|
||||||
|
static unsigned long simple_strtoul_patch(const char *cp, char **endp, unsigned int base)
|
||||||
|
{
|
||||||
|
return simple_strtoull_patch(cp, endp, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static long simple_strtol_patch(const char *cp, char **endp, unsigned int base)
|
||||||
|
{
|
||||||
|
if(*cp == '-')
|
||||||
|
return -simple_strtoul_patch(cp + 1, endp, base);
|
||||||
|
|
||||||
|
return simple_strtoul_patch(cp, endp, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int judge_digit_width(const char *str)
|
||||||
|
{
|
||||||
|
|
||||||
|
int width = 0;
|
||||||
|
|
||||||
|
while(isdigit(*str)) {
|
||||||
|
width++;
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int _vsscanf_patch(const char *buf, const char *fmt, va_list args)
|
||||||
|
{
|
||||||
|
const char *str = buf;
|
||||||
|
char *next;
|
||||||
|
char digit;
|
||||||
|
int num = 0;
|
||||||
|
int i =0;
|
||||||
|
u8 qualifier;
|
||||||
|
unsigned int base;
|
||||||
|
union {
|
||||||
|
long long s;
|
||||||
|
unsigned long long u;
|
||||||
|
} val;
|
||||||
|
s16 field_width;
|
||||||
|
bool is_sign;
|
||||||
|
|
||||||
|
char str_store[20] = {0};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while(*fmt) {
|
||||||
|
/* skip any white space in format */
|
||||||
|
/* white space in format matchs any amount of
|
||||||
|
* white space, including none, in the input.
|
||||||
|
*/
|
||||||
|
if(isspace(*fmt)) {
|
||||||
|
fmt = skip_spaces(++fmt);
|
||||||
|
str = skip_spaces(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* anything that is not a conversion must match exactly */
|
||||||
|
if(*fmt != '%' && *fmt) {
|
||||||
|
if(*fmt++ != *str++) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!*fmt) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
++fmt;
|
||||||
|
|
||||||
|
/* skip this conversion.
|
||||||
|
* advance both strings to next white space
|
||||||
|
*/
|
||||||
|
if(*fmt == '*') {
|
||||||
|
if(!*str) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(!isspace(*fmt) && *fmt != '%' && *fmt)
|
||||||
|
fmt++;
|
||||||
|
|
||||||
|
while(!isspace(*str) && *str)
|
||||||
|
str++;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get field width */
|
||||||
|
field_width = -1;
|
||||||
|
|
||||||
|
if(isdigit(*fmt)) {
|
||||||
|
|
||||||
|
field_width = skip_atoi(&fmt);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(field_width <= 0) {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get conversion qualifier */
|
||||||
|
qualifier = -1;
|
||||||
|
|
||||||
|
if(*fmt == 'h' || _tolower(*fmt) == 'l' ||
|
||||||
|
_tolower(*fmt) == 'z') {
|
||||||
|
qualifier = *fmt++;
|
||||||
|
|
||||||
|
if(qualifier == *fmt) {
|
||||||
|
if(qualifier == 'h') {
|
||||||
|
qualifier = 'H';
|
||||||
|
fmt++;
|
||||||
|
} else if(qualifier == 'l') {
|
||||||
|
qualifier = 'L';
|
||||||
|
fmt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!*fmt) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*fmt == 'n') {
|
||||||
|
/* return number of characters read so far */
|
||||||
|
*va_arg(args, int *) = str - buf;
|
||||||
|
++fmt;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!*str) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
base = 10;
|
||||||
|
is_sign = 0;
|
||||||
|
|
||||||
|
switch(*fmt++) {
|
||||||
|
case 'c': {
|
||||||
|
char *s = (char *)va_arg(args, char*);
|
||||||
|
|
||||||
|
if(field_width == -1)
|
||||||
|
field_width = 1;
|
||||||
|
|
||||||
|
do {
|
||||||
|
*s++ = *str++;
|
||||||
|
} while(--field_width > 0 && *str);
|
||||||
|
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case 's': {
|
||||||
|
char *s = (char *)va_arg(args, char *);
|
||||||
|
|
||||||
|
if(field_width == -1)
|
||||||
|
field_width = SHRT_MAX;
|
||||||
|
|
||||||
|
/* first, skip leading white space in buffer */
|
||||||
|
str = skip_spaces(str);
|
||||||
|
|
||||||
|
/* now copy until next white space */
|
||||||
|
while(*str && !isspace(*str) && field_width--) {
|
||||||
|
*s++ = *str++;
|
||||||
|
}
|
||||||
|
|
||||||
|
*s = '\0';
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case 'o':
|
||||||
|
base = 8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'x':
|
||||||
|
case 'X':
|
||||||
|
base = 16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
base = 0;
|
||||||
|
|
||||||
|
case 'd':
|
||||||
|
is_sign = 1;
|
||||||
|
|
||||||
|
case 'u':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '%':
|
||||||
|
|
||||||
|
/* looking for '%' in str */
|
||||||
|
if(*str++ != '%') {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* invalid format; stop here */
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* have some sort of integer conversion.
|
||||||
|
* first, skip white space in buffer.
|
||||||
|
*/
|
||||||
|
str = skip_spaces(str);
|
||||||
|
|
||||||
|
digit = *str;
|
||||||
|
|
||||||
|
if(is_sign && digit == '-')
|
||||||
|
digit = *(str + 1);
|
||||||
|
|
||||||
|
if(!digit
|
||||||
|
|| (base == 16 && !isxdigit(digit))
|
||||||
|
|| (base == 10 && !isdigit(digit))
|
||||||
|
|| (base == 8 && (!isdigit(digit) || digit > '7'))
|
||||||
|
|| (base == 0 && !isdigit(digit))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//here problem *******************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//troy add ,fix support %2d, but not support %d
|
||||||
|
if(field_width <= 0) {
|
||||||
|
|
||||||
|
field_width = judge_digit_width(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////troy add, fix str passed inwidth wrong
|
||||||
|
for(i = 0; i<field_width ; i++)
|
||||||
|
str_store[i] = str[i];
|
||||||
|
|
||||||
|
next = (char*)str + field_width;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(is_sign) {
|
||||||
|
val.s = qualifier != 'L' ?
|
||||||
|
simple_strtol_patch(str_store, &next, base) :
|
||||||
|
simple_strtoll_patch(str_store, &next, base);
|
||||||
|
} else {
|
||||||
|
val.u = qualifier != 'L' ?
|
||||||
|
simple_strtoul_patch(str_store, &next, base) :
|
||||||
|
simple_strtoull_patch(str_store, &next, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////troy add
|
||||||
|
for(i = 0; i<20 ; i++)
|
||||||
|
str_store[i] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
//判断转换的字符串的宽度是否大于 %2d
|
||||||
|
if(field_width > 0 && next - str > field_width) {
|
||||||
|
if(base == 0)
|
||||||
|
_parse_integer_fixup_radix(str, &base);
|
||||||
|
|
||||||
|
while(next - str > field_width) {
|
||||||
|
if(is_sign) {
|
||||||
|
val.s = div_s64(val.s, base);
|
||||||
|
} else {
|
||||||
|
val.u = div_u64(val.u, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
--next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(qualifier) {
|
||||||
|
case 'H': /* that's 'hh' in format */
|
||||||
|
if(is_sign)
|
||||||
|
*va_arg(args, signed char *) = val.s;
|
||||||
|
else
|
||||||
|
*va_arg(args, unsigned char *) = val.u;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
if(is_sign)
|
||||||
|
*va_arg(args, short *) = val.s;
|
||||||
|
else
|
||||||
|
*va_arg(args, unsigned short *) = val.u;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'l':
|
||||||
|
if(is_sign)
|
||||||
|
*va_arg(args, long *) = val.s;
|
||||||
|
else
|
||||||
|
*va_arg(args, unsigned long *) = val.u;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'L':
|
||||||
|
if(is_sign)
|
||||||
|
*va_arg(args, long long *) = val.s;
|
||||||
|
else
|
||||||
|
*va_arg(args, unsigned long long *) = val.u;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Z':
|
||||||
|
case 'z':
|
||||||
|
*va_arg(args, size_t *) = val.u;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if(is_sign)
|
||||||
|
*va_arg(args, int *) = val.s;
|
||||||
|
else
|
||||||
|
*va_arg(args, unsigned int *) = val.u;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
num++;
|
||||||
|
|
||||||
|
if(!next) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int DiagSscanfPatch(const char *buf, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
va_start(args, fmt);
|
||||||
|
i = _vsscanf_patch(buf, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char* DiagStrtokPatch(char *str, const char* delim) {
|
||||||
|
static char* _buffer;
|
||||||
|
|
||||||
|
if(str != NULL) _buffer = str;
|
||||||
|
|
||||||
|
if(_buffer[0] == '\0') return NULL;
|
||||||
|
|
||||||
|
char *ret = _buffer, *b;
|
||||||
|
const char *d;
|
||||||
|
|
||||||
|
for(b = _buffer; *b !='\0'; b++) {
|
||||||
|
for(d = delim; *d != '\0'; d++) {
|
||||||
|
if(*b == *d) {
|
||||||
|
*b = '\0';
|
||||||
|
_buffer = b+1;
|
||||||
|
|
||||||
|
// skip the beginning delimiters
|
||||||
|
if(b == ret) {
|
||||||
|
ret++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char *DiagStrstrPatch(char *string, char *substring)
|
||||||
|
{
|
||||||
|
register char *a, *b;
|
||||||
|
|
||||||
|
/* First scan quickly through the two strings looking for a
|
||||||
|
* single-character match. When it's found, then compare the
|
||||||
|
* rest of the substring.
|
||||||
|
*/
|
||||||
|
|
||||||
|
b = substring;
|
||||||
|
|
||||||
|
if(*b == 0) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(; *string != 0; string += 1) {
|
||||||
|
if(*string != *b) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
a = string;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
if(*b == 0) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*a++ != *b++) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b = substring;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (char *) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int DiagSnPrintfPatch(char *buf, size_t size, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
|
||||||
|
va_list ap;
|
||||||
|
char *p, *s, *buf_end = NULL;
|
||||||
|
const int *dp = ((const int *)&fmt)+1;
|
||||||
|
|
||||||
|
if(buf == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
s = buf;
|
||||||
|
buf_end = size? (buf + size):(char*)~0;
|
||||||
|
|
||||||
|
for(; *fmt != '\0'; ++fmt) {
|
||||||
|
|
||||||
|
if(*fmt != '%') {
|
||||||
|
*s++ = *fmt;
|
||||||
|
|
||||||
|
if(s >= buf_end) {
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*++fmt == 's') {
|
||||||
|
for(p = (char *)*dp++; *p != '\0'; p++) {
|
||||||
|
*s++ = *p;
|
||||||
|
|
||||||
|
if(s >= buf_end) {
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { /* Length of item is bounded */
|
||||||
|
char tmp[20], *q = tmp;
|
||||||
|
int alt = 0;
|
||||||
|
int shift = 0;// = 12;
|
||||||
|
const long *lpforchk = (const long *)dp;
|
||||||
|
|
||||||
|
if((*lpforchk) < 0x10) {
|
||||||
|
shift = 0;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x10) && ((*lpforchk) < 0x100)) {
|
||||||
|
shift = 4;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x100) && ((*lpforchk) < 0x1000)) {
|
||||||
|
shift = 8;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x1000) && ((*lpforchk) < 0x10000)) {
|
||||||
|
shift = 12;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x10000) && ((*lpforchk) < 0x100000)) {
|
||||||
|
shift = 16;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x100000) && ((*lpforchk) < 0x1000000)) {
|
||||||
|
shift = 20;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x1000000) && ((*lpforchk) < 0x10000000)) {
|
||||||
|
shift = 24;
|
||||||
|
}
|
||||||
|
else if((*lpforchk) >= 0x10000000) {
|
||||||
|
shift = 28;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shift = 28;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((*fmt >= '0') && (*fmt <= '9'))
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
unsigned char fch = *fmt;
|
||||||
|
|
||||||
|
for(width=0; (fch>='0') && (fch<='9'); fch=*++fmt)
|
||||||
|
{ width = width * 10 + fch - '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
shift=(width-1)*4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before each format q points to tmp buffer
|
||||||
|
* After each format q points past end of item
|
||||||
|
*/
|
||||||
|
if((*fmt == 'x')||(*fmt == 'X') || (*fmt == 'p') || (*fmt == 'P')) {
|
||||||
|
/* With x86 gcc, sizeof(long) == sizeof(int) */
|
||||||
|
const long *lp = (const long *)dp;
|
||||||
|
long h = *lp++;
|
||||||
|
int hex_count = 0;
|
||||||
|
unsigned long h_back = h;
|
||||||
|
int ncase = (*fmt & 0x20);
|
||||||
|
dp = (const int *)lp;
|
||||||
|
|
||||||
|
if((*fmt == 'p') || (*fmt == 'P'))
|
||||||
|
alt=1;
|
||||||
|
|
||||||
|
if(alt) {
|
||||||
|
*q++ = '0';
|
||||||
|
*q++ = 'X' | ncase;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(h_back) {
|
||||||
|
hex_count += (h_back & 0xF) ? 1 : 0;
|
||||||
|
h_back = h_back >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(shift < (hex_count - 1)*4)
|
||||||
|
shift = (hex_count - 1)*4;
|
||||||
|
|
||||||
|
for(; shift >= 0; shift -= 4)
|
||||||
|
*q++ = "0123456789ABCDEF"[(h >> shift) & 0xF] | ncase;
|
||||||
|
}
|
||||||
|
else if(*fmt == 'd') {
|
||||||
|
int i = *dp++;
|
||||||
|
char *r;
|
||||||
|
int digit_space = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if(i < 0) {
|
||||||
|
*q++ = '-';
|
||||||
|
i = -i;
|
||||||
|
digit_space++;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = q; /* save beginning of digits */
|
||||||
|
|
||||||
|
|
||||||
|
do {
|
||||||
|
*q++ = '0' + (i % 10);
|
||||||
|
i /= 10;
|
||||||
|
digit_space++;
|
||||||
|
} while(i);
|
||||||
|
|
||||||
|
|
||||||
|
for(; shift >= 0; shift -= 4) {
|
||||||
|
|
||||||
|
if(digit_space-- > 0) {
|
||||||
|
; //do nothing
|
||||||
|
} else {
|
||||||
|
*q++ = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reverse digits, stop in middle */
|
||||||
|
r = q; /* don't alter q */
|
||||||
|
|
||||||
|
while(--r > p) {
|
||||||
|
i = *r;
|
||||||
|
*r = *p;
|
||||||
|
*p++ = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(*fmt == 'c')
|
||||||
|
*q++ = *dp++;
|
||||||
|
else
|
||||||
|
*q++ = *fmt;
|
||||||
|
|
||||||
|
/* now output the saved string */
|
||||||
|
for(p = tmp; p < q; ++p) {
|
||||||
|
*s++ = *p;
|
||||||
|
|
||||||
|
if(s >= buf_end) {
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Exit:
|
||||||
|
|
||||||
|
if(buf)
|
||||||
|
*s = '\0';
|
||||||
|
|
||||||
|
va_end(ap);
|
||||||
|
return(s-buf);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************/
|
||||||
|
|
||||||
|
static int VSprintfPatch(char *buf, const char *fmt, const int *dp)
|
||||||
|
{
|
||||||
|
char *p, *s;
|
||||||
|
s = buf;
|
||||||
|
|
||||||
|
for(; *fmt != '\0'; ++fmt) {
|
||||||
|
if(*fmt != '%') {
|
||||||
|
if(buf) {
|
||||||
|
*s++ = *fmt;
|
||||||
|
} else {
|
||||||
|
DiagPutChar(*fmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*++fmt == 's') {
|
||||||
|
for(p = (char *)*dp++; *p != '\0'; p++) {
|
||||||
|
if(buf) {
|
||||||
|
*s++ = *p;
|
||||||
|
} else {
|
||||||
|
DiagPutChar(*p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { /* Length of item is bounded */
|
||||||
|
char tmp[20], *q = tmp;
|
||||||
|
int alt = 0;
|
||||||
|
int shift = 0;// = 12;
|
||||||
|
const long *lpforchk = (const long *)dp;
|
||||||
|
|
||||||
|
if((*lpforchk) < 0x10) {
|
||||||
|
shift = 0;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x10) && ((*lpforchk) < 0x100)) {
|
||||||
|
shift = 4;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x100) && ((*lpforchk) < 0x1000)) {
|
||||||
|
shift = 8;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x1000) && ((*lpforchk) < 0x10000)) {
|
||||||
|
shift = 12;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x10000) && ((*lpforchk) < 0x100000)) {
|
||||||
|
shift = 16;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x100000) && ((*lpforchk) < 0x1000000)) {
|
||||||
|
shift = 20;
|
||||||
|
}
|
||||||
|
else if(((*lpforchk) >= 0x1000000) && ((*lpforchk) < 0x10000000)) {
|
||||||
|
shift = 24;
|
||||||
|
}
|
||||||
|
else if((*lpforchk) >= 0x10000000) {
|
||||||
|
shift = 28;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shift = 28;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1 //wei patch for %02x
|
||||||
|
|
||||||
|
if((*fmt >= '0') && (*fmt <= '9'))
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
unsigned char fch = *fmt;
|
||||||
|
|
||||||
|
for(width=0; (fch>='0') && (fch<='9'); fch=*++fmt)
|
||||||
|
{ width = width * 10 + fch - '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
shift=(width-1)*4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before each format q points to tmp buffer
|
||||||
|
* After each format q points past end of item
|
||||||
|
*/
|
||||||
|
|
||||||
|
if((*fmt == 'x')||(*fmt == 'X') || (*fmt == 'p') || (*fmt == 'P')) {
|
||||||
|
/* With x86 gcc, sizeof(long) == sizeof(int) */
|
||||||
|
const long *lp = (const long *)dp;
|
||||||
|
long h = *lp++;
|
||||||
|
int hex_count = 0;
|
||||||
|
unsigned long h_back = h;
|
||||||
|
int ncase = (*fmt & 0x20);
|
||||||
|
dp = (const int *)lp;
|
||||||
|
|
||||||
|
if((*fmt == 'p') || (*fmt == 'P'))
|
||||||
|
alt=1;
|
||||||
|
|
||||||
|
if(alt) {
|
||||||
|
*q++ = '0';
|
||||||
|
*q++ = 'X' | ncase;
|
||||||
|
}
|
||||||
|
|
||||||
|
//hback 是实际得到的数据,hex_count是统计数据的HEX字符个数
|
||||||
|
while(h_back) {
|
||||||
|
hex_count += (h_back & 0xF) ? 1 : 0;
|
||||||
|
h_back = h_back >> 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//这里修复 example: 字符有4个,但是用了%02x导致字符被截断的情况
|
||||||
|
if(shift < (hex_count - 1)*4)
|
||||||
|
shift = (hex_count - 1)*4;
|
||||||
|
|
||||||
|
//printf("(%d,%d)", hex_count, shift);
|
||||||
|
|
||||||
|
for(; shift >= 0; shift -= 4) {
|
||||||
|
|
||||||
|
*q++ = "0123456789ABCDEF"[(h >> shift) & 0xF] | ncase;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(*fmt == 'd') {
|
||||||
|
int i = *dp++;
|
||||||
|
char *r;
|
||||||
|
int digit_space = 0;
|
||||||
|
|
||||||
|
if(i < 0) {
|
||||||
|
*q++ = '-';
|
||||||
|
i = -i;
|
||||||
|
digit_space++;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = q; /* save beginning of digits */
|
||||||
|
|
||||||
|
do {
|
||||||
|
*q++ = '0' + (i % 10);
|
||||||
|
i /= 10;
|
||||||
|
digit_space++;
|
||||||
|
} while(i);
|
||||||
|
|
||||||
|
//这里修复 example:用了%08d后,在数字前面没有0的情况
|
||||||
|
for(; shift >= 0; shift -= 4) {
|
||||||
|
|
||||||
|
if(digit_space-- > 0) {
|
||||||
|
; //do nothing
|
||||||
|
} else {
|
||||||
|
*q++ = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reverse digits, stop in middle */
|
||||||
|
r = q; /* don't alter q */
|
||||||
|
|
||||||
|
while(--r > p) {
|
||||||
|
i = *r;
|
||||||
|
*r = *p;
|
||||||
|
*p++ = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(*fmt == 'c')
|
||||||
|
*q++ = *dp++;
|
||||||
|
else
|
||||||
|
*q++ = *fmt;
|
||||||
|
|
||||||
|
/* now output the saved string */
|
||||||
|
for(p = tmp; p < q; ++p) {
|
||||||
|
if(buf) {
|
||||||
|
*s++ = *p;
|
||||||
|
} else {
|
||||||
|
DiagPutChar(*p);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((*p) == '\n') {
|
||||||
|
DiagPutChar('\r');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(buf)
|
||||||
|
*s = '\0';
|
||||||
|
|
||||||
|
return (s - buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
u32 DiagPrintfPatch(
|
||||||
|
IN const char *fmt, ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
(void)VSprintfPatch(0, fmt, ((const int *)&fmt)+1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 DiagSPrintfPatch(
|
||||||
|
IN u8 *buf,
|
||||||
|
IN const char *fmt, ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
(void)VSprintfPatch((char*)buf, fmt, ((const int *)&fmt)+1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,593 @@
|
||||||
|
/*
|
||||||
|
* OS specific functions
|
||||||
|
* Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
|
||||||
|
*
|
||||||
|
* This software may be distributed under the terms of the BSD license.
|
||||||
|
* See README for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OS_H
|
||||||
|
#define OS_H
|
||||||
|
|
||||||
|
//#include "basic_types.h"
|
||||||
|
#include <autoconf.h>
|
||||||
|
#include "osdep_service.h"
|
||||||
|
#include "freertos/wrapper.h"
|
||||||
|
#include "utils/rom/rom_wps_os.h"
|
||||||
|
|
||||||
|
typedef void* xqueue_handle_t;
|
||||||
|
|
||||||
|
typedef long os_time_t;
|
||||||
|
|
||||||
|
typedef _timer os_timer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_sleep - Sleep (sec, usec)
|
||||||
|
* @sec: Number of seconds to sleep
|
||||||
|
* @usec: Number of microseconds to sleep
|
||||||
|
*/
|
||||||
|
void os_sleep(os_time_t sec, os_time_t usec);
|
||||||
|
|
||||||
|
struct os_time {
|
||||||
|
os_time_t sec;
|
||||||
|
os_time_t usec;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct os_reltime {
|
||||||
|
os_time_t sec;
|
||||||
|
os_time_t usec;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_get_time - Get current time (sec, usec)
|
||||||
|
* @t: Pointer to buffer for the time
|
||||||
|
* Returns: 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
|
int os_get_time(struct os_time *t);
|
||||||
|
|
||||||
|
int os_get_reltime(struct os_reltime *t);
|
||||||
|
/* Helper macros for handling struct os_time */
|
||||||
|
/* (&timeout->time, &tmp->time) */
|
||||||
|
#define os_time_before(a, b) \
|
||||||
|
((a)->sec < (b)->sec || \
|
||||||
|
((a)->sec == (b)->sec && (a)->usec < (b)->usec))
|
||||||
|
|
||||||
|
#define os_time_sub(a, b, res) do { \
|
||||||
|
(res)->sec = (a)->sec - (b)->sec; \
|
||||||
|
(res)->usec = (a)->usec - (b)->usec; \
|
||||||
|
if ((res)->usec < 0) { \
|
||||||
|
(res)->sec--; \
|
||||||
|
(res)->usec += 1000000; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_mktime - Convert broken-down time into seconds since 1970-01-01
|
||||||
|
* @year: Four digit year
|
||||||
|
* @month: Month (1 .. 12)
|
||||||
|
* @day: Day of month (1 .. 31)
|
||||||
|
* @hour: Hour (0 .. 23)
|
||||||
|
* @min: Minute (0 .. 59)
|
||||||
|
* @sec: Second (0 .. 60)
|
||||||
|
* @t: Buffer for returning calendar time representation (seconds since
|
||||||
|
* 1970-01-01 00:00:00)
|
||||||
|
* Returns: 0 on success, -1 on failure
|
||||||
|
*
|
||||||
|
* Note: The result is in seconds from Epoch, i.e., in UTC, not in local time
|
||||||
|
* which is used by POSIX mktime().
|
||||||
|
*/
|
||||||
|
int os_mktime(int year, int month, int day, int hour, int min, int sec,
|
||||||
|
os_time_t *t);
|
||||||
|
|
||||||
|
struct os_tm {
|
||||||
|
int sec; /* 0..59 or 60 for leap seconds */
|
||||||
|
int min; /* 0..59 */
|
||||||
|
int hour; /* 0..23 */
|
||||||
|
int day; /* 1..31 */
|
||||||
|
int month; /* 1..12 */
|
||||||
|
int year; /* Four digit year */
|
||||||
|
};
|
||||||
|
|
||||||
|
int os_gmtime(os_time_t t, struct os_tm *tm);
|
||||||
|
|
||||||
|
/* Helpers for handling struct os_time */
|
||||||
|
|
||||||
|
/* Helpers for handling struct os_reltime */
|
||||||
|
|
||||||
|
static inline int os_reltime_before(struct os_reltime *a,
|
||||||
|
struct os_reltime *b)
|
||||||
|
{
|
||||||
|
return os_time_before(a,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void os_reltime_sub(struct os_reltime *a, struct os_reltime *b,
|
||||||
|
struct os_reltime *res)
|
||||||
|
{
|
||||||
|
os_time_sub(a,b,res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void os_reltime_age(struct os_reltime *start,
|
||||||
|
struct os_reltime *age)
|
||||||
|
{
|
||||||
|
struct os_reltime now;
|
||||||
|
|
||||||
|
os_get_time((struct os_time *)&now);
|
||||||
|
os_reltime_sub(&now, start, age);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline int os_reltime_expired(struct os_reltime *now,
|
||||||
|
struct os_reltime *ts,
|
||||||
|
os_time_t timeout_secs)
|
||||||
|
{
|
||||||
|
struct os_reltime age;
|
||||||
|
|
||||||
|
os_reltime_sub(now, ts, &age);
|
||||||
|
return (age.sec > timeout_secs) ||
|
||||||
|
(age.sec == timeout_secs && age.usec > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_daemonize - Run in the background (detach from the controlling terminal)
|
||||||
|
* @pid_file: File name to write the process ID to or %NULL to skip this
|
||||||
|
* Returns: 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
|
int os_daemonize(const char *pid_file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_daemonize_terminate - Stop running in the background (remove pid file)
|
||||||
|
* @pid_file: File name to write the process ID to or %NULL to skip this
|
||||||
|
*/
|
||||||
|
void os_daemonize_terminate(const char *pid_file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_get_random - Get cryptographically strong pseudo random data
|
||||||
|
* @buf: Buffer for pseudo random data
|
||||||
|
* @len: Length of the buffer
|
||||||
|
* Returns: 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
|
int os_get_random(unsigned char *buf, size_t len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_random - Get pseudo random value (not necessarily very strong)
|
||||||
|
* Returns: Pseudo random value
|
||||||
|
*/
|
||||||
|
unsigned long os_random(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_rel2abs_path - Get an absolute path for a file
|
||||||
|
* @rel_path: Relative path to a file
|
||||||
|
* Returns: Absolute path for the file or %NULL on failure
|
||||||
|
*
|
||||||
|
* This function tries to convert a relative path of a file to an absolute path
|
||||||
|
* in order for the file to be found even if current working directory has
|
||||||
|
* changed. The returned value is allocated and caller is responsible for
|
||||||
|
* freeing it. It is acceptable to just return the same path in an allocated
|
||||||
|
* buffer, e.g., return strdup(rel_path). This function is only used to find
|
||||||
|
* configuration files when os_daemonize() may have changed the current working
|
||||||
|
* directory and relative path would be pointing to a different location.
|
||||||
|
*/
|
||||||
|
char * os_rel2abs_path(const char *rel_path);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_program_init - Program initialization (called at start)
|
||||||
|
* Returns: 0 on success, -1 on failure
|
||||||
|
*
|
||||||
|
* This function is called when a programs starts. If there are any OS specific
|
||||||
|
* processing that is needed, it can be placed here. It is also acceptable to
|
||||||
|
* just return 0 if not special processing is needed.
|
||||||
|
*/
|
||||||
|
int os_program_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_program_deinit - Program deinitialization (called just before exit)
|
||||||
|
*
|
||||||
|
* This function is called just before a program exists. If there are any OS
|
||||||
|
* specific processing, e.g., freeing resourced allocated in os_program_init(),
|
||||||
|
* it should be done here. It is also acceptable for this function to do
|
||||||
|
* nothing.
|
||||||
|
*/
|
||||||
|
void os_program_deinit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_setenv - Set environment variable
|
||||||
|
* @name: Name of the variable
|
||||||
|
* @value: Value to set to the variable
|
||||||
|
* @overwrite: Whether existing variable should be overwritten
|
||||||
|
* Returns: 0 on success, -1 on error
|
||||||
|
*
|
||||||
|
* This function is only used for wpa_cli action scripts. OS wrapper does not
|
||||||
|
* need to implement this if such functionality is not needed.
|
||||||
|
*/
|
||||||
|
int os_setenv(const char *name, const char *value, int overwrite);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_unsetenv - Delete environent variable
|
||||||
|
* @name: Name of the variable
|
||||||
|
* Returns: 0 on success, -1 on error
|
||||||
|
*
|
||||||
|
* This function is only used for wpa_cli action scripts. OS wrapper does not
|
||||||
|
* need to implement this if such functionality is not needed.
|
||||||
|
*/
|
||||||
|
int os_unsetenv(const char *name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_readfile - Read a file to an allocated memory buffer
|
||||||
|
* @name: Name of the file to read
|
||||||
|
* @len: For returning the length of the allocated buffer
|
||||||
|
* Returns: Pointer to the allocated buffer or %NULL on failure
|
||||||
|
*
|
||||||
|
* This function allocates memory and reads the given file to this buffer. Both
|
||||||
|
* binary and text files can be read with this function. The caller is
|
||||||
|
* responsible for freeing the returned buffer with os_free().
|
||||||
|
*/
|
||||||
|
char * os_readfile(const char *name, size_t *len);
|
||||||
|
|
||||||
|
//#if 0
|
||||||
|
/**
|
||||||
|
* os_zalloc - Allocate and zero memory
|
||||||
|
* @size: Number of bytes to allocate
|
||||||
|
* Returns: Pointer to allocated and zeroed memory or %NULL on failure
|
||||||
|
*
|
||||||
|
* Caller is responsible for freeing the returned buffer with os_free().
|
||||||
|
*/
|
||||||
|
void * os_zalloc(size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_calloc - Allocate and zero memory for an array
|
||||||
|
* @nmemb: Number of members in the array
|
||||||
|
* @size: Number of bytes in each member
|
||||||
|
* Returns: Pointer to allocated and zeroed memory or %NULL on failure
|
||||||
|
*
|
||||||
|
* This function can be used as a wrapper for os_zalloc(nmemb * size) when an
|
||||||
|
* allocation is used for an array. The main benefit over os_zalloc() is in
|
||||||
|
* having an extra check to catch integer overflows in multiplication.
|
||||||
|
*
|
||||||
|
* Caller is responsible for freeing the returned buffer with os_free().
|
||||||
|
*/
|
||||||
|
static inline void * os_calloc(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
if (size && nmemb > (~(size_t) 0) / size)
|
||||||
|
return NULL;
|
||||||
|
return os_zalloc(nmemb * size);
|
||||||
|
}
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
|
static inline int os_memcmp_const(const void *a, const void *b, size_t len)
|
||||||
|
{
|
||||||
|
const u8 *aa = a;
|
||||||
|
const u8 *bb = b;
|
||||||
|
size_t i;
|
||||||
|
u8 res;
|
||||||
|
|
||||||
|
for (res = 0, i = 0; i < len; i++)
|
||||||
|
res |= aa[i] ^ bb[i];
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following functions are wrapper for standard ANSI C or POSIX functions.
|
||||||
|
* By default, they are just defined to use the standard function name and no
|
||||||
|
* os_*.c implementation is needed for them. This avoids extra function calls
|
||||||
|
* by allowing the C pre-processor take care of the function name mapping.
|
||||||
|
*
|
||||||
|
* If the target system uses a C library that does not provide these functions,
|
||||||
|
* build_config.h can be used to define the wrappers to use a different
|
||||||
|
* function name. This can be done on function-by-function basis since the
|
||||||
|
* defines here are only used if build_config.h does not define the os_* name.
|
||||||
|
* If needed, os_*.c file can be used to implement the functions that are not
|
||||||
|
* included in the C library on the target system. Alternatively,
|
||||||
|
* OS_NO_C_LIB_DEFINES can be defined to skip all defines here in which case
|
||||||
|
* these functions need to be implemented in os_*.c file for the target system.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef OS_NO_C_LIB_DEFINES
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_malloc - Allocate dynamic memory
|
||||||
|
* @size: Size of the buffer to allocate
|
||||||
|
* Returns: Allocated buffer or %NULL on failure
|
||||||
|
*
|
||||||
|
* Caller is responsible for freeing the returned buffer with os_free().
|
||||||
|
*/
|
||||||
|
void * os_malloc(size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_realloc - Re-allocate dynamic memory
|
||||||
|
* @ptr: Old buffer from os_malloc() or os_realloc()
|
||||||
|
* @size: Size of the new buffer
|
||||||
|
* Returns: Allocated buffer or %NULL on failure
|
||||||
|
*
|
||||||
|
* Caller is responsible for freeing the returned buffer with os_free().
|
||||||
|
* If re-allocation fails, %NULL is returned and the original buffer (ptr) is
|
||||||
|
* not freed and caller is still responsible for freeing it.
|
||||||
|
*/
|
||||||
|
void * os_realloc(void *ptr, size_t size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_free - Free dynamic memory
|
||||||
|
* @ptr: Old buffer from os_malloc() or os_realloc(); can be %NULL
|
||||||
|
*/
|
||||||
|
void os_free(void *ptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_memcpy - Copy memory area
|
||||||
|
* @dest: Destination
|
||||||
|
* @src: Source
|
||||||
|
* @n: Number of bytes to copy
|
||||||
|
* Returns: dest
|
||||||
|
*
|
||||||
|
* The memory areas src and dst must not overlap. os_memmove() can be used with
|
||||||
|
* overlapping memory.
|
||||||
|
*/
|
||||||
|
void * os_memcpy(void *dest, const void *src, size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_memmove - Copy memory area
|
||||||
|
* @dest: Destination
|
||||||
|
* @src: Source
|
||||||
|
* @n: Number of bytes to copy
|
||||||
|
* Returns: dest
|
||||||
|
*
|
||||||
|
* The memory areas src and dst may overlap.
|
||||||
|
*/
|
||||||
|
void *os_memmove(void *dest, const void *src, size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_memset - Fill memory with a constant byte
|
||||||
|
* @s: Memory area to be filled
|
||||||
|
* @c: Constant byte
|
||||||
|
* @n: Number of bytes started from s to fill with c
|
||||||
|
* Returns: s
|
||||||
|
*/
|
||||||
|
void *os_memset(void *s, int c, size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_memcmp - Compare memory areas
|
||||||
|
* @s1: First buffer
|
||||||
|
* @s2: Second buffer
|
||||||
|
* @n: Maximum numbers of octets to compare
|
||||||
|
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||||
|
* found to be less than, to match, or be greater than s2. Only first n
|
||||||
|
* characters will be compared.
|
||||||
|
*/
|
||||||
|
int os_memcmp(const void *s1, const void *s2, size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strdup - Duplicate a string
|
||||||
|
* @s: Source string
|
||||||
|
* Returns: Allocated buffer with the string copied into it or %NULL on failure
|
||||||
|
*
|
||||||
|
* Caller is responsible for freeing the returned buffer with os_free().
|
||||||
|
*/
|
||||||
|
char *os_strdup(const char *s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strlen - Calculate the length of a string
|
||||||
|
* @s: '\0' terminated string
|
||||||
|
* Returns: Number of characters in s (not counting the '\0' terminator)
|
||||||
|
*/
|
||||||
|
size_t os_strlen(const char *s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strcasecmp - Compare two strings ignoring case
|
||||||
|
* @s1: First string
|
||||||
|
* @s2: Second string
|
||||||
|
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||||
|
* found to be less than, to match, or be greatred than s2
|
||||||
|
*/
|
||||||
|
int os_strcasecmp(const char *s1, const char *s2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strncasecmp - Compare two strings ignoring case
|
||||||
|
* @s1: First string
|
||||||
|
* @s2: Second string
|
||||||
|
* @n: Maximum numbers of characters to compare
|
||||||
|
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||||
|
* found to be less than, to match, or be greater than s2. Only first n
|
||||||
|
* characters will be compared.
|
||||||
|
*/
|
||||||
|
int os_strncasecmp(const char *s1, const char *s2, size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strchr - Locate the first occurrence of a character in string
|
||||||
|
* @s: String
|
||||||
|
* @c: Character to search for
|
||||||
|
* Returns: Pointer to the matched character or %NULL if not found
|
||||||
|
*/
|
||||||
|
char *os_strchr(const char *s, int c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strrchr - Locate the last occurrence of a character in string
|
||||||
|
* @s: String
|
||||||
|
* @c: Character to search for
|
||||||
|
* Returns: Pointer to the matched character or %NULL if not found
|
||||||
|
*/
|
||||||
|
char *os_strrchr(const char *s, int c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strcmp - Compare two strings
|
||||||
|
* @s1: First string
|
||||||
|
* @s2: Second string
|
||||||
|
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||||
|
* found to be less than, to match, or be greatred than s2
|
||||||
|
*/
|
||||||
|
int os_strcmp(const char *s1, const char *s2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strncmp - Compare two strings
|
||||||
|
* @s1: First string
|
||||||
|
* @s2: Second string
|
||||||
|
* @n: Maximum numbers of characters to compare
|
||||||
|
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||||
|
* found to be less than, to match, or be greater than s2. Only first n
|
||||||
|
* characters will be compared.
|
||||||
|
*/
|
||||||
|
int os_strncmp(const char *s1, const char *s2, size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strncpy - Copy a string
|
||||||
|
* @dest: Destination
|
||||||
|
* @src: Source
|
||||||
|
* @n: Maximum number of characters to copy
|
||||||
|
* Returns: dest
|
||||||
|
*/
|
||||||
|
char *os_strncpy(char *dest, const char *src, size_t n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_strstr - Locate a substring
|
||||||
|
* @haystack: String (haystack) to search from
|
||||||
|
* @needle: Needle to search from haystack
|
||||||
|
* Returns: Pointer to the beginning of the substring or %NULL if not found
|
||||||
|
*/
|
||||||
|
char *os_strstr(const char *haystack, const char *needle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* os_snprintf - Print to a memory buffer
|
||||||
|
* @str: Memory buffer to print into
|
||||||
|
* @size: Maximum length of the str buffer
|
||||||
|
* @format: printf format
|
||||||
|
* Returns: Number of characters printed (not including trailing '\0').
|
||||||
|
*
|
||||||
|
* If the output buffer is truncated, number of characters which would have
|
||||||
|
* been written is returned. Since some C libraries return -1 in such a case,
|
||||||
|
* the caller must be prepared on that value, too, to indicate truncation.
|
||||||
|
*
|
||||||
|
* Note: Some C library implementations of snprintf() may not guarantee null
|
||||||
|
* termination in case the output is truncated. The OS wrapper function of
|
||||||
|
* os_snprintf() should provide this guarantee, i.e., to null terminate the
|
||||||
|
* output buffer if a C library version of the function is used and if that
|
||||||
|
* function does not guarantee null termination.
|
||||||
|
*
|
||||||
|
* If the target system does not include snprintf(), see, e.g.,
|
||||||
|
* http://www.ijs.si/software/snprintf/ for an example of a portable
|
||||||
|
* implementation of snprintf.
|
||||||
|
*/
|
||||||
|
int os_snprintf(char *str, size_t size, const char *format, ...);
|
||||||
|
|
||||||
|
#else /* OS_NO_C_LIB_DEFINES */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#ifdef CONFIG_MEM_MONITOR
|
||||||
|
u8* os_malloc(u32 sz);
|
||||||
|
void os_mfree(u8 *pbuf, u32 sz);
|
||||||
|
#ifndef os_free
|
||||||
|
#define os_free(p, sz) os_mfree(((u8*)(p)), (sz))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifndef os_malloc
|
||||||
|
#define os_malloc(sz) _rtw_malloc(sz)
|
||||||
|
#endif
|
||||||
|
#ifndef os_free
|
||||||
|
#define os_free(p, sz) _rtw_mfree(((u8*)(p)), (sz))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
extern void *os_zalloc(size_t size);
|
||||||
|
extern char *os_strdup(const char *string_copy_from);
|
||||||
|
|
||||||
|
#ifndef os_sleep
|
||||||
|
#define os_sleep(s, us) rtw_mdelay_os((s)*1000 + (us)/1000)
|
||||||
|
#endif
|
||||||
|
#ifndef os_memcpy
|
||||||
|
#define os_memcpy(d, s, n) rtw_memcpy((void*)(d), ((void*)(s)), (n))
|
||||||
|
#endif
|
||||||
|
#ifndef os_memmove
|
||||||
|
#define os_memmove(d, s, n) memmove((d), (s), (n))
|
||||||
|
#endif
|
||||||
|
#ifndef os_memset
|
||||||
|
#define os_memset(pbuf, c, sz) rtw_memset(pbuf, c, sz)
|
||||||
|
#endif
|
||||||
|
#ifndef os_memcmp
|
||||||
|
#define os_memcmp(s1, s2, n) rtw_memcmp(((void*)(s1)), ((void*)(s2)), (n))
|
||||||
|
#endif
|
||||||
|
#ifndef os_memcmp_p2p
|
||||||
|
#define os_memcmp_p2p(s1, s2, n) memcmp((s1), (s2), (n))
|
||||||
|
#endif
|
||||||
|
#ifndef os_get_random_bytes
|
||||||
|
#define os_get_random_bytes(d,sz) rtw_get_random_bytes(((void*)(d)), (sz))
|
||||||
|
#endif
|
||||||
|
#ifndef os_strlen
|
||||||
|
#define os_strlen(s) strlen(s)
|
||||||
|
#endif
|
||||||
|
#ifndef os_strcasecmp
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define os_strcasecmp(s1, s2) _stricmp((s1), (s2))
|
||||||
|
#else
|
||||||
|
#define os_strcasecmp(s1, s2) strcasecmp((s1), (s2))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef os_strncasecmp
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define os_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
|
||||||
|
#else
|
||||||
|
#define os_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef os_init_timer
|
||||||
|
#define os_init_timer(t, p, f, x, n) rtw_init_timer((t), (p), (f), (x), (n))
|
||||||
|
#endif
|
||||||
|
#ifndef os_set_timer
|
||||||
|
#define os_set_timer(t, d) rtw_set_timer((t), (d))
|
||||||
|
#endif
|
||||||
|
#ifndef os_cancel_timer
|
||||||
|
#define os_cancel_timer(t) rtw_cancel_timer(t)
|
||||||
|
#endif
|
||||||
|
#ifndef os_del_timer
|
||||||
|
#define os_del_timer(t) rtw_del_timer(t)
|
||||||
|
#endif
|
||||||
|
#ifndef os_atoi
|
||||||
|
#define os_atoi(s) rtw_atoi(s)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef os_strchr
|
||||||
|
#define os_strchr(s, c) strchr((s), (c))
|
||||||
|
#endif
|
||||||
|
#ifndef os_strcmp
|
||||||
|
#define os_strcmp(s1, s2) strcmp((s1), (s2))
|
||||||
|
#endif
|
||||||
|
#ifndef os_strncmp
|
||||||
|
#define os_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
|
||||||
|
#endif
|
||||||
|
#ifndef os_strncpy
|
||||||
|
#define os_strncpy(d, s, n) strncpy((d), (s), (n))
|
||||||
|
#endif
|
||||||
|
#ifndef os_strrchr
|
||||||
|
#define os_strrchr(s, c) strrchr((s), (c))
|
||||||
|
#endif
|
||||||
|
#ifndef os_strstr
|
||||||
|
#define os_strstr(h, n) strstr((h), (n))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef os_snprintf
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define os_snprintf _snprintf
|
||||||
|
#else
|
||||||
|
#define os_snprintf snprintf
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OS_NO_C_LIB_DEFINES */
|
||||||
|
|
||||||
|
|
||||||
|
static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
if (size && nmemb > (~(size_t) 0) / size)
|
||||||
|
return NULL;
|
||||||
|
return os_realloc(ptr, nmemb * size, nmemb * size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *os_xqueue_create(unsigned long uxQueueLength, unsigned long uxItemSize) ;
|
||||||
|
|
||||||
|
int os_xqueue_receive(xqueue_handle_t xQueue, void * const pvBuffer, unsigned long xSecsToWait);
|
||||||
|
|
||||||
|
void os_xqueue_delete(xqueue_handle_t xQueue );
|
||||||
|
|
||||||
|
int os_xqueue_send(xqueue_handle_t xQueue, const void * const pvItemToQueue, unsigned long xSecsToWait);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* OS_H */
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* OS specific functions for UNIX/POSIX systems
|
||||||
|
* Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
|
||||||
|
*
|
||||||
|
* This software may be distributed under the terms of the BSD license.
|
||||||
|
* See README for more details.
|
||||||
|
*/
|
||||||
|
#include "utils/os.h"
|
||||||
|
|
||||||
|
//#ifdef CONFIG_WPS
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#ifdef CONFIG_MEM_MONITOR
|
||||||
|
#if CONFIG_MEM_MONITOR & MEM_MONITOR_LEAK
|
||||||
|
_list wpa_mem_table;
|
||||||
|
int wpa_mem_used_num;
|
||||||
|
//int wpa_mem_used_size;
|
||||||
|
#endif
|
||||||
|
extern int min_free_heap_size;
|
||||||
|
u8* os_malloc(u32 sz)
|
||||||
|
{
|
||||||
|
int free_heap_size = rtw_getFreeHeapSize();
|
||||||
|
u8 *pbuf = _rtw_malloc(sz);
|
||||||
|
#if CONFIG_MEM_MONITOR & MEM_MONITOR_LEAK
|
||||||
|
add_mem_usage(&wpa_mem_table, pbuf, sz, &wpa_mem_used_num, MEM_MONITOR_FLAG_WPAS);
|
||||||
|
#else
|
||||||
|
add_mem_usage(NULL, pbuf, sz, NULL, MEM_MONITOR_FLAG_WPAS);
|
||||||
|
#endif
|
||||||
|
if(min_free_heap_size > free_heap_size)
|
||||||
|
min_free_heap_size = free_heap_size;
|
||||||
|
return pbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void os_mfree(u8 *pbuf, u32 sz)
|
||||||
|
{
|
||||||
|
_rtw_mfree(pbuf, sz);
|
||||||
|
#if CONFIG_MEM_MONITOR & MEM_MONITOR_LEAK
|
||||||
|
del_mem_usage(&wpa_mem_table, pbuf, &wpa_mem_used_num, MEM_MONITOR_FLAG_WPAS);
|
||||||
|
#else
|
||||||
|
del_mem_usage(NULL, pbuf, NULL, MEM_MONITOR_FLAG_WPAS);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif//CONFIG_MEM_MONITOR
|
||||||
|
|
||||||
|
#endif// !defined(CONFIG_PLATFORM_8195A)
|
||||||
|
|
||||||
|
#ifndef OS_NO_C_LIB_DEFINES
|
||||||
|
char *os_strdup(const char *string_copy_from)
|
||||||
|
{
|
||||||
|
char *string_copy_to = NULL;
|
||||||
|
string_copy_to = os_zalloc(strlen(string_copy_from) + 1);
|
||||||
|
os_memcpy((void *)string_copy_to, string_copy_from, strlen(string_copy_from));
|
||||||
|
string_copy_to[strlen(string_copy_from)] = '\0';
|
||||||
|
return string_copy_to;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int os_get_random(unsigned char *buf, size_t len)
|
||||||
|
{
|
||||||
|
//TODO implement it
|
||||||
|
rtw_get_random_bytes(buf, len);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int os_get_time(struct os_time *t){
|
||||||
|
unsigned int tt = rtw_get_current_time();
|
||||||
|
t->sec = (os_time_t) (tt / 1000);
|
||||||
|
t->usec = (os_time_t) (tt % 1000)*1000;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int os_get_reltime(struct os_reltime *t){
|
||||||
|
os_get_time((struct os_time *)t);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
void *os_xqueue_create(unsigned long uxQueueLength, unsigned long uxItemSize)
|
||||||
|
{
|
||||||
|
return xQueueCreate( uxQueueLength, uxItemSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
int os_xqueue_receive(xqueue_handle_t xQueue, void * const pvBuffer, unsigned long xSecsToWait)
|
||||||
|
{
|
||||||
|
return xQueueReceive((xQueueHandle)xQueue, pvBuffer, (portTickType)(xSecsToWait*configTICK_RATE_HZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
void os_xqueue_delete(xqueue_handle_t xQueue )
|
||||||
|
{
|
||||||
|
vQueueDelete((xQueueHandle)xQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
int os_xqueue_send(xqueue_handle_t xQueue, const void * const pvItemToQueue, unsigned long xSecsToWait)
|
||||||
|
{
|
||||||
|
return xQueueSendToBack((xQueueHandle)xQueue, pvItemToQueue, (portTickType)(xSecsToWait*configTICK_RATE_HZ));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void *os_xqueue_create(unsigned long uxQueueLength, unsigned long uxItemSize)
|
||||||
|
{
|
||||||
|
void* xQueue = NULL;
|
||||||
|
rtw_init_xqueue(&xQueue, "queue", uxItemSize, uxQueueLength);
|
||||||
|
return xQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int os_xqueue_receive(xqueue_handle_t xQueue, void * const pvBuffer, unsigned long xSecsToWait)
|
||||||
|
{
|
||||||
|
return rtw_pop_from_xqueue(&xQueue, pvBuffer, xSecsToWait*1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void os_xqueue_delete(xqueue_handle_t xQueue )
|
||||||
|
{
|
||||||
|
rtw_deinit_xqueue(&xQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
int os_xqueue_send(xqueue_handle_t xQueue, const void * const pvItemToQueue, unsigned long xSecsToWait)
|
||||||
|
{
|
||||||
|
return rtw_push_to_xqueue(&xQueue, (void*)pvItemToQueue, xSecsToWait*1000);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
//#endif
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* OS specific functions
|
||||||
|
* Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
|
||||||
|
*
|
||||||
|
* This software may be distributed under the terms of the BSD license.
|
||||||
|
* See README for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ROM_WPS_OS_H
|
||||||
|
#define ROM_WPS_OS_H
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||||
|
|
||||||
|
#include <rom_wlan_ram_map.h>
|
||||||
|
extern struct _rom_wlan_ram_map rom_wlan_ram_map;
|
||||||
|
#define os_malloc(sz) rom_wlan_ram_map.rtw_malloc(sz)
|
||||||
|
#define os_free(p, sz) rom_wlan_ram_map.rtw_mfree(((u8*)(p)), (sz))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern u8 *WPS_realloc(u8 *old_buf, u32 old_sz, u32 new_sz);
|
||||||
|
#define os_realloc(p, os, ns) WPS_realloc(((u8*)(p)),(os),(ns))
|
||||||
|
|
||||||
|
#endif /* ROM_WPS_OS_H */
|
|
@ -0,0 +1,319 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wi-Fi Protected Setup - message definitions
|
||||||
|
* Copyright (c) 2008, Jouni Malinen <j@w1.fi>
|
||||||
|
*
|
||||||
|
* This software may be distributed under the terms of the BSD license.
|
||||||
|
* See README for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WPS_DEFS_H
|
||||||
|
#define WPS_DEFS_H
|
||||||
|
|
||||||
|
|
||||||
|
/* Diffie-Hellman 1536-bit MODP Group; RFC 3526, Group 5 */
|
||||||
|
#define WPS_DH_GROUP (5)
|
||||||
|
|
||||||
|
#define WPS_UUID_LEN (16)
|
||||||
|
#define WPS_NONCE_LEN (16)
|
||||||
|
#define WPS_AUTHENTICATOR_LEN (8)
|
||||||
|
#define WPS_AUTHKEY_LEN (32)
|
||||||
|
#define WPS_KEYWRAPKEY_LEN (16)
|
||||||
|
#define WPS_EMSK_LEN (32)
|
||||||
|
#define WPS_PSK_LEN (16)
|
||||||
|
#define WPS_SECRET_NONCE_LEN (16)
|
||||||
|
#define WPS_HASH_LEN (32)
|
||||||
|
#define WPS_KWA_LEN (8)
|
||||||
|
#define WPS_MGMTAUTHKEY_LEN (32)
|
||||||
|
#define WPS_MGMTENCKEY_LEN (16)
|
||||||
|
#define WPS_MGMT_KEY_ID_LEN (16)
|
||||||
|
#define WPS_OOB_DEVICE_PASSWORD_MIN_LEN (16)
|
||||||
|
#define WPS_OOB_DEVICE_PASSWORD_LEN (32)
|
||||||
|
#define WPS_OOB_PUBKEY_HASH_LEN (20)
|
||||||
|
|
||||||
|
/* Attribute Types */
|
||||||
|
enum wps_attribute {
|
||||||
|
ATTR_AP_CHANNEL = 0x1001,
|
||||||
|
ATTR_ASSOC_STATE = 0x1002,
|
||||||
|
ATTR_AUTH_TYPE = 0x1003,
|
||||||
|
ATTR_AUTH_TYPE_FLAGS = 0x1004,
|
||||||
|
ATTR_AUTHENTICATOR = 0x1005,
|
||||||
|
ATTR_CONFIG_METHODS = 0x1008,
|
||||||
|
ATTR_CONFIG_ERROR = 0x1009,
|
||||||
|
ATTR_CONFIRM_URL4 = 0x100a,
|
||||||
|
ATTR_CONFIRM_URL6 = 0x100b,
|
||||||
|
ATTR_CONN_TYPE = 0x100c,
|
||||||
|
ATTR_CONN_TYPE_FLAGS = 0x100d,
|
||||||
|
ATTR_CRED = 0x100e,
|
||||||
|
ATTR_ENCR_TYPE = 0x100f,
|
||||||
|
ATTR_ENCR_TYPE_FLAGS = 0x1010,
|
||||||
|
ATTR_DEV_NAME = 0x1011,
|
||||||
|
ATTR_DEV_PASSWORD_ID = 0x1012,
|
||||||
|
ATTR_E_HASH1 = 0x1014,
|
||||||
|
ATTR_E_HASH2 = 0x1015,
|
||||||
|
ATTR_E_SNONCE1 = 0x1016,
|
||||||
|
ATTR_E_SNONCE2 = 0x1017,
|
||||||
|
ATTR_ENCR_SETTINGS = 0x1018,
|
||||||
|
ATTR_ENROLLEE_NONCE = 0x101a,
|
||||||
|
ATTR_FEATURE_ID = 0x101b,
|
||||||
|
ATTR_IDENTITY = 0x101c,
|
||||||
|
ATTR_IDENTITY_PROOF = 0x101d,
|
||||||
|
ATTR_KEY_WRAP_AUTH = 0x101e,
|
||||||
|
ATTR_KEY_ID = 0x101f,
|
||||||
|
ATTR_MAC_ADDR = 0x1020,
|
||||||
|
ATTR_MANUFACTURER = 0x1021,
|
||||||
|
ATTR_MSG_TYPE = 0x1022,
|
||||||
|
ATTR_MODEL_NAME = 0x1023,
|
||||||
|
ATTR_MODEL_NUMBER = 0x1024,
|
||||||
|
ATTR_NETWORK_INDEX = 0x1026,
|
||||||
|
ATTR_NETWORK_KEY = 0x1027,
|
||||||
|
ATTR_NETWORK_KEY_INDEX = 0x1028,
|
||||||
|
ATTR_NEW_DEVICE_NAME = 0x1029,
|
||||||
|
ATTR_NEW_PASSWORD = 0x102a,
|
||||||
|
ATTR_OOB_DEVICE_PASSWORD = 0x102c,
|
||||||
|
ATTR_OS_VERSION = 0x102d,
|
||||||
|
ATTR_POWER_LEVEL = 0x102f,
|
||||||
|
ATTR_PSK_CURRENT = 0x1030,
|
||||||
|
ATTR_PSK_MAX = 0x1031,
|
||||||
|
ATTR_PUBLIC_KEY = 0x1032,
|
||||||
|
ATTR_RADIO_ENABLE = 0x1033,
|
||||||
|
ATTR_REBOOT = 0x1034,
|
||||||
|
ATTR_REGISTRAR_CURRENT = 0x1035,
|
||||||
|
ATTR_REGISTRAR_ESTABLISHED = 0x1036,
|
||||||
|
ATTR_REGISTRAR_LIST = 0x1037,
|
||||||
|
ATTR_REGISTRAR_MAX = 0x1038,
|
||||||
|
ATTR_REGISTRAR_NONCE = 0x1039,
|
||||||
|
ATTR_REQUEST_TYPE = 0x103a,
|
||||||
|
ATTR_RESPONSE_TYPE = 0x103b,
|
||||||
|
ATTR_RF_BANDS = 0x103c,
|
||||||
|
ATTR_R_HASH1 = 0x103d,
|
||||||
|
ATTR_R_HASH2 = 0x103e,
|
||||||
|
ATTR_R_SNONCE1 = 0x103f,
|
||||||
|
ATTR_R_SNONCE2 = 0x1040,
|
||||||
|
ATTR_SELECTED_REGISTRAR = 0x1041,
|
||||||
|
ATTR_SERIAL_NUMBER = 0x1042,
|
||||||
|
ATTR_WPS_STATE = 0x1044,
|
||||||
|
ATTR_SSID = 0x1045,
|
||||||
|
ATTR_TOTAL_NETWORKS = 0x1046,
|
||||||
|
ATTR_UUID_E = 0x1047,
|
||||||
|
ATTR_UUID_R = 0x1048,
|
||||||
|
ATTR_VENDOR_EXT = 0x1049,
|
||||||
|
ATTR_VERSION = 0x104a,
|
||||||
|
ATTR_X509_CERT_REQ = 0x104b,
|
||||||
|
ATTR_X509_CERT = 0x104c,
|
||||||
|
ATTR_EAP_IDENTITY = 0x104d,
|
||||||
|
ATTR_MSG_COUNTER = 0x104e,
|
||||||
|
ATTR_PUBKEY_HASH = 0x104f,
|
||||||
|
ATTR_REKEY_KEY = 0x1050,
|
||||||
|
ATTR_KEY_LIFETIME = 0x1051,
|
||||||
|
ATTR_PERMITTED_CFG_METHODS = 0x1052,
|
||||||
|
ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053,
|
||||||
|
ATTR_PRIMARY_DEV_TYPE = 0x1054,
|
||||||
|
ATTR_SECONDARY_DEV_TYPE_LIST = 0x1055,
|
||||||
|
ATTR_PORTABLE_DEV = 0x1056,
|
||||||
|
ATTR_AP_SETUP_LOCKED = 0x1057,
|
||||||
|
ATTR_APPLICATION_EXT = 0x1058,
|
||||||
|
ATTR_EAP_TYPE = 0x1059,
|
||||||
|
ATTR_IV = 0x1060,
|
||||||
|
ATTR_KEY_PROVIDED_AUTO = 0x1061,
|
||||||
|
ATTR_802_1X_ENABLED = 0x1062,
|
||||||
|
ATTR_APPSESSIONKEY = 0x1063,
|
||||||
|
ATTR_WEPTRANSMITKEY = 0x1064,
|
||||||
|
ATTR_REQUESTED_DEV_TYPE = 0x106a,
|
||||||
|
ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define WPS_VENDOR_ID_WFA 14122
|
||||||
|
|
||||||
|
/* WFA Vendor Extension subelements */
|
||||||
|
enum {
|
||||||
|
WFA_ELEM_VERSION2 = 0x00,
|
||||||
|
WFA_ELEM_AUTHORIZEDMACS = 0x01,
|
||||||
|
WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
|
||||||
|
WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
|
||||||
|
WFA_ELEM_SETTINGS_DELAY_TIME = 0x04
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Device Password ID */
|
||||||
|
enum wps_dev_password_id {
|
||||||
|
DEV_PW_DEFAULT = 0x0000,
|
||||||
|
DEV_PW_USER_SPECIFIED = 0x0001,
|
||||||
|
DEV_PW_MACHINE_SPECIFIED = 0x0002,
|
||||||
|
DEV_PW_REKEY = 0x0003,
|
||||||
|
DEV_PW_PUSHBUTTON = 0x0004,
|
||||||
|
DEV_PW_REGISTRAR_SPECIFIED = 0x0005
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Message Type */
|
||||||
|
enum wps_msg_type {
|
||||||
|
WPS_START = 0x00,
|
||||||
|
WPS_Beacon = 0x01,
|
||||||
|
WPS_ProbeRequest = 0x02,
|
||||||
|
WPS_ProbeResponse = 0x03,
|
||||||
|
WPS_M1 = 0x04,
|
||||||
|
WPS_M2 = 0x05,
|
||||||
|
WPS_M2D = 0x06,
|
||||||
|
WPS_M3 = 0x07,
|
||||||
|
WPS_M4 = 0x08,
|
||||||
|
WPS_M5 = 0x09,
|
||||||
|
WPS_M6 = 0x0a,
|
||||||
|
WPS_M7 = 0x0b,
|
||||||
|
WPS_M8 = 0x0c,
|
||||||
|
WPS_WSC_ACK = 0x0d,
|
||||||
|
WPS_WSC_NACK = 0x0e,
|
||||||
|
WPS_WSC_DONE = 0x0f
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Authentication Type Flags */
|
||||||
|
#define WPS_AUTH_OPEN 0x0001
|
||||||
|
#define WPS_AUTH_WPAPSK 0x0002
|
||||||
|
#define WPS_AUTH_SHARED 0x0004
|
||||||
|
#define WPS_AUTH_WPA 0x0008
|
||||||
|
#define WPS_AUTH_WPA2 0x0010
|
||||||
|
#define WPS_AUTH_WPA2PSK 0x0020
|
||||||
|
#define WPS_AUTH_TYPES (WPS_AUTH_OPEN | WPS_AUTH_WPAPSK | WPS_AUTH_SHARED | \
|
||||||
|
WPS_AUTH_WPA | WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)
|
||||||
|
|
||||||
|
/* Encryption Type Flags */
|
||||||
|
#define WPS_ENCR_NONE 0x0001
|
||||||
|
#define WPS_ENCR_WEP 0x0002
|
||||||
|
#define WPS_ENCR_TKIP 0x0004
|
||||||
|
#define WPS_ENCR_AES 0x0008
|
||||||
|
#define WPS_ENCR_TYPES (WPS_ENCR_NONE | WPS_ENCR_WEP | WPS_ENCR_TKIP | \
|
||||||
|
WPS_ENCR_AES)
|
||||||
|
|
||||||
|
/* Configuration Error */
|
||||||
|
enum wps_config_error {
|
||||||
|
WPS_CFG_NO_ERROR = 0,
|
||||||
|
WPS_CFG_OOB_IFACE_READ_ERROR = 1,
|
||||||
|
WPS_CFG_DECRYPTION_CRC_FAILURE = 2,
|
||||||
|
WPS_CFG_24_CHAN_NOT_SUPPORTED = 3,
|
||||||
|
WPS_CFG_50_CHAN_NOT_SUPPORTED = 4,
|
||||||
|
WPS_CFG_SIGNAL_TOO_WEAK = 5,
|
||||||
|
WPS_CFG_NETWORK_AUTH_FAILURE = 6,
|
||||||
|
WPS_CFG_NETWORK_ASSOC_FAILURE = 7,
|
||||||
|
WPS_CFG_NO_DHCP_RESPONSE = 8,
|
||||||
|
WPS_CFG_FAILED_DHCP_CONFIG = 9,
|
||||||
|
WPS_CFG_IP_ADDR_CONFLICT = 10,
|
||||||
|
WPS_CFG_NO_CONN_TO_REGISTRAR = 11,
|
||||||
|
WPS_CFG_MULTIPLE_PBC_DETECTED = 12,
|
||||||
|
WPS_CFG_ROGUE_SUSPECTED = 13,
|
||||||
|
WPS_CFG_DEVICE_BUSY = 14,
|
||||||
|
WPS_CFG_SETUP_LOCKED = 15,
|
||||||
|
WPS_CFG_MSG_TIMEOUT = 16,
|
||||||
|
WPS_CFG_REG_SESS_TIMEOUT = 17,
|
||||||
|
WPS_CFG_DEV_PASSWORD_AUTH_FAILURE = 18
|
||||||
|
};
|
||||||
|
|
||||||
|
/* RF Bands */
|
||||||
|
#define WPS_RF_24GHZ (0x01)
|
||||||
|
#define WPS_RF_50GHZ (0x02)
|
||||||
|
|
||||||
|
/* Config Methods */
|
||||||
|
#define WPS_CONFIG_USBA (0x0001)
|
||||||
|
#define WPS_CONFIG_ETHERNET (0x0002)
|
||||||
|
#define WPS_CONFIG_LABEL (0x0004)
|
||||||
|
#define WPS_CONFIG_DISPLAY (0x0008)
|
||||||
|
#define WPS_CONFIG_EXT_NFC_TOKEN (0x0010)
|
||||||
|
#define WPS_CONFIG_INT_NFC_TOKEN (0x0020)
|
||||||
|
#define WPS_CONFIG_NFC_INTERFACE (0x0040)
|
||||||
|
#define WPS_CONFIG_PUSHBUTTON (0x0080)
|
||||||
|
#define WPS_CONFIG_KEYPAD (0x0100)
|
||||||
|
|
||||||
|
#ifdef CONFIG_WPS2
|
||||||
|
#define WPS_CONFIG_VIRT_PUSHBUTTON (0x0280)
|
||||||
|
#define WPS_CONFIG_PHY_PUSHBUTTON (0x0480)
|
||||||
|
#define WPS_CONFIG_VIRT_DISPLAY (0x2008)
|
||||||
|
#define WPS_CONFIG_PHY_DISPLAY (0x4008)
|
||||||
|
#endif /* CONFIG_WPS2 */
|
||||||
|
|
||||||
|
/* Connection Type Flags */
|
||||||
|
#define WPS_CONN_ESS (0x01)
|
||||||
|
#define WPS_CONN_IBSS (0x02)
|
||||||
|
|
||||||
|
/* Wi-Fi Protected Setup State */
|
||||||
|
enum wps_state {
|
||||||
|
WPS_STATE_NOT_CONFIGURED = 1,
|
||||||
|
WPS_STATE_CONFIGURED = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Association State */
|
||||||
|
enum wps_assoc_state {
|
||||||
|
WPS_ASSOC_NOT_ASSOC = 0,
|
||||||
|
WPS_ASSOC_CONN_SUCCESS = 1,
|
||||||
|
WPS_ASSOC_CFG_FAILURE = 2,
|
||||||
|
WPS_ASSOC_FAILURE = 3,
|
||||||
|
WPS_ASSOC_IP_FAILURE = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define WPS_DEV_OUI_WFA (0x0050f204)
|
||||||
|
|
||||||
|
enum wps_dev_categ {
|
||||||
|
WPS_DEV_COMPUTER = 1,
|
||||||
|
WPS_DEV_INPUT = 2,
|
||||||
|
WPS_DEV_PRINTER = 3,
|
||||||
|
WPS_DEV_CAMERA = 4,
|
||||||
|
WPS_DEV_STORAGE = 5,
|
||||||
|
WPS_DEV_NETWORK_INFRA = 6,
|
||||||
|
WPS_DEV_DISPLAY = 7,
|
||||||
|
WPS_DEV_MULTIMEDIA = 8,
|
||||||
|
WPS_DEV_GAMING = 9,
|
||||||
|
WPS_DEV_PHONE = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
enum wps_dev_subcateg {
|
||||||
|
WPS_DEV_COMPUTER_PC = 1,
|
||||||
|
WPS_DEV_COMPUTER_SERVER = 2,
|
||||||
|
WPS_DEV_COMPUTER_MEDIA_CENTER = 3,
|
||||||
|
|
||||||
|
WPS_DEV_PRINTER_PRINTER = 1,
|
||||||
|
WPS_DEV_PRINTER_SCANNER = 2,
|
||||||
|
|
||||||
|
WPS_DEV_CAMERA_DIGITAL_STILL_CAMERA = 1,
|
||||||
|
|
||||||
|
WPS_DEV_STORAGE_NAS = 1,
|
||||||
|
|
||||||
|
WPS_DEV_NETWORK_INFRA_AP = 1,
|
||||||
|
WPS_DEV_NETWORK_INFRA_ROUTER = 2,
|
||||||
|
WPS_DEV_NETWORK_INFRA_SWITCH = 3,
|
||||||
|
|
||||||
|
WPS_DEV_DISPLAY_TV = 1,
|
||||||
|
WPS_DEV_DISPLAY_PICTURE_FRAME = 2,
|
||||||
|
WPS_DEV_DISPLAY_PROJECTOR = 3,
|
||||||
|
|
||||||
|
WPS_DEV_MULTIMEDIA_DAR = 1,
|
||||||
|
WPS_DEV_MULTIMEDIA_PVR = 2,
|
||||||
|
WPS_DEV_MULTIMEDIA_MCX = 3,
|
||||||
|
|
||||||
|
WPS_DEV_GAMING_XBOX = 1,
|
||||||
|
WPS_DEV_GAMING_XBOX360 = 2,
|
||||||
|
WPS_DEV_GAMING_PLAYSTATION = 3,
|
||||||
|
|
||||||
|
WPS_DEV_PHONE_WINDOWS_MOBILE = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Request Type */
|
||||||
|
enum wps_request_type {
|
||||||
|
WPS_REQ_ENROLLEE_INFO = 0,
|
||||||
|
WPS_REQ_ENROLLEE = 1,
|
||||||
|
WPS_REQ_REGISTRAR = 2,
|
||||||
|
WPS_REQ_WLAN_MANAGER_REGISTRAR = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Response Type */
|
||||||
|
enum wps_response_type {
|
||||||
|
WPS_RESP_ENROLLEE_INFO = 0,
|
||||||
|
WPS_RESP_ENROLLEE = 1,
|
||||||
|
WPS_RESP_REGISTRAR = 2,
|
||||||
|
WPS_RESP_AP = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Walk Time for push button configuration (in seconds) */
|
||||||
|
#define WPS_PBC_WALK_TIME (120)
|
||||||
|
|
||||||
|
#define WPS_MAX_AUTHORIZED_MACS (5)
|
||||||
|
|
||||||
|
#endif /* WPS_DEFS_H */
|
||||||
|
|
|
@ -0,0 +1,453 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "queue.h"
|
||||||
|
#include "utils/os.h"
|
||||||
|
#include <lwip_netconf.h>
|
||||||
|
#include <lwip/netif.h>
|
||||||
|
#include "wifi/wifi_conf.h"
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
#include <polarssl/ssl.h>
|
||||||
|
#include <polarssl/memory.h>
|
||||||
|
|
||||||
|
#define WLAN0_NAME "wlan0"
|
||||||
|
#ifndef ENABLE
|
||||||
|
#define ENABLE (1)
|
||||||
|
#endif
|
||||||
|
#ifndef DISABLE
|
||||||
|
#define DISABLE (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
u8 eap_phase = 0;
|
||||||
|
u8 eap_method = 0;
|
||||||
|
|
||||||
|
// eap config arguments
|
||||||
|
char *eap_target_ssid = NULL;
|
||||||
|
char *eap_identity = NULL;
|
||||||
|
char *eap_password = NULL;
|
||||||
|
// if set eap_ca_cert and defined(EAP_SSL_VERIFY_SERVER), client will verify server's cert
|
||||||
|
const unsigned char *eap_ca_cert = NULL;
|
||||||
|
// if set eap_client_cert, eap_client_key, and defined(EAP_SSL_VERIFY_CLIENT), client will send its cert to server
|
||||||
|
const unsigned char *eap_client_cert = NULL;
|
||||||
|
const unsigned char *eap_client_key = NULL;
|
||||||
|
char *eap_client_key_pwd = NULL;
|
||||||
|
|
||||||
|
int max_buf_bio_size = SSL_BUFFER_LEN;
|
||||||
|
|
||||||
|
#ifdef CONFIG_ENABLE_EAP
|
||||||
|
void eap_eapol_recvd_hdl(char *buf, int buf_len, int flags, void* handler_user_data);
|
||||||
|
void eap_eapol_start_hdl(char *buf, int buf_len, int flags, void* handler_user_data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void set_eap_phase(unsigned char is_trigger_eap){
|
||||||
|
eap_phase = is_trigger_eap;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_eap_phase(void){
|
||||||
|
return eap_phase;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_eap_method(void){
|
||||||
|
return eap_method;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_config(void){
|
||||||
|
eap_target_ssid = NULL;
|
||||||
|
eap_identity = NULL;
|
||||||
|
eap_password = NULL;
|
||||||
|
eap_ca_cert = NULL;
|
||||||
|
eap_client_cert = NULL;
|
||||||
|
eap_client_key = NULL;
|
||||||
|
eap_client_key_pwd = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void judge_station_disconnect(void)
|
||||||
|
{
|
||||||
|
int mode = 0;
|
||||||
|
unsigned char ssid[33];
|
||||||
|
|
||||||
|
wext_get_mode(WLAN0_NAME, &mode);
|
||||||
|
|
||||||
|
switch(mode) {
|
||||||
|
case IW_MODE_MASTER: //In AP mode
|
||||||
|
wifi_off();
|
||||||
|
vTaskDelay(20);
|
||||||
|
wifi_on(RTW_MODE_STA);
|
||||||
|
break;
|
||||||
|
case IW_MODE_INFRA: //In STA mode
|
||||||
|
if(wext_get_ssid(WLAN0_NAME, ssid) > 0)
|
||||||
|
wifi_disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef CONFIG_ENABLE_EAP
|
||||||
|
void eap_disconnected_hdl(char *buf, int buf_len, int flags, void* handler_user_data){
|
||||||
|
// printf("disconnected\n");
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, eap_eapol_recvd_hdl);
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_DISCONNECT, eap_disconnected_hdl);
|
||||||
|
eap_peer_unregister_methods();
|
||||||
|
eap_sm_deinit();
|
||||||
|
//reset_config();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
void eap_config(void){
|
||||||
|
eap_target_ssid = "Test_eap";
|
||||||
|
eap_identity = "guest2";
|
||||||
|
eap_password = "test2";
|
||||||
|
|
||||||
|
eap_client_cert = \
|
||||||
|
"-----BEGIN CERTIFICATE-----\r\n" \
|
||||||
|
"MIIC9zCCAd8CAQMwDQYJKoZIhvcNAQEEBQAwgZMxCzAJBgNVBAYTAkZSMQ8wDQYD\r\n" \
|
||||||
|
"VQQIEwZSYWRpdXMxEjAQBgNVBAcTCVNvbWV3aGVyZTEVMBMGA1UEChMMRXhhbXBs\r\n" \
|
||||||
|
"ZSBJbmMuMSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLmNvbTEmMCQGA1UE\r\n" \
|
||||||
|
"AxMdRXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzE1MDgwNzEx\r\n" \
|
||||||
|
"WhcNMTcwMzE1MDgwNzExWjBzMQswCQYDVQQGEwJGUjEPMA0GA1UECBMGUmFkaXVz\r\n" \
|
||||||
|
"MRUwEwYDVQQKEwxFeGFtcGxlIEluYy4xGjAYBgNVBAMUEXVzZXIyQGV4YW1wbGUu\r\n" \
|
||||||
|
"Y29tMSAwHgYJKoZIhvcNAQkBFhF1c2VyMkBleGFtcGxlLmNvbTCBnzANBgkqhkiG\r\n" \
|
||||||
|
"9w0BAQEFAAOBjQAwgYkCgYEAqESlV4OYfBcIgZ+Cs8mWpiBjhvKoa0/kIe7saqhC\r\n" \
|
||||||
|
"e5q4snox0jdkUpLcc4vOs3vQ7ZGnimqTltA9oF6XNUzTWW4vlJTKEfrCWK085l7c\r\n" \
|
||||||
|
"DHFvHavH3E6vuP71lI7jq4PLXbo2TvZK+uBul4ozjzVWihaZBtz8eLHq446h/D/p\r\n" \
|
||||||
|
"kzkCAwEAATANBgkqhkiG9w0BAQQFAAOCAQEAAfhVAIkNdeeUNJud720uUHVnIcxz\r\n" \
|
||||||
|
"GXWI+Svi1qchuTEnRNhLwXmnE+A0WWSHyfdR6FvzdT3xtz3K50iOif8jY2gCGkSK\r\n" \
|
||||||
|
"8RjKr97228SwbrGO9y9+dYIjH1uz9cBpoVKcpzdsWpKObrDPDYyReHSWo99jM2+O\r\n" \
|
||||||
|
"vfJxnBw4PLiBj7Q0/dpd6o4JXyp7Cxa0mB4/+cZqjCzzuKfuK3WP7j6laMCV6mg4\r\n" \
|
||||||
|
"wRZ528IdwDqB7OOqsDm1PVQM8vzny9PM6ikWUCRTVNQJN8RDLkrHR3FRjy15YLdt\r\n" \
|
||||||
|
"yOfDqVnT/z0wGBaxnNziSJjqPGHPpRi4bJFGXwXOhtknKmciKzfj9/npoQ==\r\n" \
|
||||||
|
"-----END CERTIFICATE-----\r\n";
|
||||||
|
|
||||||
|
eap_client_key = \
|
||||||
|
"-----BEGIN RSA PRIVATE KEY-----\r\n" \
|
||||||
|
"MIICXQIBAAKBgQCoRKVXg5h8FwiBn4KzyZamIGOG8qhrT+Qh7uxqqEJ7mriyejHS\r\n" \
|
||||||
|
"N2RSktxzi86ze9DtkaeKapOW0D2gXpc1TNNZbi+UlMoR+sJYrTzmXtwMcW8dq8fc\r\n" \
|
||||||
|
"Tq+4/vWUjuOrg8tdujZO9kr64G6XijOPNVaKFpkG3Px4serjjqH8P+mTOQIDAQAB\r\n" \
|
||||||
|
"AoGARI+LyweshssfxSkIKVc3EcNaqi6PHwJzUrw2ChM624AkR1xwllXJg7ehKVdK\r\n" \
|
||||||
|
"xmjprRLO8CASuL1qjsBb3fTKnBl+sIVxIFS0AI4Y3ri8VUKbangvSsI7pCzAFry7\r\n" \
|
||||||
|
"p1gmy9WWRV2ZEa+dV8xcrjb3bloT7hcdeLehgBCvExJIQM0CQQDXlSAKdW3AhYyj\r\n" \
|
||||||
|
"1A+pfyBSGxJbpSwNyyWgwHIHHjxendxmdUbrc8EbAu1eNKbP58TLgdCZsKcMonAv\r\n" \
|
||||||
|
"MY1Y2/nnAkEAx9CrUaCU8pJqXTRypM5JtexLKnYMJhpnA9uUILBQOq4Oe0eruyF5\r\n" \
|
||||||
|
"SaSxhyJYXY491ahWYPF0PTb3jkUhoN+l3wJBAJZthjgGDJlEFwjSFkOtYz4nib3N\r\n" \
|
||||||
|
"GVpeoFj1MBvrazCScpJDz0LIOLzCZCNSFfwIu3dNk+NKMqZMSn+D0h9pD40CQQC5\r\n" \
|
||||||
|
"K9n4NXaTLbjAU2CC9mE85JPr76XmkcUxwAWQHZTcLH1jJdIyAx1hb+zNLLjzSmRn\r\n" \
|
||||||
|
"Yi9ae6ibKhtUjyBQ87HFAkA2Bb3z7NUx+AA2g2HZocFZFShBxylACyQkl8FAFZtf\r\n" \
|
||||||
|
"osudmKdFQHyAWuBMex4tpz/OLTqJ1ecL1JQeC7OvlpEX\r\n" \
|
||||||
|
"-----END RSA PRIVATE KEY-----\r\n";
|
||||||
|
|
||||||
|
eap_ca_cert = \
|
||||||
|
"-----BEGIN CERTIFICATE-----\r\n" \
|
||||||
|
"MIIEpzCCA4+gAwIBAgIJAPvZaozpdfjkMA0GCSqGSIb3DQEBCwUAMIGTMQswCQYD\r\n" \
|
||||||
|
"VQQGEwJGUjEPMA0GA1UECBMGUmFkaXVzMRIwEAYDVQQHEwlTb21ld2hlcmUxFTAT\r\n" \
|
||||||
|
"BgNVBAoTDEV4YW1wbGUgSW5jLjEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBs\r\n" \
|
||||||
|
"ZS5jb20xJjAkBgNVBAMTHUV4YW1wbGUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4X\r\n" \
|
||||||
|
"DTE2MDMxNDExMjU0OVoXDTE2MDQxMzExMjU0OVowgZMxCzAJBgNVBAYTAkZSMQ8w\r\n" \
|
||||||
|
"DQYDVQQIEwZSYWRpdXMxEjAQBgNVBAcTCVNvbWV3aGVyZTEVMBMGA1UEChMMRXhh\r\n" \
|
||||||
|
"bXBsZSBJbmMuMSAwHgYJKoZIhvcNAQkBFhFhZG1pbkBleGFtcGxlLmNvbTEmMCQG\r\n" \
|
||||||
|
"A1UEAxMdRXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqGSIb3\r\n" \
|
||||||
|
"DQEBAQUAA4IBDwAwggEKAoIBAQC9pireu0aCDLNfMaGv3vId7RXjUhQwSK0jV2Oc\r\n" \
|
||||||
|
"SyvlKWH3P/N+5kLrP2iL6SCzyETVDXZ0vOsAMjcBF0zHp16prXV0d51cTUqeWBb0\r\n" \
|
||||||
|
"I5UnGxleIuuOfSg8zLUJoBWZPqLv++eZ5WgOKHt7SXocjvg7TU5t/TMB0Y8OCz3H\r\n" \
|
||||||
|
"CW2vJ/XKMgMA9HDUu4g57cJu88i1JPRpyFaz/HIQBc7+UNb9z+q09uTZKWTmEMqi\r\n" \
|
||||||
|
"E2U0EEIs7EtbxnOze1/8C4XNlmztrEdwvu6UEBU/TFkUoh9M646NkkBK7wP9n9pv\r\n" \
|
||||||
|
"T0nPQRJiiCrICzVqUtlEi9lIKpbBSMbQ0KzrGF7lGTgm4rz9AgMBAAGjgfswgfgw\r\n" \
|
||||||
|
"HQYDVR0OBBYEFIVyecka74kvOKIW0BjlTc/B+a2NMIHIBgNVHSMEgcAwgb2AFIVy\r\n" \
|
||||||
|
"ecka74kvOKIW0BjlTc/B+a2NoYGZpIGWMIGTMQswCQYDVQQGEwJGUjEPMA0GA1UE\r\n" \
|
||||||
|
"CBMGUmFkaXVzMRIwEAYDVQQHEwlTb21ld2hlcmUxFTATBgNVBAoTDEV4YW1wbGUg\r\n" \
|
||||||
|
"SW5jLjEgMB4GCSqGSIb3DQEJARYRYWRtaW5AZXhhbXBsZS5jb20xJjAkBgNVBAMT\r\n" \
|
||||||
|
"HUV4YW1wbGUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5ggkA+9lqjOl1+OQwDAYDVR0T\r\n" \
|
||||||
|
"BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAZYHM26sxbKOckVqJJ1QY0U2QFlGP\r\n" \
|
||||||
|
"1GYd8v27znxdnRmSonDvv3GjFfhwoyDk0JUuxkK/33ikCxihrgoO/EQTY9BV2OpW\r\n" \
|
||||||
|
"qkB1PDtb3i5ZRNvfjmW0pVA4p+GmdTGaEE5pTlcVnorzVrUeFKaZakb+IDFYzmeF\r\n" \
|
||||||
|
"xp8B3Bb5wvinDligLOaJnSlgS8QeeIab9HZfaVTTuPmVK6zE6D54Y0dJPnykvDdE\r\n" \
|
||||||
|
"cGN0FC+migfilFjJgkDJ0r78nwes55L8zjoofiZuO03rrHww6ARc3v1jYzAufddk\r\n" \
|
||||||
|
"QTiZHgjlMQb2XXMmXLn8kBgoDnqkXFNe8j0h8uxIJSrjOoIyn1h1wvX5/w==\r\n" \
|
||||||
|
"-----END CERTIFICATE-----\r\n";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
int eap_start(char *method){
|
||||||
|
#ifdef CONFIG_ENABLE_EAP
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
//unsigned long tick1 = xTaskGetTickCount();
|
||||||
|
//unsigned long tick2;
|
||||||
|
|
||||||
|
if(rltk_wlan_running(WLAN1_IDX)){
|
||||||
|
printf("\n\rNot support con-current mode!\n\r");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
judge_station_disconnect();
|
||||||
|
|
||||||
|
#if CONFIG_ENABLE_PEAP
|
||||||
|
if(strcmp(method,"peap") == 0){
|
||||||
|
ret = set_eap_peap_method();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ENABLE_TLS
|
||||||
|
if(strcmp(method,"tls") == 0){
|
||||||
|
ret = set_eap_tls_method();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ENABLE_TTLS
|
||||||
|
if(strcmp(method,"ttls") == 0){
|
||||||
|
ret = set_eap_ttls_method();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if(ret == -1){
|
||||||
|
printf("\r\neap method %s not supported\r\n", method);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
eap_method = get_eap_ctx_method();
|
||||||
|
|
||||||
|
printf("\n==================== %s_start ====================\n", method);
|
||||||
|
|
||||||
|
//eap_config();
|
||||||
|
|
||||||
|
set_eap_phase(ENABLE);
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_EAPOL_START, eap_eapol_start_hdl, NULL);
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_EAPOL_RECVD, eap_eapol_recvd_hdl, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ret = connect_by_open_system(eap_target_ssid);
|
||||||
|
|
||||||
|
#if CONFIG_LWIP_LAYER
|
||||||
|
/* Start DHCPClient */
|
||||||
|
if(ret == 0)
|
||||||
|
LwIP_DHCP(0, DHCP_START);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_START, eap_eapol_start_hdl);
|
||||||
|
|
||||||
|
// for re-authentication when session timeout
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_DISCONNECT, eap_disconnected_hdl, NULL);
|
||||||
|
//wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, eap_eapol_recvd_hdl);
|
||||||
|
|
||||||
|
set_eap_phase(DISABLE);
|
||||||
|
|
||||||
|
// eap failed, disconnect
|
||||||
|
if(ret != 0){
|
||||||
|
judge_station_disconnect();
|
||||||
|
eap_disconnected_hdl(NULL, 0, 0, NULL);
|
||||||
|
rtw_msleep_os(200); //wait handler done
|
||||||
|
printf("\r\nERROR: connect to AP by %s failed\n", method);
|
||||||
|
}
|
||||||
|
|
||||||
|
eap_sm_deinit();
|
||||||
|
printf("\n==================== %s_finish ====================\n", method);
|
||||||
|
|
||||||
|
//tick2 = xTaskGetTickCount();
|
||||||
|
//printf("\r\nConnected after %dms.\n", (tick2-tick1));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef CONFIG_ENABLE_EAP
|
||||||
|
static int connect_by_open_system(char *target_ssid)
|
||||||
|
{
|
||||||
|
int retry_count = 0, ret;
|
||||||
|
|
||||||
|
if (target_ssid != NULL) {
|
||||||
|
while (1) {
|
||||||
|
rtw_msleep_os(500); //wait scan complete.
|
||||||
|
ret = wifi_connect(target_ssid,
|
||||||
|
RTW_SECURITY_OPEN,
|
||||||
|
NULL,
|
||||||
|
strlen(target_ssid),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
if (ret == RTW_SUCCESS) {
|
||||||
|
//printf("\r\n[EAP]Associate with AP success\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (retry_count == 0) {
|
||||||
|
//printf("\r\n[EAP]Associate with AP failed %d\n", ret);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
retry_count --;
|
||||||
|
printf("Retry connection...\n");
|
||||||
|
|
||||||
|
judge_station_disconnect();
|
||||||
|
set_eap_phase(ENABLE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("\r\n[EAP]Target SSID is NULL\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void eap_autoreconnect_thread(void *method)
|
||||||
|
{
|
||||||
|
eap_start((char*)method);
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void eap_autoreconnect_hdl(u8 method_id){
|
||||||
|
#ifdef CONFIG_ENABLE_EAP
|
||||||
|
char *method;
|
||||||
|
switch(method_id){
|
||||||
|
case 25: // EAP_TYPE_PEAP
|
||||||
|
method = "peap";
|
||||||
|
break;
|
||||||
|
case 13: // EAP_TYPE_TLS
|
||||||
|
method = "tls";
|
||||||
|
break;
|
||||||
|
case 21: // EAP_TYPE_TTLS
|
||||||
|
method = "ttls";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("invalid eap method\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(xTaskCreate(eap_autoreconnect_thread, ((const char*)"eap_autoreconnect_thread"), 1024, (void*) method, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
|
||||||
|
printf("\n\r%s xTaskCreate failed\n", __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy from ssl_client_ext.c
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_CLIENT
|
||||||
|
static x509_crt* _cli_crt = NULL;
|
||||||
|
static pk_context* _clikey_rsa = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_SERVER
|
||||||
|
static x509_crt* _ca_crt = NULL;
|
||||||
|
|
||||||
|
static int eap_verify(void *data, x509_crt *crt, int depth, int *flags)
|
||||||
|
{
|
||||||
|
|
||||||
|
//char buf[1024];
|
||||||
|
((void) data);
|
||||||
|
|
||||||
|
printf("\nVerify requested for (Depth %d):\n", depth);
|
||||||
|
//x509_crt_info(buf, sizeof(buf) - 1, "", crt);
|
||||||
|
//printf("%s", buf);
|
||||||
|
|
||||||
|
if(((*flags) & BADCERT_EXPIRED) != 0)
|
||||||
|
printf("server certificate has expired\n");
|
||||||
|
|
||||||
|
if(((*flags) & BADCERT_REVOKED) != 0)
|
||||||
|
printf(" ! server certificate has been revoked\n");
|
||||||
|
|
||||||
|
if(((*flags) & BADCERT_CN_MISMATCH) != 0)
|
||||||
|
printf(" ! CN mismatch\n");
|
||||||
|
|
||||||
|
if(((*flags) & BADCERT_NOT_TRUSTED) != 0)
|
||||||
|
printf(" ! self-signed or not signed by a trusted CA\n");
|
||||||
|
|
||||||
|
if(((*flags) & BADCRL_NOT_TRUSTED) != 0)
|
||||||
|
printf(" ! CRL not trusted\n");
|
||||||
|
|
||||||
|
if(((*flags) & BADCRL_EXPIRED) != 0)
|
||||||
|
printf(" ! CRL expired\n");
|
||||||
|
|
||||||
|
if(((*flags) & BADCERT_OTHER) != 0)
|
||||||
|
printf(" ! other (unknown) flag\n");
|
||||||
|
|
||||||
|
if((*flags) == 0)
|
||||||
|
printf(" Certificate verified without error flags\n");
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int eap_cert_init(void)
|
||||||
|
{
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_CLIENT
|
||||||
|
if(eap_client_cert != NULL && eap_client_key != NULL){
|
||||||
|
_cli_crt = polarssl_malloc(sizeof(x509_crt));
|
||||||
|
|
||||||
|
if(_cli_crt)
|
||||||
|
x509_crt_init(_cli_crt);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
_clikey_rsa = polarssl_malloc(sizeof(pk_context));
|
||||||
|
|
||||||
|
if(_clikey_rsa)
|
||||||
|
pk_init(_clikey_rsa);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_SERVER
|
||||||
|
if(eap_ca_cert != NULL){
|
||||||
|
_ca_crt = polarssl_malloc(sizeof(x509_crt));
|
||||||
|
|
||||||
|
if(_ca_crt)
|
||||||
|
x509_crt_init(_ca_crt);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void eap_client_cert_free(void)
|
||||||
|
{
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_CLIENT
|
||||||
|
if(eap_client_cert != NULL && eap_client_key != NULL){
|
||||||
|
if(_cli_crt) {
|
||||||
|
x509_crt_free(_cli_crt);
|
||||||
|
polarssl_free(_cli_crt);
|
||||||
|
_cli_crt = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_clikey_rsa) {
|
||||||
|
pk_free(_clikey_rsa);
|
||||||
|
polarssl_free(_clikey_rsa);
|
||||||
|
_clikey_rsa = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void eap_server_cert_free(void)
|
||||||
|
{
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_SERVER
|
||||||
|
if(eap_ca_cert != NULL){
|
||||||
|
if(_ca_crt) {
|
||||||
|
x509_crt_free(_ca_crt);
|
||||||
|
polarssl_free(_ca_crt);
|
||||||
|
_ca_crt = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int eap_cert_setup(ssl_context *ssl)
|
||||||
|
{
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_CLIENT
|
||||||
|
if(eap_client_cert != NULL && eap_client_key != NULL){
|
||||||
|
if(x509_crt_parse(_cli_crt, eap_client_cert, strlen(eap_client_cert)) != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if(pk_parse_key(_clikey_rsa, eap_client_key, strlen(eap_client_key), eap_client_key_pwd, strlen(eap_client_key_pwd)) != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
ssl_set_own_cert(ssl, _cli_crt, _clikey_rsa);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if ENABLE_EAP_SSL_VERIFY_SERVER
|
||||||
|
if(eap_ca_cert != NULL){
|
||||||
|
if(x509_crt_parse(_ca_crt, eap_ca_cert, strlen(eap_ca_cert)) != 0)
|
||||||
|
return -1;
|
||||||
|
ssl_set_ca_chain(ssl, _ca_crt, NULL, NULL);
|
||||||
|
ssl_set_authmode(ssl, SSL_VERIFY_REQUIRED);
|
||||||
|
ssl_set_verify(ssl, eap_verify, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,269 @@
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
#include "utils/os.h"
|
||||||
|
#include <lwip/netif.h>
|
||||||
|
#include <wifi/wifi_conf.h>
|
||||||
|
#include "wps/wps_defs.h"
|
||||||
|
|
||||||
|
#if CONFIG_ENABLE_P2P
|
||||||
|
enum p2p_wps_method {
|
||||||
|
WPS_NOT_READY, WPS_PIN_DISPLAY, WPS_PIN_KEYPAD, WPS_PBC
|
||||||
|
};
|
||||||
|
|
||||||
|
/*NETMASK*/
|
||||||
|
#define P2P_NETMASK_ADDR0 255
|
||||||
|
#define P2P_NETMASK_ADDR1 255
|
||||||
|
#define P2P_NETMASK_ADDR2 255
|
||||||
|
#define P2P_NETMASK_ADDR3 0
|
||||||
|
|
||||||
|
/*Gateway Address*/
|
||||||
|
#define P2P_GW_ADDR0 192
|
||||||
|
#define P2P_GW_ADDR1 168
|
||||||
|
#define P2P_GW_ADDR2 42
|
||||||
|
#define P2P_GW_ADDR3 1
|
||||||
|
|
||||||
|
#define P2P_GO_NEGO_RESULT_SIZE 376//256
|
||||||
|
|
||||||
|
xqueue_handle_t queue_for_p2p_nego;
|
||||||
|
|
||||||
|
extern void dhcps_init(struct netif * pnetif);
|
||||||
|
|
||||||
|
static int hex2num(char c)
|
||||||
|
{
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
return c - '0';
|
||||||
|
if (c >= 'a' && c <= 'f')
|
||||||
|
return c - 'a' + 10;
|
||||||
|
if (c >= 'A' && c <= 'F')
|
||||||
|
return c - 'A' + 10;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hwaddr_aton - Convert ASCII string to MAC address (colon-delimited format)
|
||||||
|
* @txt: MAC address as a string (e.g., "00:11:22:33:44:55")
|
||||||
|
* @addr: Buffer for the MAC address (ETH_ALEN = 6 bytes)
|
||||||
|
* Returns: 0 on success, -1 on failure (e.g., string not a MAC address)
|
||||||
|
*/
|
||||||
|
int hwaddr_aton(const char *txt, u8 *addr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 6; i++) {
|
||||||
|
int a, b;
|
||||||
|
|
||||||
|
a = hex2num(*txt++);
|
||||||
|
if (a < 0)
|
||||||
|
return -1;
|
||||||
|
b = hex2num(*txt++);
|
||||||
|
if (b < 0)
|
||||||
|
return -1;
|
||||||
|
*addr++ = (a << 4) | b;
|
||||||
|
if (i < 5 && *txt++ != ':')
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wifi_start_p2p_go(char *ssid, char *passphrase, u8 channel)
|
||||||
|
{
|
||||||
|
extern struct netif xnetif[NET_IF_NUM];
|
||||||
|
struct netif * pnetif = &xnetif[0];
|
||||||
|
struct ip_addr ipaddr;
|
||||||
|
struct ip_addr netmask;
|
||||||
|
struct ip_addr gw;
|
||||||
|
|
||||||
|
IP4_ADDR(&ipaddr, P2P_GW_ADDR0, P2P_GW_ADDR1, P2P_GW_ADDR2, P2P_GW_ADDR3);
|
||||||
|
IP4_ADDR(&netmask, P2P_NETMASK_ADDR0, P2P_NETMASK_ADDR1 , P2P_NETMASK_ADDR2, P2P_NETMASK_ADDR3);
|
||||||
|
IP4_ADDR(&gw, P2P_GW_ADDR0, P2P_GW_ADDR1, P2P_GW_ADDR2, P2P_GW_ADDR3);
|
||||||
|
netif_set_addr(pnetif, &ipaddr, &netmask,&gw);
|
||||||
|
|
||||||
|
// start ap
|
||||||
|
if(wifi_start_ap(ssid,
|
||||||
|
RTW_SECURITY_WPA2_AES_PSK,
|
||||||
|
passphrase,
|
||||||
|
strlen(ssid),
|
||||||
|
strlen(passphrase),
|
||||||
|
channel
|
||||||
|
) != RTW_SUCCESS) {
|
||||||
|
printf("ERROR: Operation failed!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
netif_set_default(pnetif);
|
||||||
|
|
||||||
|
// start dhcp server
|
||||||
|
dhcps_init(pnetif);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void app_callback(char *msg)
|
||||||
|
{
|
||||||
|
//From Application
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_wifi_p2p_start(int argc, char **argv)
|
||||||
|
{
|
||||||
|
extern struct netif xnetif[NET_IF_NUM];
|
||||||
|
int listen_ch = 1;
|
||||||
|
int op_ch = 5;
|
||||||
|
int go_intent = 1;
|
||||||
|
#if 1
|
||||||
|
u32 r = 0;
|
||||||
|
os_get_random((u8 *) &r, sizeof(r));
|
||||||
|
go_intent = r%15+1; /*1-15*/
|
||||||
|
|
||||||
|
os_get_random((u8 *) &r, sizeof(r));
|
||||||
|
listen_ch = 1 + (r % 3) * 5;
|
||||||
|
|
||||||
|
os_get_random((u8 *) &r, sizeof(r));
|
||||||
|
op_ch = 1 + (r % 3) * 5;
|
||||||
|
#endif
|
||||||
|
wifi_off();
|
||||||
|
os_sleep(0, 20000);
|
||||||
|
wifi_on(RTW_MODE_P2P);
|
||||||
|
wifi_p2p_init(xnetif[0].hwaddr, go_intent, listen_ch, op_ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cmd_wifi_p2p_auto_go_start(int argc, char **argv)
|
||||||
|
{
|
||||||
|
u8 *passphrase = "12345678";
|
||||||
|
u8 channel = 6; // 1, 6, 11
|
||||||
|
const char *ssid_in = "DIRECT-34-Ameba";
|
||||||
|
const char *dev_name = "Ameba1234"; // max strlen 32
|
||||||
|
const char *manufacturer = "by customer"; // max strlen 64
|
||||||
|
const char *model_name = "customer"; // max strlen 32
|
||||||
|
const char *model_number = "v2.0"; // max strlen 32
|
||||||
|
const char *serial_number = "9"; // max strlen 32
|
||||||
|
const u8 pri_dev_type[8] = {0x00,0x0A,0x00,0x50,0xF2,0x04,0x00,0x01}; // category ID:0x00,0x0A; sub category ID:0x00,0x01
|
||||||
|
u8 res[P2P_GO_NEGO_RESULT_SIZE];
|
||||||
|
u16 config_methods = WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD | WPS_CONFIG_PUSHBUTTON;
|
||||||
|
|
||||||
|
if(!is_wifi_p2p_initialized())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
wifi_p2p_set_dev_name(dev_name);
|
||||||
|
wifi_p2p_set_manufacturer(manufacturer);
|
||||||
|
wifi_p2p_set_model_name(model_name);
|
||||||
|
wifi_p2p_set_model_number(model_number);
|
||||||
|
wifi_p2p_set_serial_number(serial_number);
|
||||||
|
wifi_p2p_set_pri_dev_type(pri_dev_type);
|
||||||
|
wifi_p2p_set_ssid(ssid_in);
|
||||||
|
wifi_p2p_set_config_methods(config_methods);
|
||||||
|
wifi_p2p_init_auto_go_params(res, passphrase, channel);
|
||||||
|
wifi_p2p_start_auto_go(res);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void cmd_wifi_p2p_stop(int argc, char **argv)
|
||||||
|
{
|
||||||
|
wifi_p2p_deinit();
|
||||||
|
wifi_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_p2p_listen(int argc, char **argv)
|
||||||
|
{
|
||||||
|
u32 timeout = 0;
|
||||||
|
|
||||||
|
if(argc == 2){
|
||||||
|
timeout = os_atoi((u8*)argv[1]);
|
||||||
|
printf("\r\n%s(): timeout=%d\n", __func__, timeout);
|
||||||
|
if(timeout > 3600)
|
||||||
|
timeout = 3600;
|
||||||
|
}
|
||||||
|
wifi_cmd_p2p_listen(timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_p2p_find(int argc, char **argv)
|
||||||
|
{
|
||||||
|
wifi_cmd_p2p_find();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_p2p_peers(int argc, char **argv)
|
||||||
|
{
|
||||||
|
wifi_cmd_p2p_peers();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_p2p_info(int argc, char **argv)
|
||||||
|
{
|
||||||
|
wifi_cmd_p2p_info();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_p2p_disconnect(int argc, char **argv)
|
||||||
|
{
|
||||||
|
wifi_cmd_p2p_disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_p2p_connect(int argc, char **argv)
|
||||||
|
{
|
||||||
|
enum p2p_wps_method config_method = WPS_PBC;
|
||||||
|
char *pin = NULL;
|
||||||
|
u8 dest[ETH_ALEN] = {0x44, 0x6d, 0x57, 0xd7, 0xce, 0x41};
|
||||||
|
u8 res[P2P_GO_NEGO_RESULT_SIZE];
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if((argc != 2) && (argc != 3) && (argc != 4)) {
|
||||||
|
printf("Usage: p2p_connect DEST_ADDR [pbc|pin] [pin code]\n");
|
||||||
|
printf("Example: p2p_connect 00:e0:4c:87:00:15 pin 12345678\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (hwaddr_aton(argv[1], dest)){
|
||||||
|
printf("P2P_CONNECT: dest address is not correct!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//printf("\r\nDEST: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n", dest[0], dest[1], dest[2], dest[3], dest[4], dest[5]);
|
||||||
|
config_method = WPS_PBC;
|
||||||
|
if(argc == 3) {
|
||||||
|
if(os_strncmp(argv[2], "pbc", 3) == 0)
|
||||||
|
config_method = WPS_PBC;
|
||||||
|
else if(os_strncmp(argv[2], "pin", 3) == 0){
|
||||||
|
config_method = WPS_PIN_DISPLAY;
|
||||||
|
}else{
|
||||||
|
printf("Unknown config method!\n");
|
||||||
|
printf("Usage: p2p_connect DEST_ADDR [pbc|pin] \n");
|
||||||
|
printf("Example: p2p_connect 00:e0:4c:87:00:15 pin\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(argc == 4) {
|
||||||
|
if(os_strncmp(argv[2], "pin", 3) == 0){
|
||||||
|
config_method = WPS_PIN_KEYPAD;
|
||||||
|
pin = argv[3];
|
||||||
|
}else{
|
||||||
|
printf("Unknown config method!\n");
|
||||||
|
printf("Usage: p2p_connect DEST_ADDR [pbc|pin] [pin code]\n");
|
||||||
|
printf("Example: p2p_connect 00:e0:4c:87:00:15 pin 12345678\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else //For test
|
||||||
|
u8 dest1[ETH_ALEN] = {0xea, 0x92, 0xa4, 0x9b, 0x61, 0xd6}; //NEXUS 4
|
||||||
|
//u8 dest1[ETH_ALEN] = {0x0e, 0x37, 0xdc, 0xfc, 0xc4, 0x12}; //HUAWEI U9508_c001
|
||||||
|
//u8 dest1[ETH_ALEN] = {0x42, 0xcb, 0xa8, 0xd3, 0x2c, 0x50}; //HUAWEI G610-T00
|
||||||
|
os_memcpy(dest, dest1, ETH_ALEN);
|
||||||
|
config_method = WPS_PBC;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (queue_for_p2p_nego!= NULL) {
|
||||||
|
os_xqueue_delete(queue_for_p2p_nego);
|
||||||
|
queue_for_p2p_nego = NULL;
|
||||||
|
}
|
||||||
|
queue_for_p2p_nego = os_xqueue_create(1, P2P_GO_NEGO_RESULT_SIZE);
|
||||||
|
if(queue_for_p2p_nego != NULL) {
|
||||||
|
ret = wifi_cmd_p2p_connect(dest, config_method, pin);
|
||||||
|
if(ret == 0)
|
||||||
|
os_xqueue_receive(queue_for_p2p_nego, res, 15);
|
||||||
|
|
||||||
|
os_xqueue_delete(queue_for_p2p_nego);
|
||||||
|
queue_for_p2p_nego = NULL;
|
||||||
|
|
||||||
|
if(ret == 0)
|
||||||
|
wifi_p2p_start_wps(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENABLE_P2P
|
|
@ -0,0 +1,753 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "queue.h"
|
||||||
|
#include "utils/os.h"
|
||||||
|
#include <lwip_netconf.h>
|
||||||
|
#include <lwip/netif.h>
|
||||||
|
#include "wifi/wifi_conf.h"
|
||||||
|
#include "wps/wps_defs.h"
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief struct wps_credential - WPS Credential
|
||||||
|
*/
|
||||||
|
struct dev_credential {
|
||||||
|
u8 ssid[32]; /**< SSID */
|
||||||
|
size_t ssid_len; /**< Length of SSID */
|
||||||
|
u16 auth_type; /**< Authentication Type (WPS_AUTH_OPEN, .. flags) */
|
||||||
|
u16 encr_type; /**< Encryption Type (WPS_ENCR_NONE, .. flags) */
|
||||||
|
u8 key_idx; /**< Key index */
|
||||||
|
u8 key[65]; /**< Key */
|
||||||
|
size_t key_len; /**< Key length in octets */
|
||||||
|
u8 mac_addr[6]; /**< MAC address of the Credential receiver */
|
||||||
|
const u8 *cred_attr; /**< Unparsed Credential attribute data (used only in cred_cb()).
|
||||||
|
This may be NULL, if not used. */
|
||||||
|
size_t cred_attr_len; /**< Length of cred_attr in octets */
|
||||||
|
u16 ap_channel; /**< AP channel */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *target_ssid;
|
||||||
|
u16 config_method;
|
||||||
|
_sema scan_sema;
|
||||||
|
int isoverlap;
|
||||||
|
} internal_wps_scan_handler_arg_t;
|
||||||
|
|
||||||
|
#define WLAN0_NAME "wlan0"
|
||||||
|
#ifndef ENABLE
|
||||||
|
#define ENABLE (1)
|
||||||
|
#endif
|
||||||
|
#ifndef DISABLE
|
||||||
|
#define DISABLE (0)
|
||||||
|
#endif
|
||||||
|
#define STACKSIZE 512
|
||||||
|
|
||||||
|
|
||||||
|
//static xSemaphoreHandle wps_reconnect_semaphore;
|
||||||
|
//static struct _WIFI_NETWORK wifi_get_from_certificate = {0};
|
||||||
|
|
||||||
|
#define WPS_AUTH_TYPE_OPEN (0x0001)
|
||||||
|
#define WPS_AUTH_TYPE_WPA_PERSONAL (0x0002)
|
||||||
|
#define WPS_AUTH_TYPE_SHARED (0x0004)
|
||||||
|
#define WPS_AUTH_TYPE_WPA_ENTERPRISE (0x0008)
|
||||||
|
#define WPS_AUTH_TYPE_WPA2_PERSONAL (0x0010)
|
||||||
|
#define WPS_AUTH_TYPE_WPA2_ENTERPRISE (0x0020)
|
||||||
|
|
||||||
|
#define WPS_ENCR_TYPE_NONE (0x0001)
|
||||||
|
#define WPS_ENCR_TYPE_WEP (0x0002)
|
||||||
|
#define WPS_ENCR_TYPE_TKIP (0x0004)
|
||||||
|
#define WPS_ENCR_TYPE_AES (0x0008)
|
||||||
|
|
||||||
|
#define SCAN_BUFFER_LENGTH (4096)
|
||||||
|
|
||||||
|
#if CONFIG_ENABLE_P2P
|
||||||
|
extern void _wifi_p2p_wps_success(const u8 *peer_addr, int registrar);
|
||||||
|
extern void _wifi_p2p_wps_failed();
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
extern u32 _wps_registrar_process_msg(void *priv, u32 op_code, const void *pmsg);
|
||||||
|
extern void * _wps_registrar_get_msg(void *priv, u32 *op_code);
|
||||||
|
extern void * _wps_registrar_init(void *priv, const void* pcfg);
|
||||||
|
extern void _wps_registrar_deinit(void *priv);
|
||||||
|
extern void *_wps_registrar_alloc();
|
||||||
|
extern int _wps_registrar_add_pin(void *priv, const u8 *addr,
|
||||||
|
const u8 *uuid, const u8 *pin, size_t pin_len,
|
||||||
|
int timeout);
|
||||||
|
extern int _wps_registrar_button_pushed(void *priv,
|
||||||
|
const u8 *p2p_dev_addr);
|
||||||
|
extern int _wps_registrar_wps_cancel(void *priv);
|
||||||
|
extern void _wpas_wsc_ap_send_eap_reqidentity(void *priv, u8 *rx_buf);
|
||||||
|
extern void _wpas_wsc_ap_check_eap_rspidentity(void *priv, u8 *rx_buf);
|
||||||
|
extern void _wpas_wsc_registrar_send_eap_fail(void *priv);
|
||||||
|
extern void _wpas_wsc_registrar_handle_recvd(void *priv, u8 *rx_buf);
|
||||||
|
extern void * _eap_wsc_server_process_hdl(void *priv, void* req, u8 id);
|
||||||
|
extern void *_eap_wsc_server_reset(void *priv);
|
||||||
|
#endif
|
||||||
|
extern void wpas_wsc_sta_wps_start_hdl(char *buf, int buf_len, int flags, void *userdata);
|
||||||
|
extern void wpas_wsc_wps_finish_hdl(char *buf, int buf_len, int flags, void *userdata);
|
||||||
|
extern void wpas_wsc_eapol_recvd_hdl(char *buf, int buf_len, int flags, void *userdata);
|
||||||
|
|
||||||
|
void wifi_p2p_wps_success(const u8 *peer_addr, int registrar)
|
||||||
|
{
|
||||||
|
#if CONFIG_ENABLE_P2P
|
||||||
|
_wifi_p2p_wps_success(peer_addr, registrar);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifi_p2p_wps_failed()
|
||||||
|
{
|
||||||
|
#if CONFIG_ENABLE_P2P
|
||||||
|
_wifi_p2p_wps_failed();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void * wps_registrar_init(void *priv, void *pcfg)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _wps_registrar_init(priv, pcfg);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wps_registrar_deinit(void *priv)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
_wps_registrar_deinit(priv);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void *wps_registrar_alloc()
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _wps_registrar_alloc();
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 wps_registrar_process_msg(void *priv, u32 op_code, const void *pmsg)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _wps_registrar_process_msg(priv, op_code, pmsg);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void * wps_registrar_get_msg(void *priv, u32 *op_code)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _wps_registrar_get_msg(priv, op_code);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int wps_registrar_add_pin(void *priv, const u8 *addr,
|
||||||
|
const u8 *uuid, const u8 *pin, size_t pin_len,
|
||||||
|
int timeout)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _wps_registrar_add_pin(priv, NULL,NULL,pin,pin_len,0);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int wps_registrar_button_pushed(void *priv,
|
||||||
|
const u8 *p2p_dev_addr)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _wps_registrar_button_pushed(priv, p2p_dev_addr);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int wps_registrar_wps_cancel(void *priv)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _wps_registrar_wps_cancel(priv);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void wpas_wsc_ap_send_eap_reqidentity(void *priv, u8 *rx_buf)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
_wpas_wsc_ap_send_eap_reqidentity(priv, rx_buf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wpas_wsc_ap_check_eap_rspidentity(void *priv, u8 *rx_buf)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
_wpas_wsc_ap_check_eap_rspidentity(priv, rx_buf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wpas_wsc_registrar_send_eap_fail(void *priv)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
_wpas_wsc_registrar_send_eap_fail(priv);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wpas_wsc_registrar_handle_recvd(void *priv, u8 *rx_buf)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
_wpas_wsc_registrar_handle_recvd(priv, rx_buf);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void * eap_wsc_server_process_hdl(void *priv, void* req, u8 id)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
return _eap_wsc_server_process_hdl(priv, req, id);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void eap_wsc_server_reset(void *priv)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
_eap_wsc_server_reset(priv);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CONFIG_ENABLE_WPS
|
||||||
|
xqueue_handle_t queue_for_credential;
|
||||||
|
char wps_pin_code[32];
|
||||||
|
u16 config_method;
|
||||||
|
u8 wps_password_id;
|
||||||
|
static TaskHandle_t ap_wps_task = NULL;
|
||||||
|
|
||||||
|
void wps_check_and_show_connection_info(void)
|
||||||
|
{
|
||||||
|
rtw_wifi_setting_t setting;
|
||||||
|
#if CONFIG_LWIP_LAYER
|
||||||
|
/* Start DHCP Client */
|
||||||
|
LwIP_DHCP(0, DHCP_START);
|
||||||
|
#endif
|
||||||
|
wifi_get_setting(WLAN0_NAME, &setting);
|
||||||
|
wifi_show_setting(WLAN0_NAME, &setting);
|
||||||
|
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
inic_c2h_wifi_info("ATWW", RTW_SUCCESS);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wps_config_wifi_setting(rtw_network_info_t *wifi, struct dev_credential *dev_cred)
|
||||||
|
{
|
||||||
|
printf("wps_config_wifi_setting\n");
|
||||||
|
//memcpy((void *)wifi->ssid, (void *)dev_cred->ssid, dev_cred->ssid_len);
|
||||||
|
strcpy((char*)wifi->ssid.val, (char*)&dev_cred->ssid[0]);
|
||||||
|
printf("wps_wifi.ssid = %s\n", wifi->ssid.val);
|
||||||
|
wifi->ssid.len = dev_cred->ssid_len;
|
||||||
|
printf("wps_wifi.ssid_len = %d\n", wifi->ssid.len);
|
||||||
|
|
||||||
|
switch(dev_cred->auth_type) {
|
||||||
|
case WPS_AUTH_TYPE_OPEN :
|
||||||
|
case WPS_AUTH_TYPE_SHARED :
|
||||||
|
if(dev_cred->encr_type == WPS_ENCR_TYPE_WEP) {
|
||||||
|
printf("security_type = RTW_SECURITY_WEP_PSK\n");
|
||||||
|
wifi->security_type = RTW_SECURITY_WEP_PSK;
|
||||||
|
wifi->key_id = dev_cred->key_idx - 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("security_type = RTW_SECURITY_OPEN\n");
|
||||||
|
wifi->security_type = RTW_SECURITY_OPEN;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WPS_AUTH_TYPE_WPA_PERSONAL :
|
||||||
|
case WPS_AUTH_TYPE_WPA_ENTERPRISE :
|
||||||
|
printf("security_type = RTW_SECURITY_WPA_AES_PSK\n");
|
||||||
|
wifi->security_type = RTW_SECURITY_WPA_AES_PSK;
|
||||||
|
break;
|
||||||
|
case WPS_AUTH_TYPE_WPA2_PERSONAL :
|
||||||
|
case WPS_AUTH_TYPE_WPA2_ENTERPRISE :
|
||||||
|
printf("security_type = RTW_SECURITY_WPA2_AES_PSK\n");
|
||||||
|
wifi->security_type = RTW_SECURITY_WPA2_AES_PSK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("wps_wifi.security_type = %d\n", wifi->security_type);
|
||||||
|
|
||||||
|
//memcpy(wifi->password, dev_cred->key, dev_cred->key_len);
|
||||||
|
wifi->password = dev_cred->key;
|
||||||
|
printf("wps_wifi.password = %s\n", wifi->password);
|
||||||
|
wifi->password_len = dev_cred->key_len;
|
||||||
|
printf("wps_wifi.password_len = %d", wifi->password_len);
|
||||||
|
//xSemaphoreGive(wps_reconnect_semaphore);
|
||||||
|
//printf("\r\nrelease wps_reconnect_semaphore");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wps_connect_to_AP_by_certificate(rtw_network_info_t *wifi)
|
||||||
|
{
|
||||||
|
#define RETRY_COUNT 3
|
||||||
|
int retry_count = RETRY_COUNT, ret;
|
||||||
|
|
||||||
|
printf("=============== wifi_certificate_info ===============\n");
|
||||||
|
printf("wps_wifi.ssid = %s\n", wifi->ssid.val);
|
||||||
|
printf("security_type = %d\n", wifi->security_type);
|
||||||
|
printf("wps_wifi.password = %s\n", wifi->password);
|
||||||
|
printf("ssid_len = %d\n", wifi->ssid.len);
|
||||||
|
printf("password_len = %d\n", wifi->password_len);
|
||||||
|
while (1) {
|
||||||
|
ret = wifi_connect((char*)wifi->ssid.val,
|
||||||
|
wifi->security_type,
|
||||||
|
(char*)wifi->password,
|
||||||
|
wifi->ssid.len,
|
||||||
|
wifi->password_len,
|
||||||
|
wifi->key_id,
|
||||||
|
NULL);
|
||||||
|
if (ret == RTW_SUCCESS) {
|
||||||
|
if(retry_count == RETRY_COUNT)
|
||||||
|
rtw_msleep_os(1000); //When start wps with OPEN AP, AP will send a disassociate frame after STA connected, need reconnect here.
|
||||||
|
if(RTW_SUCCESS == wifi_is_connected_to_ap( )){
|
||||||
|
//printf("\r\n[WPS]Ready to tranceive!!\n");
|
||||||
|
wps_check_and_show_connection_info();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (retry_count == 0) {
|
||||||
|
printf("[WPS]Join bss failed\n");
|
||||||
|
ret = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
retry_count --;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int wps_connect_to_AP_by_open_system(char *target_ssid)
|
||||||
|
{
|
||||||
|
int retry_count = 3, ret;
|
||||||
|
|
||||||
|
if (target_ssid != NULL) {
|
||||||
|
rtw_msleep_os(500); //wait scan complete.
|
||||||
|
while (1) {
|
||||||
|
ret = wifi_connect(target_ssid,
|
||||||
|
RTW_SECURITY_OPEN,
|
||||||
|
NULL,
|
||||||
|
strlen(target_ssid),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
if (ret == RTW_SUCCESS) {
|
||||||
|
//wps_check_and_show_connection_info();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (retry_count == 0) {
|
||||||
|
printf("[WPS]Join bss failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
retry_count --;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
} else {
|
||||||
|
printf("[WPS]Target SSID is NULL\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void process_wps_scan_result( rtw_scan_result_t* record, void * user_data )
|
||||||
|
{
|
||||||
|
internal_wps_scan_handler_arg_t *wps_arg = (internal_wps_scan_handler_arg_t *)user_data;
|
||||||
|
|
||||||
|
if (record->wps_type != 0xff) {
|
||||||
|
if (wps_arg->config_method == WPS_CONFIG_PUSHBUTTON) {
|
||||||
|
if (record->wps_type == 0x04) {
|
||||||
|
wps_password_id = record->wps_type;
|
||||||
|
if (++wps_arg->isoverlap == 0) {
|
||||||
|
memcpy(&wps_arg->target_ssid[0], record->SSID.val, record->SSID.len);
|
||||||
|
wps_arg->target_ssid[record->SSID.len] = '\0';
|
||||||
|
printf("[pbc]Record first triger wps AP = %s\n", wps_arg->target_ssid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (wps_arg->config_method == WPS_CONFIG_DISPLAY || wps_arg->config_method == WPS_CONFIG_KEYPAD) {
|
||||||
|
if (record->wps_type == 0x00) {
|
||||||
|
wps_arg->isoverlap = 0;
|
||||||
|
wps_password_id = record->wps_type;
|
||||||
|
memcpy(&wps_arg->target_ssid[0], record->SSID.val, record->SSID.len);
|
||||||
|
wps_arg->target_ssid[record->SSID.len] = '\0';
|
||||||
|
printf("[pin]find out first triger wps AP = %s\n", wps_arg->target_ssid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static rtw_result_t wps_scan_result_handler( rtw_scan_handler_result_t* malloced_scan_result )
|
||||||
|
{
|
||||||
|
internal_wps_scan_handler_arg_t *wps_arg = (internal_wps_scan_handler_arg_t *)malloced_scan_result->user_data;
|
||||||
|
if (malloced_scan_result->scan_complete != RTW_TRUE)
|
||||||
|
{
|
||||||
|
rtw_scan_result_t* record = &malloced_scan_result->ap_details;
|
||||||
|
record->SSID.val[record->SSID.len] = 0; /* Ensure the SSID is null terminated */
|
||||||
|
|
||||||
|
process_wps_scan_result(record, malloced_scan_result->user_data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("WPS scan done!\n");
|
||||||
|
rtw_up_sema(&wps_arg->scan_sema);
|
||||||
|
}
|
||||||
|
return RTW_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void wifi_scan_each_report_hdl( char* buf, int buf_len, int flags, void* userdata);
|
||||||
|
extern void wifi_scan_done_hdl( char* buf, int buf_len, int flags, void* userdata);
|
||||||
|
|
||||||
|
static int wps_find_out_triger_wps_AP(char *target_ssid, u16 config_method)
|
||||||
|
{
|
||||||
|
internal_wps_scan_handler_arg_t wps_arg = {0};
|
||||||
|
|
||||||
|
wps_password_id = 0xFF;
|
||||||
|
|
||||||
|
wps_arg.isoverlap = -1;
|
||||||
|
wps_arg.config_method = config_method;
|
||||||
|
wps_arg.target_ssid = target_ssid;
|
||||||
|
rtw_init_sema(&wps_arg.scan_sema, 0);
|
||||||
|
if(wps_arg.scan_sema == NULL) return RTW_ERROR;
|
||||||
|
|
||||||
|
if(wifi_scan_networks(wps_scan_result_handler, &wps_arg ) != RTW_SUCCESS){
|
||||||
|
printf("ERROR: wifi scan failed\n");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if(rtw_down_timeout_sema(&wps_arg.scan_sema, SCAN_LONGEST_WAIT_TIME) == RTW_FALSE){
|
||||||
|
printf("WPS scan done early!\n");
|
||||||
|
}
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_SCAN_RESULT_REPORT, wifi_scan_each_report_hdl);
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_SCAN_DONE, wifi_scan_done_hdl);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
rtw_free_sema(&wps_arg.scan_sema);
|
||||||
|
|
||||||
|
return wps_arg.isoverlap;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wps_start(u16 wps_config, char *pin, u8 channel, char *ssid)
|
||||||
|
{
|
||||||
|
struct dev_credential dev_cred;
|
||||||
|
rtw_network_info_t wifi = {0};
|
||||||
|
char target_ssid[64];
|
||||||
|
int is_overlap = -1;
|
||||||
|
u32 start_time = rtw_get_current_time();
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
memset(&dev_cred, 0, sizeof(struct dev_credential));
|
||||||
|
memset(target_ssid, 0, 64);
|
||||||
|
if((wps_config != WPS_CONFIG_PUSHBUTTON)
|
||||||
|
&& (wps_config != WPS_CONFIG_DISPLAY)
|
||||||
|
&& (wps_config != WPS_CONFIG_KEYPAD)){
|
||||||
|
printf("WPS: Wps method(%d) is wrong. Not triger WPS.\n", wps_config);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
config_method = wps_config;
|
||||||
|
|
||||||
|
if(wps_config == WPS_CONFIG_DISPLAY
|
||||||
|
|| wps_config == WPS_CONFIG_KEYPAD) {
|
||||||
|
if(pin)
|
||||||
|
strcpy(wps_pin_code, pin);
|
||||||
|
else{
|
||||||
|
printf("WPS: PIN is NULL. Not triger WPS.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!ssid) {
|
||||||
|
while (1) {
|
||||||
|
unsigned int current_time = rtw_get_current_time();
|
||||||
|
if (rtw_systime_to_sec(current_time - start_time) < 120) {
|
||||||
|
is_overlap = wps_find_out_triger_wps_AP(&target_ssid[0], wps_config);
|
||||||
|
if ((is_overlap == 0) || (is_overlap > 0))
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
printf("WPS: WPS Walking Time Out\n");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_overlap > 0) {
|
||||||
|
printf("WPS: WPS session overlap. Not triger WPS.\n");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
rtw_memcpy(target_ssid, ssid, strlen(ssid));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (queue_for_credential != NULL) {
|
||||||
|
os_xqueue_delete(queue_for_credential);
|
||||||
|
queue_for_credential = NULL;
|
||||||
|
}
|
||||||
|
queue_for_credential = os_xqueue_create(1, sizeof(struct dev_credential));
|
||||||
|
if(!queue_for_credential)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_STA_WPS_START, wpas_wsc_sta_wps_start_hdl, NULL);
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_WPS_FINISH, wpas_wsc_wps_finish_hdl, NULL);
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_EAPOL_RECVD, wpas_wsc_eapol_recvd_hdl, NULL);
|
||||||
|
|
||||||
|
wifi_set_wps_phase(ENABLE);
|
||||||
|
ret = wps_connect_to_AP_by_open_system(target_ssid);
|
||||||
|
if(ret < 0){
|
||||||
|
printf("WPS: WPS Fail!!\n");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
os_xqueue_receive(queue_for_credential, &dev_cred, 120);
|
||||||
|
if (dev_cred.ssid[0] != 0 && dev_cred.ssid_len <= 32) {
|
||||||
|
wps_config_wifi_setting(&wifi, &dev_cred);
|
||||||
|
wifi_set_wps_phase(DISABLE);
|
||||||
|
ret = wps_connect_to_AP_by_certificate(&wifi);
|
||||||
|
goto exit1;
|
||||||
|
} else {
|
||||||
|
printf("WPS: WPS FAIL!!!\n");
|
||||||
|
// printf("\n\rWPS: WPS FAIL!!!\n");
|
||||||
|
// printf("\n\rWPS: WPS FAIL!!!\n");
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
exit:
|
||||||
|
wifi_set_wps_phase(DISABLE);
|
||||||
|
exit1:
|
||||||
|
if (queue_for_credential != NULL) {
|
||||||
|
os_xqueue_delete(queue_for_credential);
|
||||||
|
queue_for_credential = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_STA_WPS_START, wpas_wsc_sta_wps_start_hdl);
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_WPS_FINISH, wpas_wsc_wps_finish_hdl);
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, wpas_wsc_eapol_recvd_hdl);
|
||||||
|
|
||||||
|
wpas_wps_deinit();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
static int ap_wps_start(u16 wps_config, char *pin)
|
||||||
|
{
|
||||||
|
u8 authorized_mac[ETH_ALEN];
|
||||||
|
int ret = 0;
|
||||||
|
u32 pin_val = 0;
|
||||||
|
|
||||||
|
if (queue_for_credential != NULL) {
|
||||||
|
os_xqueue_delete(queue_for_credential);
|
||||||
|
queue_for_credential = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
queue_for_credential = os_xqueue_create(1, sizeof(authorized_mac));
|
||||||
|
if(!queue_for_credential)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_STA_WPS_START, wpas_wsc_sta_wps_start_hdl, NULL);
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_WPS_FINISH, wpas_wsc_wps_finish_hdl, NULL);
|
||||||
|
wifi_reg_event_handler(WIFI_EVENT_EAPOL_RECVD, wpas_wsc_eapol_recvd_hdl, NULL);
|
||||||
|
|
||||||
|
wifi_set_wps_phase(ENABLE);
|
||||||
|
|
||||||
|
if(wps_config == WPS_CONFIG_KEYPAD)
|
||||||
|
{
|
||||||
|
pin_val = atoi(pin);
|
||||||
|
if (!wps_pin_valid(pin_val)) {
|
||||||
|
printf("WPS-AP: Enter pin code is unvalid.\n");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
ret = wpas_wps_registrar_add_pin((unsigned char const*)pin, strlen(pin));
|
||||||
|
}
|
||||||
|
else if(wps_config == WPS_CONFIG_DISPLAY)
|
||||||
|
ret = wpas_wps_registrar_add_pin((unsigned char const*)pin, strlen(pin));
|
||||||
|
else
|
||||||
|
ret = wpas_wps_registrar_button_pushed();
|
||||||
|
|
||||||
|
if(ret<0)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
printf("WPS-AP: wait for STA connect!\n");
|
||||||
|
os_xqueue_receive(queue_for_credential, authorized_mac, 120); //max wait 2min
|
||||||
|
|
||||||
|
if(!wpas_wps_registrar_check_done())
|
||||||
|
{
|
||||||
|
ret = -1;
|
||||||
|
wpas_wps_registrar_wps_cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
wifi_set_wps_phase(0);
|
||||||
|
os_xqueue_delete(queue_for_credential);
|
||||||
|
queue_for_credential = NULL;
|
||||||
|
printf("WPS-AP: Finished!\n");
|
||||||
|
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_STA_WPS_START, wpas_wsc_sta_wps_start_hdl);
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_WPS_FINISH, wpas_wsc_wps_finish_hdl);
|
||||||
|
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, wpas_wsc_eapol_recvd_hdl);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wifi_start_ap_wps_thread_hdl( void *param)
|
||||||
|
{
|
||||||
|
ap_wps_start(config_method, wps_pin_code); //Not support WPS_CONFIG_KEYPAD
|
||||||
|
|
||||||
|
ap_wps_task = NULL;
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifi_start_ap_wps_thread(u16 config_methods, char *pin)
|
||||||
|
{
|
||||||
|
if((config_methods != WPS_CONFIG_PUSHBUTTON)
|
||||||
|
&& (config_methods != WPS_CONFIG_DISPLAY)
|
||||||
|
&& (config_methods != WPS_CONFIG_KEYPAD)){
|
||||||
|
printf("WPS-AP: Wps method(%d) is wrong. Not triger WPS.\n", config_methods);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
config_method = config_methods;
|
||||||
|
if(config_methods == WPS_CONFIG_DISPLAY
|
||||||
|
|| config_methods == WPS_CONFIG_KEYPAD) {
|
||||||
|
if(pin)
|
||||||
|
strcpy(wps_pin_code, pin);
|
||||||
|
else{
|
||||||
|
printf("WPS-AP: PIN is NULL. Not triger WPS.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ap_wps_task != NULL){ //push item to wait queue to finish last ap_wps task
|
||||||
|
printf("WPS-AP: Wait for last ap_wps task exiting...\n");
|
||||||
|
if(queue_for_credential)
|
||||||
|
os_xqueue_send(queue_for_credential, NULL, 0);
|
||||||
|
while(ap_wps_task != NULL)
|
||||||
|
vTaskDelay(1);
|
||||||
|
vTaskDelay(20);
|
||||||
|
printf("Last ap_wps task completed.\n");
|
||||||
|
}
|
||||||
|
if(xTaskCreate(wifi_start_ap_wps_thread_hdl, ((const char*)"ap_wps"), 256, NULL, tskIDLE_PRIORITY + 3, &ap_wps_task) != pdPASS)
|
||||||
|
printf("%s xTaskCreate(ap_wps thread) failed\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_ENABLE_WPS_AP
|
||||||
|
|
||||||
|
void wps_judge_staion_disconnect(void)
|
||||||
|
{
|
||||||
|
int mode = 0;
|
||||||
|
unsigned char ssid[33];
|
||||||
|
|
||||||
|
wext_get_mode(WLAN0_NAME, &mode);
|
||||||
|
|
||||||
|
switch(mode) {
|
||||||
|
case IW_MODE_MASTER: //In AP mode
|
||||||
|
// rltk_wlan_deinit();
|
||||||
|
// rltk_wlan_init(0,RTW_MODE_STA);
|
||||||
|
// rltk_wlan_start(0);
|
||||||
|
//modified by Chris Yang for iNIC
|
||||||
|
wifi_off();
|
||||||
|
vTaskDelay(20);
|
||||||
|
wifi_on(RTW_MODE_STA);
|
||||||
|
break;
|
||||||
|
case IW_MODE_INFRA: //In STA mode
|
||||||
|
if(wext_get_ssid(WLAN0_NAME, ssid) > 0)
|
||||||
|
wifi_disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_wps(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
wps_judge_staion_disconnect();
|
||||||
|
|
||||||
|
if((argc == 2 || argc == 3 ) && (argv[1] != NULL)){
|
||||||
|
if(strcmp(argv[1],"pin") == 0){
|
||||||
|
unsigned int pin_val = 0;
|
||||||
|
/* start pin */
|
||||||
|
if(argc == 2){
|
||||||
|
char device_pin[10];
|
||||||
|
pin_val = wps_generate_pin();
|
||||||
|
sprintf(device_pin, "%08d", pin_val);
|
||||||
|
/* Display PIN 3 times to prevent to be overwritten by logs from other tasks */
|
||||||
|
printf("WPS: Start WPS PIN Display. PIN: [%s]\n", device_pin);
|
||||||
|
printf("WPS: Start WPS PIN Display. PIN: [%s]\n", device_pin);
|
||||||
|
printf("WPS: Start WPS PIN Display. PIN: [%s]\n", device_pin);
|
||||||
|
ret = wps_start(WPS_CONFIG_DISPLAY, (char*)device_pin, 0, NULL);
|
||||||
|
}else{
|
||||||
|
pin_val = atoi(argv[2]);
|
||||||
|
if (!wps_pin_valid(pin_val)) {
|
||||||
|
printf("WPS: Device pin code is invalid. Not triger WPS.\n");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
printf("WPS: Start WPS PIN Keypad.\n");
|
||||||
|
ret = wps_start(WPS_CONFIG_KEYPAD, argv[2], 0, NULL);
|
||||||
|
}
|
||||||
|
}else if(strcmp(argv[1],"pbc") == 0){
|
||||||
|
/* start pbc */
|
||||||
|
printf("WPS: Start WPS PBC.\n");
|
||||||
|
ret = wps_start(WPS_CONFIG_PUSHBUTTON, NULL, 0, NULL);
|
||||||
|
}else{
|
||||||
|
printf("WPS: Wps Method is wrong. Not triger WPS.\n");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit:
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
if(ret != 0)
|
||||||
|
inic_c2h_msg("ATWW", ret, NULL, 0);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||||
|
/*
|
||||||
|
cmd_ap_wps for AP WSC setting. command style:
|
||||||
|
cmd_ap_wps pbc or cmd_ap_wps pin 12345678
|
||||||
|
*/
|
||||||
|
void cmd_ap_wps(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int mode = 0;
|
||||||
|
if(rltk_wlan_running(WLAN1_IDX)){
|
||||||
|
printf("Not support con-current softAP WSC!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wext_get_mode(WLAN0_NAME, &mode);
|
||||||
|
if(mode != IW_MODE_MASTER){
|
||||||
|
printf("Only valid for IW_MODE_MASTER!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((argc == 2 || argc == 3) && (argv[1] != NULL)) {
|
||||||
|
if (strcmp(argv[1],"pin") == 0 ) {
|
||||||
|
unsigned int pin_val = 0;
|
||||||
|
if(argc == 3){
|
||||||
|
pin_val = atoi(argv[2]);
|
||||||
|
if (!wps_pin_valid(pin_val)) {
|
||||||
|
printf("WPS-AP: Device pin code is invalid. Not trigger WPS.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printf("WPS-AP: Start AP WPS PIN Keypad.\n");
|
||||||
|
wifi_start_ap_wps_thread(WPS_CONFIG_KEYPAD, argv[2]);
|
||||||
|
}else{
|
||||||
|
char device_pin[10];
|
||||||
|
pin_val = wps_generate_pin();
|
||||||
|
sprintf(device_pin, "%08d", pin_val);
|
||||||
|
printf("WPS: Start WPS PIN Display. PIN: %s\n", device_pin);
|
||||||
|
wifi_start_ap_wps_thread(WPS_CONFIG_DISPLAY, (char*)device_pin);
|
||||||
|
}
|
||||||
|
}else if (strcmp(argv[1],"pbc") == 0) {
|
||||||
|
printf("WPS-AP: Start AP WPS PBC\n");
|
||||||
|
wifi_start_ap_wps_thread(WPS_CONFIG_PUSHBUTTON, NULL);
|
||||||
|
}else{
|
||||||
|
printf("WPS-AP Usage:\"wifi_ap_wps pin [pin_code]\" or \"wifi_ap_wps pbc\"\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printf("WPS-AP Usage:\"wifi_ap_wps pin [pin_code]\" or \"wifi_ap_wps pbc\"\n");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif //CONFIG_ENABLE_P2P
|
||||||
|
#endif //CONFIG_ENABLE_WPS
|
1981
RTL00_SDKV35a/component/common/api/wifi/wifi_conf.c
Normal file
1981
RTL00_SDKV35a/component/common/api/wifi/wifi_conf.c
Normal file
File diff suppressed because it is too large
Load diff
710
RTL00_SDKV35a/component/common/api/wifi/wifi_conf.h
Normal file
710
RTL00_SDKV35a/component/common/api/wifi/wifi_conf.h
Normal file
|
@ -0,0 +1,710 @@
|
||||||
|
//----------------------------------------------------------------------------//
|
||||||
|
#ifndef __WIFI_API_H
|
||||||
|
#define __WIFI_API_H
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "wifi_constants.h"
|
||||||
|
#include "wifi_structures.h"
|
||||||
|
#include "wifi_util.h"
|
||||||
|
#include "wifi_ind.h"
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Macros
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
#define RTW_ENABLE_API_INFO
|
||||||
|
|
||||||
|
#ifdef RTW_ENABLE_API_INFO
|
||||||
|
#define RTW_API_INFO(args) do {printf args;} while(0)
|
||||||
|
#else
|
||||||
|
#define RTW_API_INFO(args)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
|
||||||
|
#define CMP_MAC( a, b ) (((a[0])==(b[0]))&& \
|
||||||
|
((a[1])==(b[1]))&& \
|
||||||
|
((a[2])==(b[2]))&& \
|
||||||
|
((a[3])==(b[3]))&& \
|
||||||
|
((a[4])==(b[4]))&& \
|
||||||
|
((a[5])==(b[5])))
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Constants
|
||||||
|
******************************************************/
|
||||||
|
#define SCAN_LONGEST_WAIT_TIME (4500)
|
||||||
|
|
||||||
|
#define wifi_test_timeout_step_ms 20 // ms
|
||||||
|
#define wifi_test_timeout_ms 2000 // ms
|
||||||
|
|
||||||
|
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||||
|
|
||||||
|
#define PSCAN_ENABLE 0x01 //enable for partial channel scan
|
||||||
|
#define PSCAN_FAST_SURVEY 0x02 //set to select scan time to FAST_SURVEY_TO, otherwise SURVEY_TO
|
||||||
|
#define PSCAN_SIMPLE_CONFIG 0x04 //set to select scan time to FAST_SURVEY_TO and resend probe request
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Type Definitions
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
/** Scan result callback function pointer type
|
||||||
|
*
|
||||||
|
* @param result_ptr : A pointer to the pointer that indicates where to put the next scan result
|
||||||
|
* @param user_data : User provided data
|
||||||
|
*/
|
||||||
|
typedef void (*rtw_scan_result_callback_t)( rtw_scan_result_t** result_ptr, void* user_data );
|
||||||
|
typedef rtw_result_t (*rtw_scan_result_handler_t)( rtw_scan_handler_result_t* malloced_scan_result );
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Structures
|
||||||
|
******************************************************/
|
||||||
|
typedef struct {
|
||||||
|
char *buf;
|
||||||
|
int buf_len;
|
||||||
|
} scan_buf_arg;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Structures
|
||||||
|
******************************************************/
|
||||||
|
typedef struct internal_scan_handler{
|
||||||
|
rtw_scan_result_t** pap_details;
|
||||||
|
rtw_scan_result_t * ap_details;
|
||||||
|
int scan_cnt;
|
||||||
|
rtw_bool_t scan_complete;
|
||||||
|
unsigned char max_ap_size;
|
||||||
|
rtw_scan_result_handler_t gscan_result_handler;
|
||||||
|
#if SCAN_USE_SEMAPHORE
|
||||||
|
void *scan_semaphore;
|
||||||
|
#else
|
||||||
|
int scan_running;
|
||||||
|
#endif
|
||||||
|
void* user_data;
|
||||||
|
unsigned int scan_start_time;
|
||||||
|
} internal_scan_handler_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
rtw_network_info_t network_info;
|
||||||
|
void *join_sema;
|
||||||
|
} internal_join_result_t;
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Function Declarations
|
||||||
|
******************************************************/
|
||||||
|
/**
|
||||||
|
* Initialises Realtek WiFi API System
|
||||||
|
*
|
||||||
|
* - Initialises the required parts of the software platform
|
||||||
|
* i.e. worker, event registering, semaphore, etc.
|
||||||
|
*
|
||||||
|
* - Initialises the RTW API thread which handles the asynchronous event
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if initialization is successful, RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_manager_init(void);
|
||||||
|
|
||||||
|
/** Joins a Wi-Fi network
|
||||||
|
*
|
||||||
|
* Scans for, associates and authenticates with a Wi-Fi network.
|
||||||
|
* On successful return, the system is ready to send data packets.
|
||||||
|
*
|
||||||
|
* @param[in] ssid : A null terminated string containing the SSID name of the network to join
|
||||||
|
* @param[in] security_type : Authentication type:
|
||||||
|
* - RTW_SECURITY_OPEN - Open Security
|
||||||
|
* - RTW_SECURITY_WEP_PSK - WEP Security with open authentication
|
||||||
|
* - RTW_SECURITY_WEP_SHARED - WEP Security with shared authentication
|
||||||
|
* - RTW_SECURITY_WPA_TKIP_PSK - WPA Security
|
||||||
|
* - RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher
|
||||||
|
* - RTW_SECURITY_WPA2_TKIP_PSK - WPA2 Security using TKIP cipher
|
||||||
|
* - RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers
|
||||||
|
* @param[in] password : A byte array containing either the
|
||||||
|
* cleartext security key for WPA/WPA2
|
||||||
|
* secured networks, or a pointer to
|
||||||
|
* an array of rtw_wep_key_t
|
||||||
|
* structures for WEP secured networks
|
||||||
|
* @param[in] ssid_len : The length of the SSID in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] password_len : The length of the security_key in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] key_id : The index of the wep key.
|
||||||
|
* @param[in] semaphore : A user provided semaphore that is flagged when the join is complete
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : when the system is joined and ready
|
||||||
|
* to send data packets
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_connect(
|
||||||
|
char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
char *password,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int key_id,
|
||||||
|
void *semaphore);
|
||||||
|
|
||||||
|
int wifi_connect_bssid(
|
||||||
|
unsigned char bssid[ETH_ALEN],
|
||||||
|
char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
char *password,
|
||||||
|
int bssid_len,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int key_id,
|
||||||
|
void *semaphore);
|
||||||
|
|
||||||
|
/** Disassociates from a Wi-Fi network.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : On successful disassociation from
|
||||||
|
* the AP
|
||||||
|
* RTW_ERROR : If an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_disconnect(void);
|
||||||
|
|
||||||
|
/** Check if the interface specified is up.
|
||||||
|
*
|
||||||
|
* @return RTW_TRUE : If it's up
|
||||||
|
* RTW_FALSE : If it's not
|
||||||
|
*/
|
||||||
|
int wifi_is_connected_to_ap(void);
|
||||||
|
/*check if wifi has connected to AP before dhcp
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS:if conneced
|
||||||
|
RTW_ERROR :if not connect
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
int wifi_is_up(rtw_interface_t interface);
|
||||||
|
|
||||||
|
/** Determines if a particular interface is ready to transceive ethernet packets
|
||||||
|
*
|
||||||
|
* @param Radio interface to check, options are
|
||||||
|
* RTW_STA_INTERFACE, RTW_AP_INTERFACE
|
||||||
|
* @return RTW_SUCCESS : if the interface is ready to
|
||||||
|
* transceive ethernet packets
|
||||||
|
* @return RTW_NOTFOUND : no AP with a matching SSID was
|
||||||
|
* found
|
||||||
|
* @return RTW_NOT_AUTHENTICATED: a matching AP was found but
|
||||||
|
* it won't let you
|
||||||
|
* authenticate. This can
|
||||||
|
* occur if this device is
|
||||||
|
* in the block list on the
|
||||||
|
* AP.
|
||||||
|
* @return RTW_NOT_KEYED: the device has authenticated and
|
||||||
|
* associated but has not completed
|
||||||
|
* the key exchange. This can occur
|
||||||
|
* if the passphrase is incorrect.
|
||||||
|
* @return RTW_ERROR : if the interface is not ready to
|
||||||
|
* transceive ethernet packets
|
||||||
|
*/
|
||||||
|
int wifi_is_ready_to_transceive(rtw_interface_t interface);
|
||||||
|
|
||||||
|
/** ----------------------------------------------------------------------
|
||||||
|
* WARNING : This function is for internal use only!
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* This function sets the current Media Access Control (MAC) address of the
|
||||||
|
* 802.11 device.
|
||||||
|
*
|
||||||
|
* @param[in] mac Wi-Fi MAC address
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_mac_address(char * mac);
|
||||||
|
|
||||||
|
/** Retrieves the current Media Access Control (MAC) address
|
||||||
|
* (or Ethernet hardware address) of the 802.11 device
|
||||||
|
*
|
||||||
|
* @param mac Pointer to a variable that the current MAC address will be written to
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_get_mac_address(char * mac);
|
||||||
|
|
||||||
|
/** Enables powersave mode
|
||||||
|
*
|
||||||
|
* @return @ref rtw_result_t
|
||||||
|
*/
|
||||||
|
int wifi_enable_powersave(void);
|
||||||
|
|
||||||
|
/** Disables 802.11 power save mode
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if power save mode was successfully
|
||||||
|
* disabled
|
||||||
|
* RTW_ERROR : if power save mode was not successfully
|
||||||
|
* disabled
|
||||||
|
*/
|
||||||
|
int wifi_disable_powersave(void);
|
||||||
|
|
||||||
|
/** Gets the tx power in index units
|
||||||
|
*
|
||||||
|
* @param dbm : The variable to receive the tx power in index.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successful
|
||||||
|
* RTW_ERROR : if not successful
|
||||||
|
*/
|
||||||
|
int wifi_get_txpower(int *poweridx);
|
||||||
|
|
||||||
|
/** Sets the tx power in index units
|
||||||
|
*
|
||||||
|
* @param dbm : The desired tx power in index.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if tx power was successfully set
|
||||||
|
* RTW_ERROR : if tx power was not successfully set
|
||||||
|
*/
|
||||||
|
int wifi_set_txpower(int poweridx);
|
||||||
|
|
||||||
|
/** Get the associated clients with SoftAP
|
||||||
|
*
|
||||||
|
* @param client_list_buffer : the location where the client
|
||||||
|
* list will be stored
|
||||||
|
* @param buffer_length : the buffer length.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if result was successfully get
|
||||||
|
* RTW_ERROR : if result was not successfully get
|
||||||
|
*/
|
||||||
|
int wifi_get_associated_client_list(void * client_list_buffer, unsigned short buffer_length);
|
||||||
|
|
||||||
|
/** Get the SoftAP information
|
||||||
|
*
|
||||||
|
* @param ap_info : the location where the AP info will be
|
||||||
|
* stored
|
||||||
|
* @param security : the security type.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if result was successfully get
|
||||||
|
* RTW_ERROR : if result was not successfully get
|
||||||
|
*/
|
||||||
|
int wifi_get_ap_info(rtw_bss_info_t * ap_info, rtw_security_t* security);
|
||||||
|
|
||||||
|
/** Set the country code to driver to determine the channel set
|
||||||
|
*
|
||||||
|
* @param country_code : the country code.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if result was successfully set
|
||||||
|
* RTW_ERROR : if result was not successfully set
|
||||||
|
*/
|
||||||
|
int wifi_set_country(rtw_country_code_t country_code);
|
||||||
|
|
||||||
|
/** Retrieve the latest RSSI value
|
||||||
|
*
|
||||||
|
* @param rssi: The location where the RSSI value will be stored
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the RSSI was succesfully retrieved
|
||||||
|
* RTW_ERROR : if the RSSI was not retrieved
|
||||||
|
*/
|
||||||
|
int wifi_get_rssi(int *pRSSI);
|
||||||
|
|
||||||
|
/** Set the current channel on STA interface
|
||||||
|
*
|
||||||
|
* @param channel : The desired channel
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the channel was successfully set
|
||||||
|
* RTW_ERROR : if the channel was not successfully
|
||||||
|
* set
|
||||||
|
*/
|
||||||
|
int wifi_set_channel(int channel);
|
||||||
|
|
||||||
|
/** Get the current channel on STA interface
|
||||||
|
*
|
||||||
|
* @param channel : A pointer to the variable where the
|
||||||
|
* channel value will be written
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the channel was successfully read
|
||||||
|
* RTW_ERROR : if the channel was not successfully
|
||||||
|
* read
|
||||||
|
*/
|
||||||
|
int wifi_get_channel(int *channel);
|
||||||
|
|
||||||
|
/** Registers interest in a multicast address
|
||||||
|
* Once a multicast address has been registered, all packets detected on the
|
||||||
|
* medium destined for that address are forwarded to the host.
|
||||||
|
* Otherwise they are ignored.
|
||||||
|
*
|
||||||
|
* @param mac: Ethernet MAC address
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the address was registered
|
||||||
|
* successfully
|
||||||
|
* RTW_ERROR : if the address was not registered
|
||||||
|
*/
|
||||||
|
int wifi_register_multicast_address(rtw_mac_t *mac);
|
||||||
|
|
||||||
|
/** Unregisters interest in a multicast address
|
||||||
|
* Once a multicast address has been unregistered, all packets detected on the
|
||||||
|
* medium destined for that address are ignored.
|
||||||
|
*
|
||||||
|
* @param mac: Ethernet MAC address
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the address was unregistered
|
||||||
|
* successfully
|
||||||
|
* RTW_ERROR : if the address was not unregistered
|
||||||
|
*/
|
||||||
|
int wifi_unregister_multicast_address(rtw_mac_t *mac);
|
||||||
|
|
||||||
|
int wifi_rf_on(void);
|
||||||
|
int wifi_rf_off(void);
|
||||||
|
|
||||||
|
/** Turn on the Wi-Fi device
|
||||||
|
*
|
||||||
|
* - Bring the Wireless interface "Up"
|
||||||
|
* - Initialises the driver thread which arbitrates access
|
||||||
|
* to the SDIO/SPI bus
|
||||||
|
*
|
||||||
|
* @param mode: wifi work mode
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if the WiFi chip was initialised
|
||||||
|
* successfully
|
||||||
|
* RTW_ERROR : if the WiFi chip was not initialised
|
||||||
|
* successfully
|
||||||
|
*/
|
||||||
|
int wifi_on(rtw_mode_t mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn off the Wi-Fi device
|
||||||
|
*
|
||||||
|
* - Bring the Wireless interface "Down"
|
||||||
|
* - De-Initialises the driver thread which arbitrates access
|
||||||
|
* to the SDIO/SPI bus
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if deinitialization is successful,
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_off(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set IPS/LPS mode
|
||||||
|
*
|
||||||
|
* @param[in] ips_mode : The desired IPS mode. It become effective when wlan enter ips.
|
||||||
|
* @param[in] lps_mode : The desired LPS mode. It become effective when wlan enter lps.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if setting LPS mode successful
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_set_power_mode(unsigned char ips_mode, unsigned char lps_mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set TDMA parameters
|
||||||
|
*
|
||||||
|
* @param[in] slot_period : We separate TBTT into 2 or 3 slots.
|
||||||
|
* If we separate TBTT into 2 slots, then slot_period should be larger or equal to 50ms.
|
||||||
|
* It means 2 slot period is
|
||||||
|
* slot_period, 100-slot_period
|
||||||
|
* If we separate TBTT into 3 slots, then slot_period should be less or equal to 33ms.
|
||||||
|
* It means 3 slot period is
|
||||||
|
* 100 - 2 * slot_period, slot_period, slot_period
|
||||||
|
* @param[in] rfon_period_len_1: rf on period of slot 1
|
||||||
|
* @param[in] rfon_period_len_2: rf on period of slot 2
|
||||||
|
* @param[in] rfon_period_len_3: rf on period of slot 3
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if setting TDMA parameters successful
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_set_tdma_param(unsigned char slot_period, unsigned char rfon_period_len_1, unsigned char rfon_period_len_2, unsigned char rfon_period_len_3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set LPS DTIM
|
||||||
|
*
|
||||||
|
* @param[in] dtim : In LPS, the package can be buffered at AP side.
|
||||||
|
* STA leave LPS until dtim count of packages buffered at AP side.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if setting LPS dtim successful
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_set_lps_dtim(unsigned char dtim);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get LPS DTIM
|
||||||
|
*
|
||||||
|
* @param[out] dtim : In LPS, the package can be buffered at AP side.
|
||||||
|
* STA leave LPS until dtim count of packages buffered at AP side.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS if getting LPS dtim successful
|
||||||
|
* RTW_ERROR otherwise
|
||||||
|
*/
|
||||||
|
int wifi_get_lps_dtim(unsigned char *dtim);
|
||||||
|
|
||||||
|
/** Starts an infrastructure WiFi network
|
||||||
|
*
|
||||||
|
* @warning If a STA interface is active when this function is called, the softAP will\n
|
||||||
|
* start on the same channel as the STA. It will NOT use the channel provided!
|
||||||
|
*
|
||||||
|
* @param[in] ssid : A null terminated string containing
|
||||||
|
* the SSID name of the network to join
|
||||||
|
* @param[in] security_type : Authentication type: \n
|
||||||
|
* - RTW_SECURITY_OPEN - Open Security \n
|
||||||
|
* - RTW_SECURITY_WPA_TKIP_PSK - WPA Security \n
|
||||||
|
* - RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher \n
|
||||||
|
* - RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers \n
|
||||||
|
* - WEP security is NOT IMPLEMENTED. It is NOT SECURE! \n
|
||||||
|
* @param[in] password : A byte array containing the cleartext
|
||||||
|
* security key for the network
|
||||||
|
* @param[in] ssid_len : The length of the SSID in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] password_len : The length of the security_key in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] channel : 802.11 channel number
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successfully creates an AP
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_start_ap(
|
||||||
|
char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
char *password,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int channel);
|
||||||
|
|
||||||
|
/** Starts an infrastructure WiFi network with hidden SSID
|
||||||
|
*
|
||||||
|
* @warning If a STA interface is active when this function is called, the softAP will\n
|
||||||
|
* start on the same channel as the STA. It will NOT use the channel provided!
|
||||||
|
*
|
||||||
|
* @param[in] ssid : A null terminated string containing
|
||||||
|
* the SSID name of the network to join
|
||||||
|
* @param[in] security_type : Authentication type: \n
|
||||||
|
* - RTW_SECURITY_OPEN - Open Security \n
|
||||||
|
* - RTW_SECURITY_WPA_TKIP_PSK - WPA Security \n
|
||||||
|
* - RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher \n
|
||||||
|
* - RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers \n
|
||||||
|
* - WEP security is NOT IMPLEMENTED. It is NOT SECURE! \n
|
||||||
|
* @param[in] password : A byte array containing the cleartext
|
||||||
|
* security key for the network
|
||||||
|
* @param[in] ssid_len : The length of the SSID in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] password_len : The length of the security_key in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] channel : 802.11 channel number
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successfully creates an AP
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_start_ap_with_hidden_ssid(
|
||||||
|
char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
char *password,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int channel);
|
||||||
|
|
||||||
|
/** Initiates a scan to search for 802.11 networks.
|
||||||
|
*
|
||||||
|
* The scan progressively accumulates results over time, and
|
||||||
|
* may take between 1 and 3 seconds to complete. The results of
|
||||||
|
* the scan will be individually provided to the callback
|
||||||
|
* function. Note: The callback function will be executed in
|
||||||
|
* the context of the RTW thread.
|
||||||
|
*
|
||||||
|
* @param[in] scan_type : Specifies whether the scan should
|
||||||
|
* be Active, Passive or scan
|
||||||
|
* Prohibited channels
|
||||||
|
* @param[in] bss_type : Specifies whether the scan should
|
||||||
|
* search for Infrastructure
|
||||||
|
* networks (those using an Access
|
||||||
|
* Point), Ad-hoc networks, or both
|
||||||
|
* types.
|
||||||
|
* @param result_ptr[in] : Scan specific ssid. The first 4
|
||||||
|
* bytes is ssid lenth, and ssid name
|
||||||
|
* append after it.
|
||||||
|
* If no specific ssid need to scan,
|
||||||
|
* PLEASE CLEAN result_ptr before pass
|
||||||
|
* it into parameter.
|
||||||
|
* @param result_ptr[out] : a pointer to a pointer to a result
|
||||||
|
* storage structure.
|
||||||
|
*
|
||||||
|
* @note : When scanning specific channels, devices with a
|
||||||
|
* strong signal strength on nearby channels may be
|
||||||
|
* detected
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_scan(rtw_scan_type_t scan_type,
|
||||||
|
rtw_bss_type_t bss_type,
|
||||||
|
void* result_ptr);
|
||||||
|
|
||||||
|
/** Initiates a scan to search for 802.11 networks, a higher
|
||||||
|
* level API based on wifi_scan to simplify the scan
|
||||||
|
* operation.
|
||||||
|
*
|
||||||
|
* The scan results will be list by the order of RSSI.
|
||||||
|
* It may demand hundreds bytes memory during scan
|
||||||
|
* processing according to the quantity of AP nearby.
|
||||||
|
*
|
||||||
|
* @param results_handler[in] : the callback function which
|
||||||
|
* will receive and process the result data.
|
||||||
|
* @param user_data[in] : user specific data that will be
|
||||||
|
* passed directly to the callback function
|
||||||
|
*
|
||||||
|
* @note : Callback must not use blocking functions, since it is
|
||||||
|
* called from the context of the RTW thread.
|
||||||
|
* @note : The callback, user_data variables will
|
||||||
|
* be referenced after the function returns. Those
|
||||||
|
* variables must remain valid until the scan is
|
||||||
|
* complete.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_scan_networks(rtw_scan_result_handler_t results_handler, void* user_data);
|
||||||
|
int wifi_scan_networks_with_ssid(int (results_handler)(char*, int, char *, void *), void* user_data, int scan_buflen, char* ssid, int ssid_len);
|
||||||
|
|
||||||
|
/** Set the partical scan
|
||||||
|
*
|
||||||
|
* @param channel_list[in] : the channel set the scan will
|
||||||
|
* stay on
|
||||||
|
* @param pscan_config[in] : the pscan_config of the channel set
|
||||||
|
*
|
||||||
|
* @param length[in] : the channel list length
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_pscan_chan(__u8 * channel_list,__u8 * pscan_config, __u8 length);
|
||||||
|
|
||||||
|
/** Get the network information
|
||||||
|
*
|
||||||
|
* @param ifname[in] : the name of the interface we are care
|
||||||
|
* @param pSetting[in] : the location where the network
|
||||||
|
* information will be stored
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_get_setting(const char *ifname,rtw_wifi_setting_t *pSetting);
|
||||||
|
|
||||||
|
/** Show the network information
|
||||||
|
*
|
||||||
|
* @param ifname[in] : the name of the interface we are care
|
||||||
|
* @param pSetting[in] : the location where the network
|
||||||
|
* information was stored
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_show_setting(const char *ifname,rtw_wifi_setting_t *pSetting);
|
||||||
|
|
||||||
|
/** Set the network mode according to the data rate it's
|
||||||
|
* supported
|
||||||
|
*
|
||||||
|
* @param mode[in] : the network mode
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_network_mode(rtw_network_mode_t mode);
|
||||||
|
|
||||||
|
/** Set the chip to worke in the promisc mode
|
||||||
|
*
|
||||||
|
* @param enabled[in] : enabled can be set 0, 1 and 2. if enabled is zero, disable the promisc, else enable the promisc.
|
||||||
|
* 0 means disable the promisc
|
||||||
|
* 1 means enable the promisc
|
||||||
|
* 2 means enable the promisc special for length is used
|
||||||
|
* @param callback[in] : the callback function which will
|
||||||
|
* receive and process the netowork data.
|
||||||
|
* @param len_used[in] : specify if the the promisc length is
|
||||||
|
* used.
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_promisc(rtw_rcr_level_t enabled, void (*callback)(unsigned char*, unsigned int, void*), unsigned char len_used);
|
||||||
|
|
||||||
|
/** Set the wps phase
|
||||||
|
*
|
||||||
|
* @param is_trigger_wps[in] : to trigger wps function or not
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS or RTW_ERROR
|
||||||
|
*/
|
||||||
|
int wifi_set_wps_phase(unsigned char is_trigger_wps);
|
||||||
|
|
||||||
|
/** Restarts an infrastructure WiFi network
|
||||||
|
*
|
||||||
|
* @warning If a STA interface is active when this function is called, the softAP will\n
|
||||||
|
* start on the same channel as the STA. It will NOT use the channel provided!
|
||||||
|
*
|
||||||
|
* @param[in] ssid : A null terminated string containing
|
||||||
|
* the SSID name of the network to join
|
||||||
|
* @param[in] security_type : Authentication type: \n
|
||||||
|
* - RTW_SECURITY_OPEN - Open Security \n
|
||||||
|
* - RTW_SECURITY_WPA_TKIP_PSK - WPA Security \n
|
||||||
|
* - RTW_SECURITY_WPA2_AES_PSK - WPA2 Security using AES cipher \n
|
||||||
|
* - RTW_SECURITY_WPA2_MIXED_PSK - WPA2 Security using AES and/or TKIP ciphers \n
|
||||||
|
* - WEP security is NOT IMPLEMENTED. It is NOT SECURE! \n
|
||||||
|
* @param[in] password : A byte array containing the cleartext
|
||||||
|
* security key for the network
|
||||||
|
* @param[in] ssid_len : The length of the SSID in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] password_len : The length of the security_key in
|
||||||
|
* bytes.
|
||||||
|
* @param[in] channel : 802.11 channel number
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successfully creates an AP
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
int wifi_restart_ap(
|
||||||
|
unsigned char *ssid,
|
||||||
|
rtw_security_t security_type,
|
||||||
|
unsigned char *password,
|
||||||
|
int ssid_len,
|
||||||
|
int password_len,
|
||||||
|
int channel);
|
||||||
|
|
||||||
|
int wifi_config_autoreconnect(__u8 mode, __u8 retyr_times, __u16 timeout);
|
||||||
|
int wifi_set_autoreconnect(__u8 mode);
|
||||||
|
int wifi_get_autoreconnect(__u8 *mode);
|
||||||
|
int wifi_get_last_error(void);
|
||||||
|
/** Present device disconnect reason while connecting
|
||||||
|
*
|
||||||
|
*@return RTW_NO_ERROR = 0,
|
||||||
|
* RTW_NONE_NETWORK = 1,
|
||||||
|
* RTW_CONNECT_FAIL = 2,
|
||||||
|
* RTW_WRONG_PASSWORD = 3 ,
|
||||||
|
* RTW_DHCP_FAIL = 4,
|
||||||
|
* RTW_UNKNOWN, initial status
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_CUSTOM_IE
|
||||||
|
#ifndef BIT
|
||||||
|
#define BIT(x) ((__u32)1 << (x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _CUSTOM_IE_TYPE_
|
||||||
|
#define _CUSTOM_IE_TYPE_
|
||||||
|
enum CUSTOM_IE_TYPE{
|
||||||
|
PROBE_REQ = BIT(0),
|
||||||
|
PROBE_RSP = BIT(1),
|
||||||
|
BEACON = BIT(2),
|
||||||
|
};
|
||||||
|
#endif /* _CUSTOM_IE_TYPE_ */
|
||||||
|
|
||||||
|
/* ie format
|
||||||
|
* +-----------+--------+-----------------------+
|
||||||
|
* |element ID | length | content in length byte|
|
||||||
|
* +-----------+--------+-----------------------+
|
||||||
|
*
|
||||||
|
* type: refer to CUSTOM_IE_TYPE
|
||||||
|
*/
|
||||||
|
#ifndef _CUS_IE_
|
||||||
|
#define _CUS_IE_
|
||||||
|
typedef struct _cus_ie{
|
||||||
|
__u8 *ie;
|
||||||
|
__u8 type;
|
||||||
|
}cus_ie, *p_cus_ie;
|
||||||
|
#endif /* _CUS_IE_ */
|
||||||
|
|
||||||
|
int wifi_add_custom_ie(void *cus_ie, int ie_num);
|
||||||
|
|
||||||
|
int wifi_update_custom_ie(void *cus_ie, int ie_index);
|
||||||
|
|
||||||
|
int wifi_del_custom_ie(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
void wifi_init_packet_filter(void);
|
||||||
|
int wifi_add_packet_filter(unsigned char filter_id, rtw_packet_filter_pattern_t *patt, rtw_packet_filter_rule_e rule);
|
||||||
|
int wifi_enable_packet_filter(unsigned char filter_id);
|
||||||
|
int wifi_disable_packet_filter(unsigned char filter_id);
|
||||||
|
int wifi_remove_packet_filter(unsigned char filter_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __WIFI_API_H
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------//
|
265
RTL00_SDKV35a/component/common/api/wifi/wifi_ind.c
Normal file
265
RTL00_SDKV35a/component/common/api/wifi/wifi_ind.c
Normal file
|
@ -0,0 +1,265 @@
|
||||||
|
//----------------------------------------------------------------------------//
|
||||||
|
#include "wifi/wifi_ind.h"
|
||||||
|
#include "wifi/wifi_conf.h"
|
||||||
|
#include "osdep_service.h"
|
||||||
|
#include "platform_stdlib.h"
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Constants
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
|
#define WIFI_INDICATE_MSG 1
|
||||||
|
#else
|
||||||
|
#define WIFI_INDICATE_MSG 0
|
||||||
|
#endif
|
||||||
|
#define WIFI_MANAGER_STACKSIZE 1300
|
||||||
|
#define WIFI_MANAGER_PRIORITY (0) //Actual priority is 4 since calling rtw_create_task
|
||||||
|
#define WIFI_MANAGER_Q_SZ 8
|
||||||
|
|
||||||
|
#define WIFI_EVENT_MAX_ROW 3
|
||||||
|
/******************************************************
|
||||||
|
* Globals
|
||||||
|
******************************************************/
|
||||||
|
|
||||||
|
static event_list_elem_t event_callback_list[WIFI_EVENT_MAX][WIFI_EVENT_MAX_ROW];
|
||||||
|
#if CONFIG_WIFI_IND_USE_THREAD
|
||||||
|
static rtw_worker_thread_t wifi_worker_thread;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------//
|
||||||
|
#if CONFIG_WIFI_IND_USE_THREAD
|
||||||
|
static rtw_result_t rtw_send_event_to_worker(int event_cmd, char *buf, int buf_len, int flags)
|
||||||
|
{
|
||||||
|
rtw_event_message_t message;
|
||||||
|
int i;
|
||||||
|
rtw_result_t ret = RTW_SUCCESS;
|
||||||
|
char *local_buf = NULL;
|
||||||
|
|
||||||
|
if(event_cmd >= WIFI_EVENT_MAX)
|
||||||
|
return RTW_BADARG;
|
||||||
|
|
||||||
|
for(i = 0; i < WIFI_EVENT_MAX_ROW; i++){
|
||||||
|
if(event_callback_list[event_cmd][i].handler == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
message.function = (event_handler_t)event_callback_list[event_cmd][i].handler;
|
||||||
|
message.buf_len = buf_len;
|
||||||
|
if(buf_len){
|
||||||
|
local_buf = (char*)pvPortMalloc(buf_len);
|
||||||
|
if(local_buf == NULL)
|
||||||
|
return RTW_NOMEM;
|
||||||
|
memcpy(local_buf, buf, buf_len);
|
||||||
|
//printf("\n!!!!!Allocate %p(%d) for evcmd %d\n", local_buf, buf_len, event_cmd);
|
||||||
|
}
|
||||||
|
message.buf = local_buf;
|
||||||
|
message.flags = flags;
|
||||||
|
message.user_data = event_callback_list[event_cmd][i].handler_user_data;
|
||||||
|
|
||||||
|
ret = rtw_push_to_xqueue(&wifi_worker_thread.event_queue, &message, 0);
|
||||||
|
if(ret != RTW_SUCCESS){
|
||||||
|
if(local_buf){
|
||||||
|
printf("rtw_send_event_to_worker: enqueue cmd %d failed and free %p(%d)\n", event_cmd, local_buf, buf_len);
|
||||||
|
vPortFree(local_buf);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static rtw_result_t rtw_indicate_event_handle(int event_cmd, char *buf, int buf_len, int flags)
|
||||||
|
{
|
||||||
|
rtw_event_handler_t handle = NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(event_cmd >= WIFI_EVENT_MAX)
|
||||||
|
return RTW_BADARG;
|
||||||
|
|
||||||
|
for(i = 0; i < WIFI_EVENT_MAX_ROW; i++){
|
||||||
|
handle = event_callback_list[event_cmd][i].handler;
|
||||||
|
if(handle == NULL)
|
||||||
|
continue;
|
||||||
|
handle(buf, buf_len, flags, event_callback_list[event_cmd][i].handler_user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RTW_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void wifi_indication( WIFI_EVENT_INDICATE event, char *buf, int buf_len, int flags)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// If upper layer application triggers additional operations on receiving of wext_wlan_indicate,
|
||||||
|
// please strictly check current stack size usage (by using uxTaskGetStackHighWaterMark() )
|
||||||
|
// , and tries not to share the same stack with wlan driver if remaining stack space is
|
||||||
|
// not available for the following operations.
|
||||||
|
// ex: using semaphore to notice another thread.
|
||||||
|
switch(event)
|
||||||
|
{
|
||||||
|
case WIFI_EVENT_DISCONNECT:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf(" %s():Disconnection indication received\n", __FUNCTION__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_CONNECT:
|
||||||
|
// For WPA/WPA2 mode, indication of connection does not mean data can be
|
||||||
|
// correctly transmitted or received. Data can be correctly transmitted or
|
||||||
|
// received only when 4-way handshake is done.
|
||||||
|
// Please check WIFI_EVENT_FOURWAY_HANDSHAKE_DONE event
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
// Sample: return mac address
|
||||||
|
if(buf != NULL && buf_len == 6)
|
||||||
|
{
|
||||||
|
printf("%s():Connect indication received: %02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,
|
||||||
|
buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_FOURWAY_HANDSHAKE_DONE:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
if(buf != NULL)
|
||||||
|
{
|
||||||
|
if(buf_len == strlen(IW_EXT_STR_FOURWAY_DONE))
|
||||||
|
printf("%s():%s\n", __FUNCTION__, buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_SCAN_RESULT_REPORT:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_SCAN_RESULT_REPORT\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_SCAN_DONE:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_SCAN_DONE\n", __func__);
|
||||||
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
|
printf("Time at start %d ms.\n", xTaskGetTickCount());
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_RECONNECTION_FAIL:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
if(buf != NULL){
|
||||||
|
if(buf_len == strlen(IW_EXT_STR_RECONNECTION_FAIL))
|
||||||
|
printf("%s\n", buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_NO_NETWORK:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_NO_NETWORK\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
#if CONFIG_ENABLE_P2P
|
||||||
|
case WIFI_EVENT_SEND_ACTION_DONE:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_SEND_ACTION_DONE\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_RX_MGNT:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_RX_MGNT\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
#endif //CONFIG_ENABLE_P2P
|
||||||
|
case WIFI_EVENT_STA_ASSOC:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_STA_ASSOC\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_STA_DISASSOC:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_STA_DISASSOC\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
#ifdef CONFIG_WPS
|
||||||
|
case WIFI_EVENT_STA_WPS_START:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_STA_WPS_START\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_WPS_FINISH:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_WPS_FINISH\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case WIFI_EVENT_EAPOL_RECVD:
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
printf("%s(): WIFI_EVENT_EAPOL_RECVD\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case WIFI_EVENT_BEACON_AFTER_DHCP:
|
||||||
|
#if(WIFI_INDICATE_MSG>1)
|
||||||
|
printf("%s(): WIFI_EVENT_BEACON_AFTER_DHCP\n", __func__);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CONFIG_INIC_EN
|
||||||
|
inic_indicate_event(event, buf, buf_len, flags);
|
||||||
|
#endif//CONFIG_INIC_EN
|
||||||
|
|
||||||
|
#if CONFIG_WIFI_IND_USE_THREAD
|
||||||
|
rtw_send_event_to_worker(event, buf, buf_len, flags);
|
||||||
|
#else
|
||||||
|
rtw_indicate_event_handle(event, buf, buf_len, flags);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifi_reg_event_handler(unsigned int event_cmds, rtw_event_handler_t handler_func, void *handler_user_data)
|
||||||
|
{
|
||||||
|
int i = 0, j = 0;
|
||||||
|
if(event_cmds < WIFI_EVENT_MAX){
|
||||||
|
for(i=0; i < WIFI_EVENT_MAX_ROW; i++){
|
||||||
|
if(event_callback_list[event_cmds][i].handler == NULL){
|
||||||
|
for(j=0; j<WIFI_EVENT_MAX_ROW; j++){
|
||||||
|
if(event_callback_list[event_cmds][j].handler == handler_func){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event_callback_list[event_cmds][i].handler = handler_func;
|
||||||
|
event_callback_list[event_cmds][i].handler_user_data = handler_user_data;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifi_unreg_event_handler(unsigned int event_cmds, rtw_event_handler_t handler_func)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if(event_cmds < WIFI_EVENT_MAX){
|
||||||
|
for(i = 0; i < WIFI_EVENT_MAX_ROW; i++){
|
||||||
|
if(event_callback_list[event_cmds][i].handler == handler_func){
|
||||||
|
event_callback_list[event_cmds][i].handler = NULL;
|
||||||
|
event_callback_list[event_cmds][i].handler_user_data = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_event_callback_list(){
|
||||||
|
memset(event_callback_list, 0, sizeof(event_callback_list));
|
||||||
|
}
|
||||||
|
|
||||||
|
int wifi_manager_init()
|
||||||
|
{
|
||||||
|
#if CONFIG_WIFI_IND_USE_THREAD
|
||||||
|
rtw_create_worker_thread(&wifi_worker_thread,
|
||||||
|
WIFI_MANAGER_PRIORITY,
|
||||||
|
WIFI_MANAGER_STACKSIZE,
|
||||||
|
WIFI_MANAGER_Q_SZ);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rtw_wifi_manager_deinit()
|
||||||
|
{
|
||||||
|
#if CONFIG_WIFI_IND_USE_THREAD
|
||||||
|
rtw_delete_worker_thread(&wifi_worker_thread);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
34
RTL00_SDKV35a/component/common/api/wifi/wifi_ind.h
Normal file
34
RTL00_SDKV35a/component/common/api/wifi/wifi_ind.h
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef _WIFI_INDICATE_H
|
||||||
|
#define _WIFI_INDICATE_H
|
||||||
|
#include "wifi_conf.h"
|
||||||
|
|
||||||
|
typedef void (*rtw_event_handler_t)(char *buf, int buf_len, int flags, void* handler_user_data );
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// WIFI_EVENT_INDICATE event_cmd;
|
||||||
|
rtw_event_handler_t handler;
|
||||||
|
void* handler_user_data;
|
||||||
|
} event_list_elem_t;
|
||||||
|
|
||||||
|
void init_event_callback_list(void);
|
||||||
|
extern void wifi_indication( WIFI_EVENT_INDICATE event, char *buf, int buf_len, int flags);
|
||||||
|
/** Register the event listener
|
||||||
|
*
|
||||||
|
* @param[in] event_cmds : The event command number indicated
|
||||||
|
* @param[in] handler_func : the callback function which will
|
||||||
|
* receive and process the event
|
||||||
|
* @param[in] handler_user_data : user specific data that will be
|
||||||
|
* passed directly to the callback function
|
||||||
|
*
|
||||||
|
* @note : Set the same event_cmds with empty handler_func will
|
||||||
|
* unregister the event_cmds
|
||||||
|
*
|
||||||
|
* @return RTW_SUCCESS : if successfully registers the event
|
||||||
|
* RTW_ERROR : if an error occurred
|
||||||
|
*/
|
||||||
|
extern void wifi_reg_event_handler(unsigned int event_cmds, rtw_event_handler_t handler_func, void *handler_user_data);
|
||||||
|
extern void wifi_unreg_event_handler(unsigned int event_cmds, rtw_event_handler_t handler_func);
|
||||||
|
|
||||||
|
#endif //_WIFI_INDICATE_H
|
||||||
|
|
475
RTL00_SDKV35a/component/common/api/wifi/wifi_promisc.c
Normal file
475
RTL00_SDKV35a/component/common/api/wifi/wifi_promisc.c
Normal file
|
@ -0,0 +1,475 @@
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "tcpip.h"
|
||||||
|
#include "wifi/wifi_conf.h"
|
||||||
|
#include "wifi_simple_config_parser.h"
|
||||||
|
|
||||||
|
#ifndef CONFIG_WLAN
|
||||||
|
#define CONFIG_WLAN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_WLAN
|
||||||
|
#include <platform/platform_stdlib.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
|
||||||
|
#define _adapter void
|
||||||
|
#define recv_frame void
|
||||||
|
extern void _promisc_deinit(_adapter *padapter);
|
||||||
|
extern int _promisc_recv_func(_adapter *padapter, recv_frame *rframe);
|
||||||
|
extern int _promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char *, unsigned int, void *), unsigned char len_used);
|
||||||
|
extern unsigned char is_promisc_enabled(void);
|
||||||
|
extern int promisc_get_fixed_channel(void *fixed_bssid, unsigned char *ssid, int *ssid_length);
|
||||||
|
extern unsigned char is_promisc_enabled(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Add extra interfaces to make release sdk able to determine promisc API linking
|
||||||
|
void promisc_deinit(void *padapter)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
_promisc_deinit(padapter);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc_recv_func(void *padapter, void *rframe)
|
||||||
|
{
|
||||||
|
// Never reach here if not define CONFIG_PROMISC
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
return _promisc_recv_func(padapter, rframe);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char*, unsigned int, void*), unsigned char len_used)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
return _promisc_set(enabled, callback, len_used);
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char is_promisc_enabled(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
return _is_promisc_enabled();
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc_get_fixed_channel(void *fixed_bssid, u8 *ssid, int *ssid_length)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
return _promisc_get_fixed_channel(fixed_bssid, ssid, ssid_length);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// End of Add extra interfaces
|
||||||
|
|
||||||
|
struct eth_frame {
|
||||||
|
struct eth_frame *prev;
|
||||||
|
struct eth_frame *next;
|
||||||
|
unsigned char da[6];
|
||||||
|
unsigned char sa[6];
|
||||||
|
unsigned int len;
|
||||||
|
unsigned char type;
|
||||||
|
signed char rssi;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
struct inic_eth_frame {
|
||||||
|
unsigned char da[6];
|
||||||
|
unsigned char sa[6];
|
||||||
|
unsigned int len;
|
||||||
|
unsigned char type;
|
||||||
|
};
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct inic_eth_frame *inic_frame, *inic_frame_tail = NULL;
|
||||||
|
static int inic_frame_cnt = 0;
|
||||||
|
#define MAX_INIC_FRAME_NUM 50 //maximum packets for each channel
|
||||||
|
extern void inic_c2h_msg(const char *atcmd, char status, char *msg, u16 msg_len);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct eth_buffer {
|
||||||
|
struct eth_frame *head;
|
||||||
|
struct eth_frame *tail;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct eth_buffer eth_buffer;
|
||||||
|
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
#define MAX_PACKET_FILTER_INFO 5
|
||||||
|
#define FILTER_ID_INIT_VALUE 10
|
||||||
|
rtw_packet_filter_info_t paff_array[MAX_PACKET_FILTER_INFO]={0, 0, 0, 0, 0};
|
||||||
|
static u8 packet_filter_enable_num = 0;
|
||||||
|
|
||||||
|
void promisc_init_packet_filter()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for(i=0; i<MAX_PACKET_FILTER_INFO; i++){
|
||||||
|
paff_array[i].filter_id = FILTER_ID_INIT_VALUE;
|
||||||
|
paff_array[i].enable = 0;
|
||||||
|
paff_array[i].patt.mask_size = 0;
|
||||||
|
paff_array[i].rule = RTW_POSITIVE_MATCHING;
|
||||||
|
paff_array[i].patt.mask = NULL;
|
||||||
|
paff_array[i].patt.pattern = NULL;
|
||||||
|
}
|
||||||
|
packet_filter_enable_num = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc_add_packet_filter(u8 filter_id, rtw_packet_filter_pattern_t *patt, rtw_packet_filter_rule_e rule)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while(i < MAX_PACKET_FILTER_INFO){
|
||||||
|
if(paff_array[i].filter_id == FILTER_ID_INIT_VALUE){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == MAX_PACKET_FILTER_INFO)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
paff_array[i].filter_id = filter_id;
|
||||||
|
|
||||||
|
paff_array[i].patt.offset= patt->offset;
|
||||||
|
paff_array[i].patt.mask_size = patt->mask_size;
|
||||||
|
paff_array[i].patt.mask = pvPortMalloc(patt->mask_size);
|
||||||
|
memcpy(paff_array[i].patt.mask, patt->mask, patt->mask_size);
|
||||||
|
paff_array[i].patt.pattern= pvPortMalloc(patt->mask_size);
|
||||||
|
memcpy(paff_array[i].patt.pattern, patt->pattern, patt->mask_size);
|
||||||
|
|
||||||
|
paff_array[i].rule = rule;
|
||||||
|
paff_array[i].enable = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc_enable_packet_filter(u8 filter_id)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while(i < MAX_PACKET_FILTER_INFO){
|
||||||
|
if(paff_array[i].filter_id == filter_id)
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == MAX_PACKET_FILTER_INFO)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
paff_array[i].enable = 1;
|
||||||
|
packet_filter_enable_num++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc_disable_packet_filter(u8 filter_id)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while(i < MAX_PACKET_FILTER_INFO){
|
||||||
|
if(paff_array[i].filter_id == filter_id)
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == MAX_PACKET_FILTER_INFO)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
paff_array[i].enable = 0;
|
||||||
|
packet_filter_enable_num--;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int promisc_remove_packet_filter(u8 filter_id)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while(i < MAX_PACKET_FILTER_INFO){
|
||||||
|
if(paff_array[i].filter_id == filter_id)
|
||||||
|
break;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == MAX_PACKET_FILTER_INFO)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
paff_array[i].filter_id = FILTER_ID_INIT_VALUE;
|
||||||
|
paff_array[i].enable = 0;
|
||||||
|
paff_array[i].patt.mask_size = 0;
|
||||||
|
paff_array[i].rule = 0;
|
||||||
|
if(paff_array[i].patt.mask){
|
||||||
|
vPortFree(paff_array[i].patt.mask);
|
||||||
|
paff_array[i].patt.mask = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(paff_array[i].patt.pattern){
|
||||||
|
vPortFree(paff_array[i].patt.pattern);
|
||||||
|
paff_array[i].patt.pattern = NULL;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Make callback simple to prevent latency to wlan rx when promiscuous mode */
|
||||||
|
static void promisc_callback(unsigned char *buf, unsigned int len, void* userdata)
|
||||||
|
{
|
||||||
|
struct eth_frame *frame = (struct eth_frame *) pvPortMalloc(sizeof(struct eth_frame));
|
||||||
|
|
||||||
|
if(frame) {
|
||||||
|
frame->prev = NULL;
|
||||||
|
frame->next = NULL;
|
||||||
|
memcpy(frame->da, buf, 6);
|
||||||
|
memcpy(frame->sa, buf+6, 6);
|
||||||
|
frame->len = len;
|
||||||
|
frame->rssi = ((ieee80211_frame_info_t *)userdata)->rssi;
|
||||||
|
taskENTER_CRITICAL();
|
||||||
|
|
||||||
|
if(eth_buffer.tail) {
|
||||||
|
eth_buffer.tail->next = frame;
|
||||||
|
frame->prev = eth_buffer.tail;
|
||||||
|
eth_buffer.tail = frame;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
eth_buffer.head = frame;
|
||||||
|
eth_buffer.tail = frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct eth_frame* retrieve_frame(void)
|
||||||
|
{
|
||||||
|
struct eth_frame *frame = NULL;
|
||||||
|
|
||||||
|
taskENTER_CRITICAL();
|
||||||
|
|
||||||
|
if(eth_buffer.head) {
|
||||||
|
frame = eth_buffer.head;
|
||||||
|
|
||||||
|
if(eth_buffer.head->next) {
|
||||||
|
eth_buffer.head = eth_buffer.head->next;
|
||||||
|
eth_buffer.head->prev = NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
eth_buffer.head = NULL;
|
||||||
|
eth_buffer.tail = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void promisc_test(int duration, unsigned char len_used)
|
||||||
|
{
|
||||||
|
int ch;
|
||||||
|
unsigned int start_time;
|
||||||
|
struct eth_frame *frame;
|
||||||
|
eth_buffer.head = NULL;
|
||||||
|
eth_buffer.tail = NULL;
|
||||||
|
|
||||||
|
wifi_enter_promisc_mode();
|
||||||
|
wifi_set_promisc(RTW_PROMISC_ENABLE, promisc_callback, len_used);
|
||||||
|
|
||||||
|
for(ch = 1; ch <= 13; ch ++) {
|
||||||
|
if(wifi_set_channel(ch) == 0)
|
||||||
|
printf("\n\n\rSwitch to channel(%d)", ch);
|
||||||
|
|
||||||
|
start_time = xTaskGetTickCount();
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
unsigned int current_time = xTaskGetTickCount();
|
||||||
|
|
||||||
|
if((current_time - start_time) < (duration * configTICK_RATE_HZ)) {
|
||||||
|
frame = retrieve_frame();
|
||||||
|
|
||||||
|
if(frame) {
|
||||||
|
int i;
|
||||||
|
printf("\n\rDA:");
|
||||||
|
for(i = 0; i < 6; i ++)
|
||||||
|
printf(" %02x", frame->da[i]);
|
||||||
|
printf(", SA:");
|
||||||
|
for(i = 0; i < 6; i ++)
|
||||||
|
printf(" %02x", frame->sa[i]);
|
||||||
|
printf(", len=%d", frame->len);
|
||||||
|
printf(", RSSI=%d", frame->rssi);
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
if(inic_frame_tail){
|
||||||
|
if(inic_frame_cnt < MAX_INIC_FRAME_NUM){
|
||||||
|
memcpy(inic_frame_tail->da, frame->da, 6);
|
||||||
|
memcpy(inic_frame_tail->sa, frame->sa, 6);
|
||||||
|
inic_frame_tail->len = frame->len;
|
||||||
|
inic_frame_tail++;
|
||||||
|
inic_frame_cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
vPortFree((void *) frame);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vTaskDelay(1); //delay 1 tick
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
if(inic_frame){
|
||||||
|
inic_c2h_msg("ATWM", RTW_SUCCESS, (char *)inic_frame, sizeof(struct inic_eth_frame)*inic_frame_cnt);
|
||||||
|
memset(inic_frame, '\0', sizeof(struct inic_eth_frame)*MAX_INIC_FRAME_NUM);
|
||||||
|
inic_frame_tail = inic_frame;
|
||||||
|
inic_frame_cnt = 0;
|
||||||
|
rtw_msleep_os(10);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
wifi_set_promisc(RTW_PROMISC_DISABLE, NULL, 0);
|
||||||
|
|
||||||
|
while((frame = retrieve_frame()) != NULL)
|
||||||
|
vPortFree((void *) frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void promisc_callback_all(unsigned char *buf, unsigned int len, void* userdata)
|
||||||
|
{
|
||||||
|
struct eth_frame *frame = (struct eth_frame *) pvPortMalloc(sizeof(struct eth_frame));
|
||||||
|
|
||||||
|
if(frame) {
|
||||||
|
frame->prev = NULL;
|
||||||
|
frame->next = NULL;
|
||||||
|
memcpy(frame->da, buf+4, 6);
|
||||||
|
memcpy(frame->sa, buf+10, 6);
|
||||||
|
frame->len = len;
|
||||||
|
/*
|
||||||
|
* type is the first byte of Frame Control Field of 802.11 frame
|
||||||
|
* If the from/to ds information is needed, type could be reused as follows:
|
||||||
|
* frame->type = ((((ieee80211_frame_info_t *)userdata)->i_fc & 0x0100) == 0x0100) ? 2 : 1;
|
||||||
|
* 1: from ds; 2: to ds
|
||||||
|
*/
|
||||||
|
frame->type = *buf;
|
||||||
|
frame->rssi = ((ieee80211_frame_info_t *)userdata)->rssi;
|
||||||
|
|
||||||
|
taskENTER_CRITICAL();
|
||||||
|
|
||||||
|
if(eth_buffer.tail) {
|
||||||
|
eth_buffer.tail->next = frame;
|
||||||
|
frame->prev = eth_buffer.tail;
|
||||||
|
eth_buffer.tail = frame;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
eth_buffer.head = frame;
|
||||||
|
eth_buffer.tail = frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void promisc_test_all(int duration, unsigned char len_used)
|
||||||
|
{
|
||||||
|
int ch;
|
||||||
|
unsigned int start_time;
|
||||||
|
struct eth_frame *frame;
|
||||||
|
eth_buffer.head = NULL;
|
||||||
|
eth_buffer.tail = NULL;
|
||||||
|
|
||||||
|
wifi_enter_promisc_mode();
|
||||||
|
wifi_set_promisc(RTW_PROMISC_ENABLE_2, promisc_callback_all, len_used);
|
||||||
|
|
||||||
|
for(ch = 1; ch <= 13; ch ++) {
|
||||||
|
if(wifi_set_channel(ch) == 0)
|
||||||
|
printf("\n\n\rSwitch to channel(%d)", ch);
|
||||||
|
|
||||||
|
start_time = xTaskGetTickCount();
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
unsigned int current_time = xTaskGetTickCount();
|
||||||
|
|
||||||
|
if((current_time - start_time) < (duration * configTICK_RATE_HZ)) {
|
||||||
|
frame = retrieve_frame();
|
||||||
|
|
||||||
|
if(frame) {
|
||||||
|
int i;
|
||||||
|
printf("\n\rTYPE: 0x%x, ", frame->type);
|
||||||
|
printf("DA:");
|
||||||
|
for(i = 0; i < 6; i ++)
|
||||||
|
printf(" %02x", frame->da[i]);
|
||||||
|
printf(", SA:");
|
||||||
|
for(i = 0; i < 6; i ++)
|
||||||
|
printf(" %02x", frame->sa[i]);
|
||||||
|
printf(", len=%d", frame->len);
|
||||||
|
printf(", RSSI=%d", frame->rssi);
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
if(inic_frame_tail){
|
||||||
|
if(inic_frame_cnt < MAX_INIC_FRAME_NUM){
|
||||||
|
memcpy(inic_frame_tail->da, frame->da, 6);
|
||||||
|
memcpy(inic_frame_tail->sa, frame->sa, 6);
|
||||||
|
inic_frame_tail->len = frame->len;
|
||||||
|
inic_frame_tail->type = frame->type;
|
||||||
|
inic_frame_tail++;
|
||||||
|
inic_frame_cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
vPortFree((void *) frame);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vTaskDelay(1); //delay 1 tick
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
if(inic_frame){
|
||||||
|
inic_c2h_msg("ATWM", RTW_SUCCESS, (char *)inic_frame, sizeof(struct inic_eth_frame)*inic_frame_cnt);
|
||||||
|
memset(inic_frame, '\0', sizeof(struct inic_eth_frame)*MAX_INIC_FRAME_NUM);
|
||||||
|
inic_frame_tail = inic_frame;
|
||||||
|
inic_frame_cnt = 0;
|
||||||
|
rtw_msleep_os(10);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
wifi_set_promisc(RTW_PROMISC_DISABLE, NULL, 0);
|
||||||
|
|
||||||
|
while((frame = retrieve_frame()) != NULL)
|
||||||
|
vPortFree((void *) frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmd_promisc(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int duration;
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
inic_frame_tail = inic_frame = pvPortMalloc(sizeof(struct inic_eth_frame)*MAX_INIC_FRAME_NUM);
|
||||||
|
if(inic_frame == NULL){
|
||||||
|
inic_c2h_msg("ATWM", RTW_BUFFER_UNAVAILABLE_TEMPORARY, NULL, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
wifi_init_packet_filter();
|
||||||
|
#endif
|
||||||
|
if((argc == 2) && ((duration = atoi(argv[1])) > 0))
|
||||||
|
//promisc_test(duration, 0);
|
||||||
|
promisc_test_all(duration, 0);
|
||||||
|
else if((argc == 3) && ((duration = atoi(argv[1])) > 0) && (strcmp(argv[2], "with_len") == 0))
|
||||||
|
promisc_test(duration, 1);
|
||||||
|
else
|
||||||
|
printf("\n\rUsage: %s DURATION_SECONDS [with_len]", argv[0]);
|
||||||
|
#if CONFIG_INIC_CMD_RSP
|
||||||
|
if(inic_frame)
|
||||||
|
vPortFree(inic_frame);
|
||||||
|
inic_frame_tail = NULL;
|
||||||
|
inic_frame_cnt = 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif //#if CONFIG_WLAN
|
1076
RTL00_SDKV35a/component/common/api/wifi/wifi_simple_config.c
Normal file
1076
RTL00_SDKV35a/component/common/api/wifi/wifi_simple_config.c
Normal file
File diff suppressed because it is too large
Load diff
20
RTL00_SDKV35a/component/common/api/wifi/wifi_simple_config.h
Normal file
20
RTL00_SDKV35a/component/common/api/wifi/wifi_simple_config.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef __WIFI_SIMPLE_CONFIG_H
|
||||||
|
#define __WIFI_SIMPLE_CONFIG_H
|
||||||
|
/*****************************wifi_simple_config.h****************************/
|
||||||
|
enum sc_result {
|
||||||
|
SC_ERROR = -1, /* default error code*/
|
||||||
|
SC_NO_CONTROLLER_FOUND = 1, /* cannot get sta(controller) in the air which starts a simple config session */
|
||||||
|
SC_CONTROLLER_INFO_PARSE_FAIL, /* cannot parse the sta's info */
|
||||||
|
SC_TARGET_CHANNEL_SCAN_FAIL, /* cannot scan the target channel */
|
||||||
|
SC_JOIN_BSS_FAIL, /* fail to connect to target ap */
|
||||||
|
SC_DHCP_FAIL, /* fail to get ip address from target ap */
|
||||||
|
/* fail to create udp socket to send info to controller. note that client isolation
|
||||||
|
must be turned off in ap. we cannot know if ap has configured this */
|
||||||
|
SC_UDP_SOCKET_CREATE_FAIL,
|
||||||
|
SC_TERMINATE,
|
||||||
|
SC_SUCCESS, /* default success code */
|
||||||
|
|
||||||
|
};
|
||||||
|
int SC_send_simple_config_ack(u8 round);
|
||||||
|
|
||||||
|
#endif //__WIFI_SIMPLE_CONFIG_H
|
|
@ -0,0 +1,99 @@
|
||||||
|
#ifndef __SIMPLE_CONFIG_H__
|
||||||
|
#define __SIMPLE_CONFIG_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* This macro means user take simple config
|
||||||
|
* lib to another platform such as linux, and
|
||||||
|
* have no rom crypto libs of simple config,
|
||||||
|
* so we take simple_config_crypto as a sw lib
|
||||||
|
* This macro is used by Realtek internal to generate simple config lib
|
||||||
|
* Please delete this macro after generation.
|
||||||
|
*/
|
||||||
|
#define SIMPLE_CONFIG_PLATFORM_LIB 0
|
||||||
|
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#include "autoconf.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* platform related settings */
|
||||||
|
#if (defined(CONFIG_PLATFORM_8195A)|| defined(CONFIG_PLATFORM_8711B))
|
||||||
|
#undef u32
|
||||||
|
#undef s32
|
||||||
|
#undef u8
|
||||||
|
#undef s8
|
||||||
|
#undef u16
|
||||||
|
#undef s16
|
||||||
|
typedef unsigned int u32;
|
||||||
|
typedef signed int s32;
|
||||||
|
typedef unsigned char u8;
|
||||||
|
typedef char s8;
|
||||||
|
typedef unsigned short int u16;
|
||||||
|
typedef signed short int s16;
|
||||||
|
#else
|
||||||
|
#include "osdep_service.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int (*simple_config_printf_fn) (char const * fmt, ...);
|
||||||
|
typedef void* (*simple_config_memset_fn) (u8 *dst0, s32 Val, u32 length);
|
||||||
|
typedef void* (*simple_config_memcpy_fn) ( void *s1, const void *s2, u32 n );
|
||||||
|
typedef u32 (*simple_config_strlen_fn) (const char *s);
|
||||||
|
typedef char * (*simple_config_strcpy_fn) (char *dest, const char *src);
|
||||||
|
typedef void (*simple_config_free_fn) (u8 *pbuf, u32 sz);
|
||||||
|
typedef u8* (*simple_config_zmalloc_fn) (u32 sz);
|
||||||
|
typedef u8* (*simple_config_malloc_fn) (u32 sz);
|
||||||
|
typedef int (*simple_config_memcmp_fn) (const void *av, const void *bv, u32 len);
|
||||||
|
typedef u32 (*simple_config_ntohl_fn)(u32 x);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct simple_config_lib_config {
|
||||||
|
simple_config_printf_fn printf;
|
||||||
|
simple_config_memset_fn memset;
|
||||||
|
simple_config_memcpy_fn memcpy;
|
||||||
|
simple_config_strlen_fn strlen;
|
||||||
|
simple_config_strcpy_fn strcpy;
|
||||||
|
simple_config_free_fn free;
|
||||||
|
simple_config_zmalloc_fn zmalloc;
|
||||||
|
simple_config_malloc_fn malloc;
|
||||||
|
simple_config_memcmp_fn memcmp;
|
||||||
|
simple_config_ntohl_fn _ntohl;
|
||||||
|
|
||||||
|
|
||||||
|
int *is_promisc_callback_unlock;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
struct rtk_test_sc {
|
||||||
|
/* API exposed to user */
|
||||||
|
unsigned char ssid[32];
|
||||||
|
unsigned char password[65];
|
||||||
|
unsigned int ip_addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* expose data */
|
||||||
|
extern s32 is_promisc_callback_unlock;
|
||||||
|
extern u8 g_bssid[6];
|
||||||
|
extern u8 get_channel_flag;
|
||||||
|
extern u8 g_security_mode;
|
||||||
|
|
||||||
|
/* expose API */
|
||||||
|
extern s32 rtk_sc_init(char *custom_pin_code, struct simple_config_lib_config* config);
|
||||||
|
extern s32 rtk_start_parse_packet(u8 *da, u8 *sa, s32 len, void * user_data, void *backup_sc);
|
||||||
|
extern void rtk_restart_simple_config(void);
|
||||||
|
extern void rtk_sc_deinit();
|
||||||
|
extern void wifi_enter_promisc_mode();
|
||||||
|
extern void whc_fix_channel();
|
||||||
|
extern void whc_unfix_channel();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __SIMPLE_CONFIG_H__*/
|
1342
RTL00_SDKV35a/component/common/api/wifi/wifi_util.c
Normal file
1342
RTL00_SDKV35a/component/common/api/wifi/wifi_util.c
Normal file
File diff suppressed because it is too large
Load diff
75
RTL00_SDKV35a/component/common/api/wifi/wifi_util.h
Normal file
75
RTL00_SDKV35a/component/common/api/wifi/wifi_util.h
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#ifndef _UTIL_H
|
||||||
|
#define _UTIL_H
|
||||||
|
|
||||||
|
#include <wireless.h>
|
||||||
|
#include <wlan_intf.h>
|
||||||
|
#include <wifi_constants.h>
|
||||||
|
#include "wifi_structures.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int wext_get_ssid(const char *ifname, __u8 *ssid);
|
||||||
|
int wext_set_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
|
||||||
|
int wext_set_auth_param(const char *ifname, __u16 idx, __u32 value);
|
||||||
|
int wext_set_key_ext(const char *ifname, __u16 alg, const __u8 *addr, int key_idx, int set_tx, const __u8 *seq, __u16 seq_len, __u8 *key, __u16 key_len);
|
||||||
|
int wext_get_enc_ext(const char *ifname, __u16 *alg, __u8 *key_idx, __u8 *passphrase);
|
||||||
|
int wext_set_passphrase(const char *ifname, const __u8 *passphrase, __u16 passphrase_len);
|
||||||
|
int wext_get_passphrase(const char *ifname, __u8 *passphrase);
|
||||||
|
int wext_set_mode(const char *ifname, int mode);
|
||||||
|
int wext_get_mode(const char *ifname, int *mode);
|
||||||
|
int wext_set_ap_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
|
||||||
|
int wext_set_country(const char *ifname, rtw_country_code_t country_code);
|
||||||
|
int wext_get_rssi(const char *ifname, int *rssi);
|
||||||
|
int wext_set_channel(const char *ifname, __u8 ch);
|
||||||
|
int wext_get_channel(const char *ifname, __u8 *ch);
|
||||||
|
int wext_register_multicast_address(const char *ifname, rtw_mac_t *mac);
|
||||||
|
int wext_unregister_multicast_address(const char *ifname, rtw_mac_t *mac);
|
||||||
|
int wext_set_scan(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
|
||||||
|
int wext_get_scan(const char *ifname, char *buf, __u16 buf_len);
|
||||||
|
int wext_set_mac_address(const char *ifname, char * mac);
|
||||||
|
int wext_get_mac_address(const char *ifname, char * mac);
|
||||||
|
int wext_enable_powersave(const char *ifname, __u8 lps_mode, __u8 ips_mode);
|
||||||
|
int wext_disable_powersave(const char *ifname);
|
||||||
|
int wext_set_tdma_param(const char *ifname, __u8 slot_period, __u8 rfon_period_len_1, __u8 rfon_period_len_2, __u8 rfon_period_len_3);
|
||||||
|
int wext_set_lps_dtim(const char *ifname, __u8 lps_dtim);
|
||||||
|
int wext_get_lps_dtim(const char *ifname, __u8 *lps_dtim);
|
||||||
|
int wext_get_tx_power(const char *ifname, __u8 *poweridx);
|
||||||
|
int wext_set_txpower(const char *ifname, int poweridx);
|
||||||
|
int wext_get_associated_client_list(const char *ifname, void * client_list_buffer, __u16 buffer_length);
|
||||||
|
int wext_get_ap_info(const char *ifname, rtw_bss_info_t * ap_info, rtw_security_t* security);
|
||||||
|
int wext_mp_command(const char *ifname, char *cmd, int show_msg);
|
||||||
|
int wext_private_command(const char *ifname, char *cmd, int show_msg);
|
||||||
|
int wext_private_command_with_retval(const char *ifname, char *cmd, char *ret_buf, int ret_len);
|
||||||
|
void wext_wlan_indicate(unsigned int cmd, union iwreq_data *wrqu, char *extra);
|
||||||
|
int wext_set_pscan_channel(const char *ifname, __u8 *ch, __u8 *pscan_config, __u8 length);
|
||||||
|
int wext_set_autoreconnect(const char *ifname, __u8 mode, __u8 retyr_times, __u16 timeout);
|
||||||
|
int wext_get_autoreconnect(const char *ifname, __u8 *mode);
|
||||||
|
int wext_set_adaptivity(rtw_adaptivity_mode_t adaptivity_mode);
|
||||||
|
int wext_set_adaptivity_th_l2h_ini(__u8 l2h_threshold);
|
||||||
|
int wext_get_auto_chl(const char *ifname, unsigned char *channel_set, unsigned char channel_num);
|
||||||
|
int wext_set_sta_num(unsigned char ap_sta_num);
|
||||||
|
int wext_del_station(const char *ifname, unsigned char* hwaddr);
|
||||||
|
int wext_init_mac_filter(void);
|
||||||
|
int wext_deinit_mac_filter(void);
|
||||||
|
int wext_add_mac_filter(unsigned char* hwaddr);
|
||||||
|
int wext_del_mac_filter(unsigned char* hwaddr);
|
||||||
|
int wext_set_tos_value(const char *ifname, __u8 *tos_value);
|
||||||
|
#ifdef CONFIG_CUSTOM_IE
|
||||||
|
int wext_add_custom_ie(const char *ifname, void * cus_ie, int ie_num);
|
||||||
|
int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index);
|
||||||
|
int wext_del_custom_ie(const char *ifname);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define wext_handshake_done rltk_wlan_handshake_done
|
||||||
|
|
||||||
|
int wext_send_mgnt(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
|
||||||
|
int wext_send_eapol(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
|
||||||
|
int wext_set_gen_ie(const char *ifname, char *buf, __u16 buf_len, __u16 flags);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _UTIL_H */
|
42
RTL00_SDKV35a/component/common/api/wifi_interactive_ext.h
Normal file
42
RTL00_SDKV35a/component/common/api/wifi_interactive_ext.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#define CONFIG_EXTERN_TEST 0
|
||||||
|
#define CONFIG_EXTERN_HW 0
|
||||||
|
#define CONFIG_EXTERN_CLOUD 0
|
||||||
|
#define CONFIG_TTCP 0
|
||||||
|
|
||||||
|
/* External Function */
|
||||||
|
#if CONFIG_EXTERN_TEST
|
||||||
|
extern void cmd_tcpecho(int argc, char **argv);
|
||||||
|
#endif
|
||||||
|
#if CONFIG_EXTERN_HW
|
||||||
|
extern void cmd_led(int argc, char **argv);
|
||||||
|
extern void cmd_tmp75(int argc, char **argv);
|
||||||
|
#endif
|
||||||
|
#if CONFIG_EXTERN_CLOUD
|
||||||
|
extern void cmd_cloud(int argc, char **argv);
|
||||||
|
extern void cmd_reboot(int argc, char **argv);
|
||||||
|
extern void cmd_config(int argc, char **argv);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TTCP
|
||||||
|
extern void cmd_ttcp(int argc, char **argv);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static const cmd_entry ext_cmd_table[] = {
|
||||||
|
#if CONFIG_EXTERN_TEST
|
||||||
|
{"tcpecho", cmd_tcpecho},
|
||||||
|
#endif
|
||||||
|
#if CONFIG_EXTERN_HW
|
||||||
|
{"led", cmd_led},
|
||||||
|
{"tmp75", cmd_tmp75},
|
||||||
|
#endif
|
||||||
|
#if CONFIG_EXTERN_CLOUD
|
||||||
|
{"cloud", cmd_cloud},
|
||||||
|
{"reboot", cmd_reboot},
|
||||||
|
{"config", cmd_config},
|
||||||
|
#endif
|
||||||
|
#if CONFIG_TTCP
|
||||||
|
{"ttcp", cmd_ttcp},
|
||||||
|
#endif
|
||||||
|
{"", NULL}
|
||||||
|
};
|
1246
RTL00_SDKV35a/component/common/api/wifi_interactive_mode.c
Normal file
1246
RTL00_SDKV35a/component/common/api/wifi_interactive_mode.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
File: curve25519-donna.h
|
||||||
|
Package: WACServer
|
||||||
|
Version: WACServer-1.14
|
||||||
|
|
||||||
|
Disclaimer: IMPORTANT: This Apple software is supplied to you, by Apple Inc. ("Apple"), in your
|
||||||
|
capacity as a current, and in good standing, Licensee in the MFi Licensing Program. Use of this
|
||||||
|
Apple software is governed by and subject to the terms and conditions of your MFi License,
|
||||||
|
including, but not limited to, the restrictions specified in the provision entitled ”Public
|
||||||
|
Software”, and is further subject to your agreement to the following additional terms, and your
|
||||||
|
agreement that the use, installation, modification or redistribution of this Apple software
|
||||||
|
constitutes acceptance of these additional terms. If you do not agree with these additional terms,
|
||||||
|
please do not use, install, modify or redistribute this Apple software.
|
||||||
|
|
||||||
|
Subject to all of these terms and in consideration of your agreement to abide by them, Apple grants
|
||||||
|
you, for as long as you are a current and in good-standing MFi Licensee, a personal, non-exclusive
|
||||||
|
license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use,
|
||||||
|
reproduce, and modify the Apple Software in source form, and to use, reproduce, modify, and
|
||||||
|
redistribute the Apple Software, with or without modifications, in binary form. While you may not
|
||||||
|
redistribute the Apple Software in source form, should you redistribute the Apple Software in binary
|
||||||
|
form, you must retain this notice and the following text and disclaimers in all such redistributions
|
||||||
|
of the Apple Software. Neither the name, trademarks, service marks, or logos of Apple Inc. may be
|
||||||
|
used to endorse or promote products derived from the Apple Software without specific prior written
|
||||||
|
permission from Apple. Except as expressly stated in this notice, no other rights or licenses,
|
||||||
|
express or implied, are granted by Apple herein, including but not limited to any patent rights that
|
||||||
|
may be infringed by your derivative works or by other works in which the Apple Software may be
|
||||||
|
incorporated.
|
||||||
|
|
||||||
|
Unless you explicitly state otherwise, if you provide any ideas, suggestions, recommendations, bug
|
||||||
|
fixes or enhancements to Apple in connection with this software (“Feedback”), you hereby grant to
|
||||||
|
Apple a non-exclusive, fully paid-up, perpetual, irrevocable, worldwide license to make, use,
|
||||||
|
reproduce, incorporate, modify, display, perform, sell, make or have made derivative works of,
|
||||||
|
distribute (directly or indirectly) and sublicense, such Feedback in connection with Apple products
|
||||||
|
and services. Providing this Feedback is voluntary, but if you do provide Feedback to Apple, you
|
||||||
|
acknowledge and agree that Apple may exercise the license granted above without the payment of
|
||||||
|
royalties or further consideration to Participant.
|
||||||
|
|
||||||
|
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
|
||||||
|
AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR
|
||||||
|
IN COMBINATION WITH YOUR PRODUCTS.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION
|
||||||
|
AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
|
||||||
|
(INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
Copyright (C) 2009 Apple Inc. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __curve25519_donnaDotH__
|
||||||
|
#define __curve25519_donnaDotH__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void curve25519_donna( unsigned char *outKey, const unsigned char *inSecret, const unsigned char *inBasePoint );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __curve25519_donnaDotH__
|
220
RTL00_SDKV35a/component/common/application/apple/WACServer/External/GladmanAES/rom_wac_aes.h
vendored
Normal file
220
RTL00_SDKV35a/component/common/application/apple/WACServer/External/GladmanAES/rom_wac_aes.h
vendored
Normal file
|
@ -0,0 +1,220 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved.
|
||||||
|
|
||||||
|
The redistribution and use of this software (with or without changes)
|
||||||
|
is allowed without the payment of fees or royalties provided that:
|
||||||
|
|
||||||
|
source code distributions include the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer;
|
||||||
|
|
||||||
|
binary distributions include the above copyright notice, this list
|
||||||
|
of conditions and the following disclaimer in their documentation.
|
||||||
|
|
||||||
|
This software is provided 'as is' with no explicit or implied warranties
|
||||||
|
in respect of its operation, including, but not limited to, correctness
|
||||||
|
and fitness for purpose.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Issue Date: 20/12/2007
|
||||||
|
|
||||||
|
This file contains the definitions required to use AES in C. See aesopt.h
|
||||||
|
for optimisation details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _AES_H
|
||||||
|
#define _AES_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* This include is used to find 8 & 32 bit unsigned integer types */
|
||||||
|
#include "rom_wac_brg_types.h"
|
||||||
|
|
||||||
|
/* Use AES encrypt/decrypt in wlan ROM codes */
|
||||||
|
#include "rom_aes.h"
|
||||||
|
extern int aes_set_key( aes_context *ctx, u8 *key, int nbits );
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AES_128 /* if a fast 128 bit key scheduler is needed */
|
||||||
|
#define AES_192 /* if a fast 192 bit key scheduler is needed */
|
||||||
|
#define AES_256 /* if a fast 256 bit key scheduler is needed */
|
||||||
|
#define AES_VAR /* if variable key size scheduler is needed */
|
||||||
|
#define AES_MODES /* if support is needed for modes */
|
||||||
|
|
||||||
|
/* The following must also be set in assembler files if being used */
|
||||||
|
|
||||||
|
#define AES_ENCRYPT /* if support for encryption is needed */
|
||||||
|
#define AES_DECRYPT /* if support for decryption is needed */
|
||||||
|
#define AES_REV_DKS /* define to reverse decryption key schedule */
|
||||||
|
|
||||||
|
#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */
|
||||||
|
#define N_COLS 4 /* the number of columns in the state */
|
||||||
|
|
||||||
|
/* The key schedule length is 11, 13 or 15 16-byte blocks for 128, */
|
||||||
|
/* 192 or 256-bit keys respectively. That is 176, 208 or 240 bytes */
|
||||||
|
/* or 44, 52 or 60 32-bit words. */
|
||||||
|
|
||||||
|
#if defined( AES_VAR ) || defined( AES_256 )
|
||||||
|
#define KS_LENGTH 60
|
||||||
|
#elif defined( AES_192 )
|
||||||
|
#define KS_LENGTH 52
|
||||||
|
#else
|
||||||
|
#define KS_LENGTH 44
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AES_RETURN INT_RETURN
|
||||||
|
|
||||||
|
/* the character array 'inf' in the following structures is used */
|
||||||
|
/* to hold AES context information. This AES code uses cx->inf.b[0] */
|
||||||
|
/* to hold the number of rounds multiplied by 16. The other three */
|
||||||
|
/* elements can be used by code that implements additional modes */
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{ uint_32t l;
|
||||||
|
uint_8t b[4];
|
||||||
|
} aes_inf;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
uint_32t ks[KS_LENGTH];
|
||||||
|
#else
|
||||||
|
aes_context ctx;
|
||||||
|
#endif
|
||||||
|
aes_inf inf;
|
||||||
|
} aes_encrypt_ctx;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
uint_32t ks[KS_LENGTH];
|
||||||
|
#else
|
||||||
|
aes_context ctx;
|
||||||
|
#endif
|
||||||
|
aes_inf inf;
|
||||||
|
} aes_decrypt_ctx;
|
||||||
|
|
||||||
|
/* This routine must be called before first use if non-static */
|
||||||
|
/* tables are being used */
|
||||||
|
|
||||||
|
AES_RETURN aes_init(void);
|
||||||
|
|
||||||
|
/* Key lengths in the range 16 <= key_len <= 32 are given in bytes, */
|
||||||
|
/* those in the range 128 <= key_len <= 256 are given in bits */
|
||||||
|
|
||||||
|
#if defined( AES_ENCRYPT )
|
||||||
|
|
||||||
|
#if defined( AES_128 ) || defined( AES_VAR)
|
||||||
|
AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_192 ) || defined( AES_VAR)
|
||||||
|
AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_256 ) || defined( AES_VAR)
|
||||||
|
AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_VAR )
|
||||||
|
AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]);
|
||||||
|
#else
|
||||||
|
extern void aes_encrypt( aes_context *ctx, u8 input[16], u8 output[16] );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_DECRYPT )
|
||||||
|
|
||||||
|
#if defined( AES_128 ) || defined( AES_VAR)
|
||||||
|
AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_192 ) || defined( AES_VAR)
|
||||||
|
AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_256 ) || defined( AES_VAR)
|
||||||
|
AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_VAR )
|
||||||
|
AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]);
|
||||||
|
#else
|
||||||
|
extern void aes_decrypt( aes_context *ctx, u8 input[16], u8 output[16] );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( AES_MODES )
|
||||||
|
|
||||||
|
/* Multiple calls to the following subroutines for multiple block */
|
||||||
|
/* ECB, CBC, CFB, OFB and CTR mode encryption can be used to handle */
|
||||||
|
/* long messages incremantally provided that the context AND the iv */
|
||||||
|
/* are preserved between all such calls. For the ECB and CBC modes */
|
||||||
|
/* each individual call within a series of incremental calls must */
|
||||||
|
/* process only full blocks (i.e. len must be a multiple of 16) but */
|
||||||
|
/* the CFB, OFB and CTR mode calls can handle multiple incremental */
|
||||||
|
/* calls of any length. Each mode is reset when a new AES key is */
|
||||||
|
/* set but ECB and CBC operations can be reset without setting a */
|
||||||
|
/* new key by setting a new IV value. To reset CFB, OFB and CTR */
|
||||||
|
/* without setting the key, aes_mode_reset() must be called and the */
|
||||||
|
/* IV must be set. NOTE: All these calls update the IV on exit so */
|
||||||
|
/* this has to be reset if a new operation with the same IV as the */
|
||||||
|
/* previous one is required (or decryption follows encryption with */
|
||||||
|
/* the same IV array). */
|
||||||
|
|
||||||
|
AES_RETURN aes_test_alignment_detection(unsigned int n);
|
||||||
|
|
||||||
|
AES_RETURN aes_ecb_encrypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, const aes_encrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
AES_RETURN aes_ecb_decrypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, const aes_decrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
AES_RETURN aes_cbc_encrypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, unsigned char *iv, const aes_encrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
AES_RETURN aes_cbc_decrypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, unsigned char *iv, const aes_decrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
AES_RETURN aes_mode_reset(aes_encrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
AES_RETURN aes_cfb_encrypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, unsigned char *iv, aes_encrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
AES_RETURN aes_cfb_decrypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, unsigned char *iv, aes_encrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
#define aes_ofb_encrypt aes_ofb_crypt
|
||||||
|
#define aes_ofb_decrypt aes_ofb_crypt
|
||||||
|
|
||||||
|
AES_RETURN aes_ofb_crypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, unsigned char *iv, aes_encrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
typedef void cbuf_inc(unsigned char *cbuf);
|
||||||
|
|
||||||
|
#define aes_ctr_encrypt aes_ctr_crypt
|
||||||
|
#define aes_ctr_decrypt aes_ctr_crypt
|
||||||
|
|
||||||
|
AES_RETURN aes_ctr_crypt(const unsigned char *ibuf, unsigned char *obuf,
|
||||||
|
int len, unsigned char *cbuf, cbuf_inc ctr_inc, aes_encrypt_ctx cx[1]);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
229
RTL00_SDKV35a/component/common/application/apple/WACServer/External/GladmanAES/rom_wac_brg_types.h
vendored
Normal file
229
RTL00_SDKV35a/component/common/application/apple/WACServer/External/GladmanAES/rom_wac_brg_types.h
vendored
Normal file
|
@ -0,0 +1,229 @@
|
||||||
|
/*
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved.
|
||||||
|
|
||||||
|
The redistribution and use of this software (with or without changes)
|
||||||
|
is allowed without the payment of fees or royalties provided that:
|
||||||
|
|
||||||
|
source code distributions include the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer;
|
||||||
|
|
||||||
|
binary distributions include the above copyright notice, this list
|
||||||
|
of conditions and the following disclaimer in their documentation.
|
||||||
|
|
||||||
|
This software is provided 'as is' with no explicit or implied warranties
|
||||||
|
in respect of its operation, including, but not limited to, correctness
|
||||||
|
and fitness for purpose.
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
Issue Date: 20/12/2007
|
||||||
|
|
||||||
|
The unsigned integer types defined here are of the form uint_<nn>t where
|
||||||
|
<nn> is the length of the type; for example, the unsigned 32-bit type is
|
||||||
|
'uint_32t'. These are NOT the same as the 'C99 integer types' that are
|
||||||
|
defined in the inttypes.h and stdint.h headers since attempts to use these
|
||||||
|
types have shown that support for them is still highly variable. However,
|
||||||
|
since the latter are of the form uint<nn>_t, a regular expression search
|
||||||
|
and replace (in VC++ search on 'uint_{:z}t' and replace with 'uint\1_t')
|
||||||
|
can be used to convert the types used here to the C99 standard types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BRG_TYPES_H
|
||||||
|
#define _BRG_TYPES_H
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#if 0
|
||||||
|
#if defined( _MSC_VER ) && ( _MSC_VER >= 1300 )
|
||||||
|
# include <stddef.h>
|
||||||
|
# define ptrint_t intptr_t
|
||||||
|
#elif defined( __ECOS__ )
|
||||||
|
# define intptr_t unsigned int
|
||||||
|
# define ptrint_t intptr_t
|
||||||
|
#elif defined( __GNUC__ ) && ( __GNUC__ >= 3 )
|
||||||
|
# include <stdint.h>
|
||||||
|
# define ptrint_t intptr_t
|
||||||
|
#else
|
||||||
|
# define ptrint_t int
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
# include <stdint.h>
|
||||||
|
# define ptrint_t intptr_t
|
||||||
|
#ifndef u8
|
||||||
|
typedef uint8_t u8;
|
||||||
|
#endif
|
||||||
|
#ifndef u32
|
||||||
|
typedef uint32_t u32;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BRG_UI8
|
||||||
|
# define BRG_UI8
|
||||||
|
# if UCHAR_MAX == 255u
|
||||||
|
typedef unsigned char uint_8t;
|
||||||
|
# else
|
||||||
|
# error Please define uint_8t as an 8-bit unsigned integer type in brg_types.h
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BRG_UI16
|
||||||
|
# define BRG_UI16
|
||||||
|
# if USHRT_MAX == 65535u
|
||||||
|
typedef unsigned short uint_16t;
|
||||||
|
# else
|
||||||
|
# error Please define uint_16t as a 16-bit unsigned short type in brg_types.h
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BRG_UI32
|
||||||
|
# define BRG_UI32
|
||||||
|
# if UINT_MAX == 4294967295u
|
||||||
|
# define li_32(h) 0x##h##u
|
||||||
|
typedef unsigned int uint_32t;
|
||||||
|
# elif ULONG_MAX == 4294967295u
|
||||||
|
# define li_32(h) 0x##h##ul
|
||||||
|
typedef unsigned long uint_32t;
|
||||||
|
# elif defined( _CRAY )
|
||||||
|
# error This code needs 32-bit data types, which Cray machines do not provide
|
||||||
|
# else
|
||||||
|
# error Please define uint_32t as a 32-bit unsigned integer type in brg_types.h
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BRG_UI64
|
||||||
|
# if defined( __BORLANDC__ ) && !defined( __MSDOS__ )
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##ui64
|
||||||
|
typedef unsigned __int64 uint_64t;
|
||||||
|
# elif defined( _MSC_VER ) && ( _MSC_VER < 1300 ) /* 1300 == VC++ 7.0 */
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##ui64
|
||||||
|
typedef unsigned __int64 uint_64t;
|
||||||
|
# elif defined( __sun ) && defined( ULONG_MAX ) && ULONG_MAX == 0xfffffffful
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##ull
|
||||||
|
typedef unsigned long long uint_64t;
|
||||||
|
# elif defined( __MVS__ )
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##ull
|
||||||
|
typedef unsigned int long long uint_64t;
|
||||||
|
# elif defined( UINT_MAX ) && UINT_MAX > 4294967295u
|
||||||
|
# if UINT_MAX == 18446744073709551615u
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##u
|
||||||
|
typedef unsigned int uint_64t;
|
||||||
|
# endif
|
||||||
|
# elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u
|
||||||
|
# if ULONG_MAX == 18446744073709551615ul
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##ul
|
||||||
|
typedef unsigned long uint_64t;
|
||||||
|
# endif
|
||||||
|
# elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u
|
||||||
|
# if ULLONG_MAX == 18446744073709551615ull
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##ull
|
||||||
|
typedef unsigned long long uint_64t;
|
||||||
|
# endif
|
||||||
|
# elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u
|
||||||
|
# if ULONG_LONG_MAX == 18446744073709551615ull
|
||||||
|
# define BRG_UI64
|
||||||
|
# define li_64(h) 0x##h##ull
|
||||||
|
typedef unsigned long long uint_64t;
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( BRG_UI64 )
|
||||||
|
# if defined( NEED_UINT_64T )
|
||||||
|
# error Please define uint_64t as an unsigned 64 bit type in brg_types.h
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RETURN_VALUES
|
||||||
|
# define RETURN_VALUES
|
||||||
|
# if defined( DLL_EXPORT )
|
||||||
|
# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
|
||||||
|
# define VOID_RETURN __declspec( dllexport ) void __stdcall
|
||||||
|
# define INT_RETURN __declspec( dllexport ) int __stdcall
|
||||||
|
# elif defined( __GNUC__ )
|
||||||
|
# define VOID_RETURN __declspec( __dllexport__ ) void
|
||||||
|
# define INT_RETURN __declspec( __dllexport__ ) int
|
||||||
|
# else
|
||||||
|
# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
|
||||||
|
# endif
|
||||||
|
# elif defined( DLL_IMPORT )
|
||||||
|
# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
|
||||||
|
# define VOID_RETURN __declspec( dllimport ) void __stdcall
|
||||||
|
# define INT_RETURN __declspec( dllimport ) int __stdcall
|
||||||
|
# elif defined( __GNUC__ )
|
||||||
|
# define VOID_RETURN __declspec( __dllimport__ ) void
|
||||||
|
# define INT_RETURN __declspec( __dllimport__ ) int
|
||||||
|
# else
|
||||||
|
# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
|
||||||
|
# endif
|
||||||
|
# elif defined( __WATCOMC__ )
|
||||||
|
# define VOID_RETURN void __cdecl
|
||||||
|
# define INT_RETURN int __cdecl
|
||||||
|
# else
|
||||||
|
# define VOID_RETURN void
|
||||||
|
# define INT_RETURN int
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These defines are used to detect and set the memory alignment of pointers.
|
||||||
|
Note that offsets are in bytes.
|
||||||
|
|
||||||
|
ALIGN_OFFSET(x,n) return the positive or zero offset of
|
||||||
|
the memory addressed by the pointer 'x'
|
||||||
|
from an address that is aligned on an
|
||||||
|
'n' byte boundary ('n' is a power of 2)
|
||||||
|
|
||||||
|
ALIGN_FLOOR(x,n) return a pointer that points to memory
|
||||||
|
that is aligned on an 'n' byte boundary
|
||||||
|
and is not higher than the memory address
|
||||||
|
pointed to by 'x' ('n' is a power of 2)
|
||||||
|
|
||||||
|
ALIGN_CEIL(x,n) return a pointer that points to memory
|
||||||
|
that is aligned on an 'n' byte boundary
|
||||||
|
and is not lower than the memory address
|
||||||
|
pointed to by 'x' ('n' is a power of 2)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define ALIGN_OFFSET(x,n) (((ptrint_t)(x)) & ((n) - 1))
|
||||||
|
#define ALIGN_FLOOR(x,n) ((uint_8t*)(x) - ( ((ptrint_t)(x)) & ((n) - 1)))
|
||||||
|
#define ALIGN_CEIL(x,n) ((uint_8t*)(x) + (-((ptrint_t)(x)) & ((n) - 1)))
|
||||||
|
|
||||||
|
/* These defines are used to declare buffers in a way that allows
|
||||||
|
faster operations on longer variables to be used. In all these
|
||||||
|
defines 'size' must be a power of 2 and >= 8. NOTE that the
|
||||||
|
buffer size is in bytes but the type length is in bits
|
||||||
|
|
||||||
|
UNIT_TYPEDEF(x,size) declares a variable 'x' of length
|
||||||
|
'size' bits
|
||||||
|
|
||||||
|
BUFR_TYPEDEF(x,size,bsize) declares a buffer 'x' of length 'bsize'
|
||||||
|
bytes defined as an array of variables
|
||||||
|
each of 'size' bits (bsize must be a
|
||||||
|
multiple of size / 8)
|
||||||
|
|
||||||
|
UNIT_CAST(x,size) casts a variable to a type of
|
||||||
|
length 'size' bits
|
||||||
|
|
||||||
|
UPTR_CAST(x,size) casts a pointer to a pointer to a
|
||||||
|
varaiable of length 'size' bits
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define UI_TYPE(size) uint_##size##t
|
||||||
|
#define UNIT_TYPEDEF(x,size) typedef UI_TYPE(size) x
|
||||||
|
#define BUFR_TYPEDEF(x,size,bsize) typedef UI_TYPE(size) x[bsize / (size >> 3)]
|
||||||
|
#define UNIT_CAST(x,size) ((UI_TYPE(size) )(x))
|
||||||
|
#define UPTR_CAST(x,size) ((UI_TYPE(size)*)(x))
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef GOOGLENEST_H
|
||||||
|
#define GOOGLENEST_H
|
||||||
|
|
||||||
|
#include <polarssl/ssl.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int socket;
|
||||||
|
char *host;
|
||||||
|
ssl_context ssl;
|
||||||
|
} googlenest_context;
|
||||||
|
|
||||||
|
int gn_connect(googlenest_context *googlenest, char *host, int port);
|
||||||
|
void gn_close(googlenest_context *googlenest);
|
||||||
|
int gn_put(googlenest_context *googlenest, char *uri, char *content);
|
||||||
|
int gn_patch(googlenest_context *googlenest, char *uri, char *content);
|
||||||
|
int gn_post(googlenest_context *googlenest, char *uri, char *content, unsigned char *out_buffer, size_t out_len);
|
||||||
|
int gn_get(googlenest_context *googlenest, char *uri, unsigned char *out_buffer, size_t out_len);
|
||||||
|
int gn_delete(googlenest_context *googlenest, char *uri);
|
||||||
|
int gn_stream(googlenest_context *googlenest, char *uri);
|
||||||
|
void google_retrieve_data_hook_callback(void (*callback)(char *));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,272 @@
|
||||||
|
#include "osdep_api.h"
|
||||||
|
#include "serial_api.h"
|
||||||
|
#include <timer_api.h>
|
||||||
|
#include "freertos_pmu.h"
|
||||||
|
#include <mDNS/mDNS.h>
|
||||||
|
|
||||||
|
#if CONFIG_UART_SOCKET
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Macros
|
||||||
|
******************************************************/
|
||||||
|
#define UA_ERROR 0
|
||||||
|
#define UA_WARNING 1
|
||||||
|
#define UA_INFO 2
|
||||||
|
#define UA_DEBUG 2 //pvvx! было 3
|
||||||
|
#define UA_NONE 0xFF
|
||||||
|
#define UA_DEBUG_LEVEL UA_INFO
|
||||||
|
|
||||||
|
#define UA_UART_THREAD_PRIORITY 5
|
||||||
|
#define UA_UART_THREAD_STACKSIZE 512
|
||||||
|
|
||||||
|
#define UA_TCP_SERVER_FD_NUM 1
|
||||||
|
#define UA_TCP_CLIENT_FD_NUM 1
|
||||||
|
|
||||||
|
#define UA_UART_RECV_BUFFER_LEN 8196
|
||||||
|
#define UA_UART_FRAME_LEN 1400
|
||||||
|
#define UA_UART_MAX_DELAY_TIME 100
|
||||||
|
|
||||||
|
#define UA_CHAT_SOCKET_PORT 5001
|
||||||
|
#define UA_CONTROL_SOCKET_PORT 6001
|
||||||
|
|
||||||
|
#define UA_UART_TX_PIN PA_4
|
||||||
|
#define UA_UART_RX_PIN PA_0
|
||||||
|
#define UA_UART_RTS_PIN PA_2
|
||||||
|
#define UA_UART_CTS_PIN PA_1
|
||||||
|
|
||||||
|
#define UA_GPIO_LED_PIN PC_5
|
||||||
|
#define UA_GPIO_IRQ_PIN PC_4
|
||||||
|
|
||||||
|
#define UA_CONTROL_PREFIX "AMEBA_UART"
|
||||||
|
|
||||||
|
#define UA_PS_ENABLE 0
|
||||||
|
#define UA_GPIO_WAKEUP_PIN PC_3
|
||||||
|
#define UA_WAKELOCK WAKELOCK_USER_BASE
|
||||||
|
|
||||||
|
#define UA_FAST_RECONNECT_TCP_DATA (0x80000 - 0x2000)
|
||||||
|
|
||||||
|
|
||||||
|
#if (UA_DEBUG_LEVEL== UA_NONE)
|
||||||
|
#define ua_printf(level, fmt, arg...)
|
||||||
|
#else
|
||||||
|
#define ua_printf(level, fmt, arg...) \
|
||||||
|
do {\
|
||||||
|
if (level <= UA_DEBUG_LEVEL) {\
|
||||||
|
if (level <= UA_ERROR) {\
|
||||||
|
RtlDownSema(&ua_print_sema);\
|
||||||
|
printf("\r\nERROR: " fmt, ##arg);\
|
||||||
|
RtlUpSema(&ua_print_sema);\
|
||||||
|
} \
|
||||||
|
else {\
|
||||||
|
RtlDownSema(&ua_print_sema);\
|
||||||
|
printf("\r\n"fmt, ##arg);\
|
||||||
|
RtlUpSema(&ua_print_sema);\
|
||||||
|
} \
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UA_PRINT_DATA(_HexData, _HexDataLen) \
|
||||||
|
if(UA_DEBUG_LEVEL == UA_DEBUG) \
|
||||||
|
{ \
|
||||||
|
int __i; \
|
||||||
|
u8 *ptr = (u8 *)_HexData; \
|
||||||
|
printf("--------Len=%d\n\r", _HexDataLen); \
|
||||||
|
for( __i=0; __i<(int)_HexDataLen; __i++ ) \
|
||||||
|
{ \
|
||||||
|
printf("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \
|
||||||
|
if (((__i + 1) % 16) == 0) printf("\n\r"); \
|
||||||
|
} \
|
||||||
|
printf("\n\r"); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define UA_SOCKET_CHECK(_ua_socket) \
|
||||||
|
if(_ua_socket == NULL) \
|
||||||
|
{ \
|
||||||
|
printf("ERROR: ua_socket = NULL\n\r"); \
|
||||||
|
return; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define UA_SOCKET_CHECK_2(_ua_socket) \
|
||||||
|
if(_ua_socket == NULL) \
|
||||||
|
{ \
|
||||||
|
printf("ERROR: ua_socket = NULL\n\r"); \
|
||||||
|
return -1; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Constants
|
||||||
|
******************************************************/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
UART_ADAPTER_LED_ON = 0,
|
||||||
|
UART_ADAPTER_LED_OFF = 1,
|
||||||
|
UART_ADAPTER_LED_FAST_TWINKLE = 2,
|
||||||
|
UART_ADAPTER_LED_SLOW_TWINKLE = 3,
|
||||||
|
}ua_led_mode_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
UART_CTRL_MODE_SET_REQ = 0,
|
||||||
|
UART_CTRL_MODE_SET_RSP = 1,
|
||||||
|
UART_CTRL_MODE_GET_REQ = 2,
|
||||||
|
UART_CTRL_MODE_GET_RSP = 3,
|
||||||
|
}ua_ctrl_mode_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
UART_CTRL_TYPE_BAUD_RATE = 0x01,
|
||||||
|
UART_CTRL_TYPE_WORD_LEN = 0x02,
|
||||||
|
UART_CTRL_TYPE_PARITY = 0x04,
|
||||||
|
UART_CTRL_TYPE_STOP_BIT = 0x08,
|
||||||
|
UART_CTRL_TYPE_TCP_SERVER_CREATE = 0x10,
|
||||||
|
UART_CTRL_TYPE_TCP_SERVER_DELETE = 0x20,
|
||||||
|
UART_CTRL_TYPE_TCP_CLIENT_CONNECT = 0x40,
|
||||||
|
UART_CTRL_TYPE_TCP_CLIENT_DISCONNECT = 0x80,
|
||||||
|
UART_CTRL_TYPE_TCP_GROUP_ID = 0x100,
|
||||||
|
}ua_ctrl_type_t;
|
||||||
|
|
||||||
|
enum sc_result {
|
||||||
|
SC_ERROR = -1, /* default error code*/
|
||||||
|
SC_NO_CONTROLLER_FOUND = 1, /* cannot get sta(controller) in the air which starts a simple config session */
|
||||||
|
SC_CONTROLLER_INFO_PARSE_FAIL, /* cannot parse the sta's info */
|
||||||
|
SC_TARGET_CHANNEL_SCAN_FAIL, /* cannot scan the target channel */
|
||||||
|
SC_JOIN_BSS_FAIL, /* fail to connect to target ap */
|
||||||
|
SC_DHCP_FAIL, /* fail to get ip address from target ap */
|
||||||
|
/* fail to create udp socket to send info to controller. note that client isolation
|
||||||
|
must be turned off in ap. we cannot know if ap has configured this */
|
||||||
|
SC_UDP_SOCKET_CREATE_FAIL,
|
||||||
|
SC_SUCCESS, /* default success code */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************
|
||||||
|
* Structures
|
||||||
|
******************************************************/
|
||||||
|
typedef struct _ua_uart_param_t
|
||||||
|
{
|
||||||
|
u8 WordLen;
|
||||||
|
u8 Parity;
|
||||||
|
u8 StopBit;
|
||||||
|
u8 FlowControl;
|
||||||
|
int BaudRate;
|
||||||
|
}ua_uart_param_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _ua_uart_socket_t
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
char rcv_ch;
|
||||||
|
volatile char overlap;
|
||||||
|
int recv_bytes;
|
||||||
|
volatile int pread;
|
||||||
|
volatile int pwrite;
|
||||||
|
|
||||||
|
volatile unsigned int tick_last_update;
|
||||||
|
unsigned int tick_current;
|
||||||
|
|
||||||
|
volatile int tx_busy;
|
||||||
|
|
||||||
|
volatile int uart_ps;
|
||||||
|
volatile int uart_ps_cnt;
|
||||||
|
|
||||||
|
char recv_buf[UA_UART_RECV_BUFFER_LEN];
|
||||||
|
|
||||||
|
long rx_cnt;
|
||||||
|
long miss_cnt;
|
||||||
|
|
||||||
|
serial_t uart_sobj;
|
||||||
|
ua_uart_param_t uart_param;
|
||||||
|
|
||||||
|
_Sema action_sema;
|
||||||
|
_Sema tcp_tx_rx_sema;
|
||||||
|
_Sema dma_tx;
|
||||||
|
}ua_uart_socket_t;
|
||||||
|
|
||||||
|
typedef struct _ua_tcp_socket_t
|
||||||
|
{
|
||||||
|
int chat_socket;
|
||||||
|
int control_socket;
|
||||||
|
int chat_server_listen_socket;
|
||||||
|
int control_server_listen_socket;
|
||||||
|
|
||||||
|
int transmit_recv_socket;
|
||||||
|
int transmit_send_socket;
|
||||||
|
int transmit_server_listen_socket;
|
||||||
|
|
||||||
|
int group_id;
|
||||||
|
u32 server_port;
|
||||||
|
u32 client_port;
|
||||||
|
char client_ip[16];
|
||||||
|
|
||||||
|
|
||||||
|
int send_flag;
|
||||||
|
int recv_flag;
|
||||||
|
long rx_cnt;
|
||||||
|
long tx_cnt;
|
||||||
|
|
||||||
|
volatile int tcp_ps;
|
||||||
|
volatile int tcp_ps_cnt;
|
||||||
|
}ua_tcp_socket_t;
|
||||||
|
|
||||||
|
typedef struct _ua_gpio_t
|
||||||
|
{
|
||||||
|
gpio_t gpio_led;
|
||||||
|
gpio_t gpio_btn;
|
||||||
|
gpio_irq_t gpio_btn_irq;
|
||||||
|
gtimer_t gpio_timer;
|
||||||
|
}ua_gpio_t;
|
||||||
|
|
||||||
|
typedef struct _ua_socket_t
|
||||||
|
{
|
||||||
|
ua_uart_socket_t uart;
|
||||||
|
ua_tcp_socket_t tcp;
|
||||||
|
ua_gpio_t gpio;
|
||||||
|
ip_addr_t ip;
|
||||||
|
DNSServiceRef dnsServiceRef;
|
||||||
|
DNSServiceRef dnsServiceRef2;
|
||||||
|
}ua_socket_t;
|
||||||
|
|
||||||
|
typedef struct _ua_mbox_buffer
|
||||||
|
{
|
||||||
|
char data[UA_UART_FRAME_LEN];
|
||||||
|
int data_len;
|
||||||
|
}ua_mbox_buffer_t;
|
||||||
|
|
||||||
|
//Save Uart Settings when get uart information
|
||||||
|
typedef struct _ua_uart_get_str
|
||||||
|
{
|
||||||
|
int BaudRate; //The baud rate
|
||||||
|
char number; //The number of data bits
|
||||||
|
char parity; //The parity(0: none, 1:odd, 2:evn, default:0)
|
||||||
|
char StopBits; //The number of stop bits
|
||||||
|
char FlowControl; //support flow control is 1
|
||||||
|
}ua_uart_get_str;
|
||||||
|
|
||||||
|
//Uart Setting information
|
||||||
|
typedef struct _ua_uart_set_str
|
||||||
|
{
|
||||||
|
char UartName[8]; // the name of uart
|
||||||
|
int BaudRate; //The baud rate
|
||||||
|
char number; //The number of data bits
|
||||||
|
char parity; //The parity(default NONE)
|
||||||
|
char StopBits; //The number of stop bits
|
||||||
|
char FlowControl; //support flow control is 1
|
||||||
|
}ua_uart_set_str;
|
||||||
|
|
||||||
|
|
||||||
|
int uartadapter_init();
|
||||||
|
void uartadapter_tcp_send_data(ua_socket_t *ua_socket, char *buffer, int size);
|
||||||
|
void uartadapter_tcp_send_control(ua_socket_t *ua_socket, char *buffer, int size);
|
||||||
|
void uartadapter_tcp_transmit_server_thread(void *param);
|
||||||
|
void uartadapter_tcp_transmit_client_thread(void *param);
|
||||||
|
int uartadapter_tcpclient(ua_socket_t *ua_socket, const char *host_ip, unsigned short usPort);
|
||||||
|
void uartadapter_tcp_transmit_client_forever_thread(void *param);
|
||||||
|
|
||||||
|
|
||||||
|
void example_uart_adapter_init();
|
||||||
|
void cmd_uart_adapter(int argc, char **argv);
|
||||||
|
|
||||||
|
void uartadapter_tcp_transmit_socket_handler(ua_socket_t *ua_socket, char *tcp_rxbuf);
|
||||||
|
|
||||||
|
#endif // CONFIG_UART_SOCKET
|
|
@ -0,0 +1,83 @@
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "wifi_conf.h"
|
||||||
|
#include "wifi_ind.h"
|
||||||
|
#include "google_nest.h"
|
||||||
|
#include "flash_api.h"
|
||||||
|
#include "wigadget.h"
|
||||||
|
#include <lwip/netif.h>
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
#include "shtc1.h"
|
||||||
|
|
||||||
|
#define CLOUD_PORT 443
|
||||||
|
extern struct netif xnetif[NET_IF_NUM];
|
||||||
|
|
||||||
|
void cloud_link_task(void *param){
|
||||||
|
googlenest_context googlenest;
|
||||||
|
unsigned char URI[64];
|
||||||
|
unsigned char data[97] = {0};
|
||||||
|
unsigned char host_addr[64] = {0};
|
||||||
|
flash_t cloud_flash;
|
||||||
|
u8 *mac = (u8 *)LwIP_GetMAC(&xnetif[0]);
|
||||||
|
char i[16], j[16];
|
||||||
|
float temperature = 1.123f;
|
||||||
|
float humidity = 2.456f;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
vTaskDelay(2000);
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(URI, "ht_sensor/%02x%02x%02x%02x%02x%02x.json", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
|
||||||
|
memset(host_addr, 0, sizeof(host_addr));
|
||||||
|
if(flash_stream_read(&cloud_flash, FLASH_IOT_DATA, 97, (uint8_t *) data) == 1){
|
||||||
|
|
||||||
|
memset(host_addr, 0 , 64);
|
||||||
|
memcpy(host_addr, data+33, 64);
|
||||||
|
while(1) {
|
||||||
|
printf("\n=====>START CLOUD LINKING\n");
|
||||||
|
memset(i, 0, 16);
|
||||||
|
memset(j, 0, 16);
|
||||||
|
#if PSEUDO_DATA
|
||||||
|
sprintf(i,"%.2f", temperature++);
|
||||||
|
sprintf(j, "%.2f", humidity++);
|
||||||
|
if(temperature > 60)
|
||||||
|
temperature = 1.123f;
|
||||||
|
if(humidity > 98)
|
||||||
|
humidity = 2.456f;
|
||||||
|
#else
|
||||||
|
ret = SHTC_GetTempAndHumi(&temperature, &humidity);
|
||||||
|
sprintf(i,"%.2f", temperature);
|
||||||
|
sprintf(j, "%.2f", humidity);
|
||||||
|
#endif
|
||||||
|
if(ret < 0)
|
||||||
|
printf("\n<-----LOCAL LINK FAILED!!(get infor failed)\n");
|
||||||
|
else{
|
||||||
|
gen_json_data(i,j, data);
|
||||||
|
printf("\nCLOUD-LINK--Sending data : \n%s\n", data);
|
||||||
|
memset(&googlenest, 0, sizeof(googlenest_context));
|
||||||
|
if(gn_connect(&googlenest, host_addr, CLOUD_PORT) == 0) {
|
||||||
|
if(gn_put(&googlenest, URI, data) != 0)
|
||||||
|
printf("PUT data failed!\n");
|
||||||
|
gn_close(&googlenest);
|
||||||
|
printf("\n<=====CLOUD LINK OK!!\n");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
printf("\n<=====CLOUD LINK FAILED!!(google nest connecting)\n");
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
vTaskDelay(10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("\n<=====CLOUD LINK FAILED!!(flash reading)\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void start_cloud_link(void)
|
||||||
|
{
|
||||||
|
if(xTaskCreate(cloud_link_task, ((const char*)"cloud_link_task"), 3584, NULL, tskIDLE_PRIORITY + 4, NULL) != pdPASS)
|
||||||
|
printf("%s xTaskCreate failed\n", __FUNCTION__);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef CLOUD_LINK_H
|
||||||
|
#define CLOUD_LINK_THREAD_H
|
||||||
|
|
||||||
|
#include "wigadget.h"
|
||||||
|
|
||||||
|
void start_cloud_link(void);
|
||||||
|
void cloud_link_task(void *param);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
186
RTL00_SDKV35a/component/common/application/wigadget/shtc1.c
Normal file
186
RTL00_SDKV35a/component/common/application/wigadget/shtc1.c
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
#include "device.h"
|
||||||
|
#include "PinNames.h"
|
||||||
|
#include "osdep_api.h"
|
||||||
|
#include "i2c_api.h"
|
||||||
|
#include "pinmap.h"
|
||||||
|
#include "shtc1.h"
|
||||||
|
#include "platform_stdlib.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2C_EN
|
||||||
|
|
||||||
|
#define MBED_I2C_MTR_SDA PB_3
|
||||||
|
#define MBED_I2C_MTR_SCL PB_2
|
||||||
|
|
||||||
|
#define MBED_I2C_SLAVE_ADDR0 0x70
|
||||||
|
#define POLYNOMIAL 0x131 // P(x) = x^8 + x^5 + x^4 + 1 = 100110001
|
||||||
|
|
||||||
|
#define MBED_I2C_BUS_CLK 100000 //hz
|
||||||
|
#define I2C_DATA_MAX_LENGTH 16
|
||||||
|
|
||||||
|
static uint8_t i2cdata_write[I2C_DATA_MAX_LENGTH];
|
||||||
|
static uint8_t i2cdata_read[I2C_DATA_MAX_LENGTH];
|
||||||
|
static int i2cdata_read_pos;
|
||||||
|
|
||||||
|
static i2c_t i2cmaster;
|
||||||
|
|
||||||
|
// Sensor Commands
|
||||||
|
#define READ_ID 0xEFC8 // command: read ID register
|
||||||
|
#define SOFT_RESET 0x805D // soft resetSample Code for SHTC1
|
||||||
|
#define MEAS_T_RH_POLLING 0x7866 // meas. read T first, clock stretching disabled
|
||||||
|
#define MEAS_T_RH_CLOCKSTR 0x7CA2 // meas. read T first, clock stretching enabled
|
||||||
|
#define MEAS_RH_T_POLLING 0x58E0 // meas. read RH first, clock stretching disabled
|
||||||
|
#define MEAS_RH_T_CLOCKSTR 0x5C24 // meas. read RH first, clock stretching enabled
|
||||||
|
|
||||||
|
|
||||||
|
static int SHTC1_GetID(uint16_t *id);
|
||||||
|
static void SHTC1_WriteCommand(uint16_t cmd);
|
||||||
|
static int SHTC1_Read2BytesAndCrc(uint16_t *data);
|
||||||
|
static int SHTC1_CheckCrc(uint8_t data[], uint8_t nbrOfBytes, uint8_t checksum);
|
||||||
|
static float SHTC1_CalcTemperature(uint16_t rawValue);
|
||||||
|
static float SHTC1_CalcHumidity(uint16_t rawValue);
|
||||||
|
|
||||||
|
|
||||||
|
int SHTC_Init(uint16_t *pID)
|
||||||
|
{
|
||||||
|
int error = NO_ERROR;
|
||||||
|
|
||||||
|
DiagPrintf("SHTC1_Init\n");
|
||||||
|
|
||||||
|
i2c_init((i2c_t*)&i2cmaster, MBED_I2C_MTR_SDA ,MBED_I2C_MTR_SCL);
|
||||||
|
i2c_frequency((i2c_t*)&i2cmaster,MBED_I2C_BUS_CLK);
|
||||||
|
|
||||||
|
if (pID == NULL )
|
||||||
|
return NULL_ERROR;
|
||||||
|
error = SHTC1_GetID(pID);
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SHTC1_GetID(uint16_t *id)
|
||||||
|
{
|
||||||
|
int error = NO_ERROR;
|
||||||
|
uint8_t bytes[2];
|
||||||
|
uint8_t checksum;
|
||||||
|
|
||||||
|
SHTC1_WriteCommand(READ_ID);
|
||||||
|
|
||||||
|
i2c_read((i2c_t*)&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[0], 3, 1);
|
||||||
|
i2cdata_read_pos = 0;
|
||||||
|
error = SHTC1_Read2BytesAndCrc(id);
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SHTC1_Read2BytesAndCrc(uint16_t *data)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
int readed;
|
||||||
|
uint8_t bytes[2];
|
||||||
|
uint8_t checksum;
|
||||||
|
|
||||||
|
bytes[0] = i2cdata_read[i2cdata_read_pos++];
|
||||||
|
bytes[1] = i2cdata_read[i2cdata_read_pos++];
|
||||||
|
checksum = i2cdata_read[i2cdata_read_pos++];
|
||||||
|
|
||||||
|
error = SHTC1_CheckCrc(bytes, 2, checksum);
|
||||||
|
*data = (bytes[0] << 8) | bytes[1];
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int SHTC1_CheckCrc(uint8_t data[], uint8_t nbrOfBytes, uint8_t checksum)
|
||||||
|
{
|
||||||
|
uint8_t bit; // bit mask
|
||||||
|
uint8_t crc = 0xFF; // calculated checksum
|
||||||
|
uint8_t byteCtr; // byte counter
|
||||||
|
|
||||||
|
for(byteCtr = 0; byteCtr < nbrOfBytes; byteCtr++){
|
||||||
|
crc ^= (data[byteCtr]);
|
||||||
|
for(bit = 8; bit > 0; --bit){
|
||||||
|
if(crc & 0x80)
|
||||||
|
crc = (crc << 1) ^ POLYNOMIAL;
|
||||||
|
else
|
||||||
|
crc = (crc << 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(crc != checksum)
|
||||||
|
return CHECKSUM_ERROR;
|
||||||
|
else
|
||||||
|
return NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SHTC1_WriteCommand(uint16_t cmd)
|
||||||
|
{
|
||||||
|
int writebytes;
|
||||||
|
|
||||||
|
i2cdata_write[0] = (uint8_t)(cmd >>8);
|
||||||
|
i2cdata_write[1] = (uint8_t)(cmd&0xFF);
|
||||||
|
i2c_write((i2c_t*)&i2cmaster, MBED_I2C_SLAVE_ADDR0, &i2cdata_write[0], 2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static float SHTC1_CalcTemperature(uint16_t rawValue)
|
||||||
|
{
|
||||||
|
return 175.0 * (float)rawValue / 65536.0 - 45.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float SHTC1_CalcHumidity(uint16_t rawValue)
|
||||||
|
{
|
||||||
|
return 100.0 * (float)rawValue / 65536.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SHTC_GetTempAndHumi(float *temp, float *humi)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
uint16_t rawValueTemp;
|
||||||
|
uint16_t rawValueHumi;
|
||||||
|
|
||||||
|
SHTC1_WriteCommand(MEAS_T_RH_CLOCKSTR);
|
||||||
|
|
||||||
|
i2c_read((i2c_t*)&i2cmaster, MBED_I2C_SLAVE_ADDR0, (char*)&i2cdata_read[0], 6, 1);
|
||||||
|
i2cdata_read_pos = 0;
|
||||||
|
error = NO_ERROR;
|
||||||
|
error |= SHTC1_Read2BytesAndCrc(&rawValueTemp);
|
||||||
|
error |= SHTC1_Read2BytesAndCrc(&rawValueHumi);
|
||||||
|
|
||||||
|
if ( error == NO_ERROR ) {
|
||||||
|
*temp = SHTC1_CalcTemperature(rawValueTemp);
|
||||||
|
*humi = SHTC1_CalcHumidity(rawValueHumi);
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void example_shtc1_thread(void *param)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
uint16_t shtc1_id;
|
||||||
|
float temperature = 1.123f;
|
||||||
|
float humidity = 2.456f;
|
||||||
|
|
||||||
|
DBG_8195A("sleep 10 sec. to wait for UART console\n");
|
||||||
|
RtlMsleepOS(10000);
|
||||||
|
DBG_8195A("start i2c example - SHTC1\n");
|
||||||
|
|
||||||
|
error = SHTC_Init(&shtc1_id);
|
||||||
|
if ( error == NO_ERROR )
|
||||||
|
DiagPrintf("SHTC1 init ok, id=0x%x\n", shtc1_id);
|
||||||
|
else {
|
||||||
|
DiagPrintf("SHTC1 init FAILED!\n");
|
||||||
|
for(;;);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
error = SHTC_GetTempAndHumi(&temperature, &humidity);
|
||||||
|
rtl_printf("temp=%f, humidity=%f, error=%d\n", temperature, humidity, error);
|
||||||
|
RtlMsleepOS(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void example_shtc1(void)
|
||||||
|
{
|
||||||
|
if(xTaskCreate(example_shtc1_thread, ((const char*)"example_shtc1_thread"), 512, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
|
||||||
|
printf("%s xTaskCreate(init_thread) failed\n", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //#ifdef CONFIG_I2C_EN
|
13
RTL00_SDKV35a/component/common/application/wigadget/shtc1.h
Normal file
13
RTL00_SDKV35a/component/common/application/wigadget/shtc1.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef SHTC1_H
|
||||||
|
#define SHTC1_H
|
||||||
|
|
||||||
|
#define NO_ERROR 0x00
|
||||||
|
#define ACK_ERROR 0x01
|
||||||
|
#define CHECKSUM_ERROR 0x02
|
||||||
|
#define NULL_ERROR 0x03
|
||||||
|
|
||||||
|
int SHTC_GetTempAndHumi(float *temp, float *humi);
|
||||||
|
int SHTC_Init(uint16_t *pID);
|
||||||
|
void example_shtc1(void);
|
||||||
|
|
||||||
|
#endif
|
743
RTL00_SDKV35a/component/common/application/wigadget/wigadget.c
Normal file
743
RTL00_SDKV35a/component/common/application/wigadget/wigadget.c
Normal file
|
@ -0,0 +1,743 @@
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "wifi_conf.h"
|
||||||
|
#include "wifi_ind.h"
|
||||||
|
#include "sockets.h"
|
||||||
|
#include <mDNS/mDNS.h>
|
||||||
|
#include <lwip_netconf.h>
|
||||||
|
#include <lwip/netif.h>
|
||||||
|
#include "flash_api.h"
|
||||||
|
#include <rom_wac_aes.h>
|
||||||
|
#include "rom_wac_curve25519-donna.h"
|
||||||
|
#include "gpio_api.h"
|
||||||
|
#include "gpio_irq_api.h"
|
||||||
|
#include "cJSON.h"
|
||||||
|
#include "cloud_link.h"
|
||||||
|
#include "wigadget.h"
|
||||||
|
#include "shtc1.h"
|
||||||
|
|
||||||
|
#if LWIP_SOCKET
|
||||||
|
|
||||||
|
#define PORT 6866
|
||||||
|
#define MAX_BUFFER_SIZE 256
|
||||||
|
#define ENC_SIZE 64
|
||||||
|
#define CONTROL_TYPE 1
|
||||||
|
#define GPIO_SOFTAP_RESET_PIN PC_4
|
||||||
|
|
||||||
|
flash_t iot_flash;
|
||||||
|
uint8_t aes_key[16];
|
||||||
|
static unsigned char tx_buffer[MAX_BUFFER_SIZE];
|
||||||
|
static unsigned char rx_buffer[MAX_BUFFER_SIZE];
|
||||||
|
|
||||||
|
extern struct netif xnetif[NET_IF_NUM];
|
||||||
|
|
||||||
|
#define DEBUG_IOT 1
|
||||||
|
|
||||||
|
#define IOT_LOG(level, fmt, ...) printf("\n\r[IOT %s] %s: " fmt "\n", level, __FUNCTION__, ##__VA_ARGS__)
|
||||||
|
#if DEBUG_IOT == 2
|
||||||
|
#define IOT_DEBUG(fmt, ...) IOT_LOG("DEBUG", fmt, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define IOT_DEBUG(fmt, ...)
|
||||||
|
#endif
|
||||||
|
#if DEBUG_IOT
|
||||||
|
#define IOT_ERROR(fmt, ...) IOT_LOG("ERROR", fmt, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define IOT_ERROR(fmt, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void encrypt_data_aes(unsigned char *plaint_text, unsigned char *enc_data);
|
||||||
|
void decrypt_data_aes(unsigned char *enc_data, unsigned char *dec_data, int data_len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||||
|
#else
|
||||||
|
#define GCC_VERSION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Test for GCC < 5.4.0 */
|
||||||
|
#if GCC_VERSION > 50300
|
||||||
|
extern unsigned int _freertos_arc4random(void);
|
||||||
|
#define wgg_arc4random _freertos_arc4random
|
||||||
|
// or #define wgg_arc4random _ws_arc4random
|
||||||
|
#else
|
||||||
|
static unsigned int wgg_arc4random(void)
|
||||||
|
{
|
||||||
|
unsigned int res = xTaskGetTickCount();
|
||||||
|
static unsigned int seed = 0xDEADB00B;
|
||||||
|
|
||||||
|
seed = ((seed & 0x007F00FF) << 7) ^
|
||||||
|
((seed & 0x0F80FF00) >> 8) ^ // be sure to stir those low bits
|
||||||
|
(res << 13) ^ (res >> 9); // using the clock too!
|
||||||
|
return seed;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char *iot_itoa(int value)
|
||||||
|
{
|
||||||
|
char *val_str;
|
||||||
|
int tmp = value, len = 1;
|
||||||
|
|
||||||
|
while((tmp /= 10) > 0)
|
||||||
|
len ++;
|
||||||
|
|
||||||
|
val_str = (char *) malloc(len + 1);
|
||||||
|
sprintf(val_str, "%d", value);
|
||||||
|
|
||||||
|
return val_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gen_json_data(char *i, char *j, unsigned char *json_data)
|
||||||
|
{
|
||||||
|
cJSON_Hooks memoryHook;
|
||||||
|
|
||||||
|
memoryHook.malloc_fn = malloc;
|
||||||
|
memoryHook.free_fn = free;
|
||||||
|
cJSON_InitHooks(&memoryHook);
|
||||||
|
memset(json_data, 0, ENC_SIZE);
|
||||||
|
|
||||||
|
|
||||||
|
cJSON *IOTJSObject = NULL;
|
||||||
|
char *data;
|
||||||
|
|
||||||
|
|
||||||
|
if((IOTJSObject = cJSON_CreateObject()) != NULL) {
|
||||||
|
|
||||||
|
cJSON_AddItemToObject(IOTJSObject, "TEM", cJSON_CreateString(i));
|
||||||
|
cJSON_AddItemToObject(IOTJSObject, "HUM", cJSON_CreateString(j));
|
||||||
|
|
||||||
|
data = cJSON_Print(IOTJSObject);
|
||||||
|
memcpy(json_data, data, strlen(data));
|
||||||
|
cJSON_Delete(IOTJSObject);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void encrypt_data_aes(unsigned char *plaint_text, unsigned char *enc_data)
|
||||||
|
{
|
||||||
|
unsigned char iv[16] = {0};
|
||||||
|
unsigned char* iv_bak = "AAAAAAAAAAAAAAAA";
|
||||||
|
aes_encrypt_ctx enc_ctx;
|
||||||
|
|
||||||
|
memset(&enc_ctx, 0, sizeof(enc_ctx));
|
||||||
|
memset(iv, 0, sizeof(iv));
|
||||||
|
memcpy(iv, iv_bak, sizeof(iv));
|
||||||
|
memset(enc_data, 0, sizeof(enc_data));
|
||||||
|
|
||||||
|
aes_init();
|
||||||
|
aes_encrypt_key(aes_key, 16, &enc_ctx);
|
||||||
|
aes_cbc_encrypt(plaint_text, enc_data, ENC_SIZE, iv, &enc_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void decrypt_data_aes(unsigned char *enc_data, unsigned char *dec_data, int data_len)
|
||||||
|
{
|
||||||
|
unsigned char iv[16] = {0};
|
||||||
|
unsigned char* iv_bak = "AAAAAAAAAAAAAAAA";
|
||||||
|
aes_decrypt_ctx dec_ctx;
|
||||||
|
|
||||||
|
memset(&dec_ctx, 0, sizeof(dec_ctx));
|
||||||
|
memset(iv, 0, sizeof(iv));
|
||||||
|
memcpy(iv, iv_bak, sizeof(iv));
|
||||||
|
memset(dec_data, 0, sizeof(dec_data));
|
||||||
|
|
||||||
|
aes_init();
|
||||||
|
aes_decrypt_key(aes_key, 16, &dec_ctx);
|
||||||
|
aes_cbc_decrypt(enc_data, dec_data, data_len, iv, &dec_ctx);
|
||||||
|
IOT_DEBUG("Decrypt data: %s\r\n",dec_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void iotapp_platform_reset(void)
|
||||||
|
{
|
||||||
|
HAL_WRITE32(SYSTEM_CTRL_BASE, 0x14, 0x00000021);
|
||||||
|
osDelay(100);
|
||||||
|
HAL_WRITE32(0xE000ED00, 0x0C, (0x5FA << 16) |
|
||||||
|
(HAL_READ32(0xE000ED00, 0x0C) & (7 << 8)) |
|
||||||
|
(1 << 2));
|
||||||
|
while(1) osDelay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void iotapp_reset_irq_handler(uint32_t id, gpio_irq_event event)
|
||||||
|
{
|
||||||
|
printf("\n\r\n\r\n\r\n\r<<<<<<Reset the device using PC_4>>>>>>>\n\r\n\r\n\r\n\r");
|
||||||
|
flash_erase_sector(&iot_flash, FLASH_IOT_DATA);
|
||||||
|
iotapp_platform_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
int local_link(unsigned char *tx_data)
|
||||||
|
{
|
||||||
|
int sockfd, newsockfd;
|
||||||
|
socklen_t client;
|
||||||
|
struct sockaddr_in serv_addr, cli_addr;
|
||||||
|
uint8_t rx_data[ENC_SIZE];
|
||||||
|
unsigned char enc_data[ENC_SIZE];
|
||||||
|
unsigned char dec_data[ENC_SIZE];
|
||||||
|
int ret = 0, opt = 1, k = 1, j;
|
||||||
|
char *result = NULL, *backup = NULL;
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
char *delims = ", ";
|
||||||
|
|
||||||
|
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if (sockfd < 0) {
|
||||||
|
IOT_ERROR("ERROR opening socket");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt))) < 0){
|
||||||
|
IOT_ERROR("ERROR on setting socket option");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset((char *)&serv_addr, 0, sizeof(serv_addr));
|
||||||
|
serv_addr.sin_family = AF_INET;
|
||||||
|
serv_addr.sin_addr.s_addr = INADDR_ANY;
|
||||||
|
serv_addr.sin_port = htons(PORT);
|
||||||
|
|
||||||
|
if (bind(sockfd, (struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0) {
|
||||||
|
IOT_ERROR("ERROR on binding");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
if(listen(sockfd , 20) < 0){
|
||||||
|
IOT_ERROR("ERROR on listening");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
client = sizeof(cli_addr);
|
||||||
|
if((newsockfd = accept(sockfd,(struct sockaddr *) &cli_addr,&client)) < 0){
|
||||||
|
IOT_ERROR("ERROR on accept");
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if ((ret = read(newsockfd,rx_buffer,sizeof(rx_buffer))) < 0){
|
||||||
|
IOT_ERROR("ERROR reading from socket");
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
IOT_DEBUG("cmd received: %s, length: %d\r\n",rx_buffer, ret);
|
||||||
|
|
||||||
|
//Changing received data to string
|
||||||
|
if (!strncmp(rx_buffer, "[", strlen("["))){
|
||||||
|
data = rx_buffer + strlen("[");
|
||||||
|
for(j = 1; j < 5; j++){
|
||||||
|
if (data[ret - j] == ']')
|
||||||
|
data[ret -j] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strcpy(data, rx_buffer);
|
||||||
|
memset(rx_data, 0, sizeof(rx_data));
|
||||||
|
result = strtok_r(data, delims, &backup);
|
||||||
|
rx_data[0]=(uint8_t)atoi(result);
|
||||||
|
while((result = strtok_r(NULL, delims, &backup)) != NULL)
|
||||||
|
rx_data[k++]=(uint8_t)atoi(result);
|
||||||
|
memset(dec_data, 0, sizeof(dec_data));
|
||||||
|
|
||||||
|
//Decrpyt the received data
|
||||||
|
decrypt_data_aes(rx_data, dec_data, 16);
|
||||||
|
|
||||||
|
if(strncmp(dec_data, "request", strlen("request")) == 0){
|
||||||
|
//Encrypt the sending data
|
||||||
|
memset(enc_data, 0, strlen(enc_data));
|
||||||
|
encrypt_data_aes(tx_data, enc_data);
|
||||||
|
//Changing encrpyt data to JAVA type string
|
||||||
|
for (j = 0; j < ENC_SIZE; j++){
|
||||||
|
char *temp;
|
||||||
|
temp = iot_itoa(enc_data[j]);
|
||||||
|
if(j == 0)
|
||||||
|
strcpy(tx_buffer, "[");
|
||||||
|
strcat(tx_buffer,temp);
|
||||||
|
if (j == (ENC_SIZE - 1))
|
||||||
|
strcat(tx_buffer,"]");
|
||||||
|
else
|
||||||
|
strcat(tx_buffer,",");
|
||||||
|
free(temp);
|
||||||
|
temp = NULL;
|
||||||
|
}
|
||||||
|
IOT_DEBUG("Data reply to APP: %s\r\nLength of data: %d\r\n", tx_buffer, strlen(tx_buffer));
|
||||||
|
|
||||||
|
if ((ret = write(newsockfd,tx_buffer,strlen(tx_buffer))) < 0){
|
||||||
|
IOT_ERROR("ERROR writing to socket");
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
IOT_DEBUG("Sending %d bytes data OK!\r\n", ret);
|
||||||
|
}
|
||||||
|
else if(strncmp(dec_data, "remove", strlen("remove")) == 0){
|
||||||
|
printf("\n\r\n\r\n\r\n\r<<<<<<Reset the device >>>>>>>\n\r\n\r\n\r\n\r");
|
||||||
|
flash_erase_sector(&iot_flash, FLASH_IOT_DATA);
|
||||||
|
write(newsockfd,"Remove OK",strlen("Remove OK"));
|
||||||
|
close(newsockfd);
|
||||||
|
close(sockfd);
|
||||||
|
iotapp_platform_reset();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
IOT_ERROR("ERROR wrong KEY or wrong request!");
|
||||||
|
write(newsockfd,"The KEY or the request is not correct!",strlen("The KEY or the request is not correct!"));
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
if(close(newsockfd) != 0)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
exit2:
|
||||||
|
if(close(sockfd) != 0)
|
||||||
|
goto exit2;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void local_link_task(void *param)
|
||||||
|
{
|
||||||
|
unsigned char data[ENC_SIZE] = {0};
|
||||||
|
vTaskDelay(1000);
|
||||||
|
char i[16], j[16];
|
||||||
|
float temperature = 1.123f;
|
||||||
|
float humidity = 2.456f;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
memset(i, 0, 16);
|
||||||
|
memset(j, 0, 16);
|
||||||
|
#if PSEUDO_DATA
|
||||||
|
sprintf(i,"%.2f", temperature++);
|
||||||
|
sprintf(j, "%.2f", humidity++);
|
||||||
|
if(temperature > 60)
|
||||||
|
temperature = 1.123f;
|
||||||
|
if(humidity > 98)
|
||||||
|
humidity = 2.456f;
|
||||||
|
#else
|
||||||
|
ret = SHTC_GetTempAndHumi(&temperature, &humidity);
|
||||||
|
sprintf(i,"%.2f", temperature);
|
||||||
|
sprintf(j, "%.2f", humidity);
|
||||||
|
#endif
|
||||||
|
if(ret < 0)
|
||||||
|
printf("\r\n\r\n<-----LOCAL LINK FAILED!!(get infor failed)\r\n\r\n");
|
||||||
|
else{
|
||||||
|
printf("\r\n\r\n----->START LOCAL LINKING\r\n\r\n");
|
||||||
|
gen_json_data(i, j, data);
|
||||||
|
printf("Sending data : %s\r\n", data);
|
||||||
|
if (local_link(data) < 0)
|
||||||
|
printf("\r\n\r\n<-----LOCAL LINK FAILED!!\r\n\r\n");
|
||||||
|
else
|
||||||
|
printf("\r\n\r\n<-----LOCAL LINK OK!!\r\n\r\n");
|
||||||
|
vTaskDelay(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void start_local_link(void)
|
||||||
|
{
|
||||||
|
if(xTaskCreate(local_link_task, ((const char*)"local_link_task"), 5376, NULL, tskIDLE_PRIORITY + 4, NULL) != pdPASS)
|
||||||
|
printf("\n\r%s xTaskCreate failed", __FUNCTION__);
|
||||||
|
}
|
||||||
|
int pair_device(unsigned char *tx_buffer, unsigned char *rx_buffer, int handshake)
|
||||||
|
{
|
||||||
|
int sockfd, newsockfd;
|
||||||
|
socklen_t clilen;
|
||||||
|
struct sockaddr_in serv_addr, cli_addr;
|
||||||
|
int ret = 0;
|
||||||
|
int opt = 1;
|
||||||
|
|
||||||
|
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if (sockfd < 0) {
|
||||||
|
IOT_ERROR("ERROR opening socket");
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt, sizeof(opt))) < 0){
|
||||||
|
IOT_ERROR("ERROR on setting socket option");
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset((char *)&serv_addr, 0, sizeof(serv_addr));
|
||||||
|
serv_addr.sin_family = AF_INET;
|
||||||
|
serv_addr.sin_len = sizeof(serv_addr);
|
||||||
|
serv_addr.sin_addr.s_addr = INADDR_ANY;
|
||||||
|
serv_addr.sin_port = htons(PORT);
|
||||||
|
|
||||||
|
if ((bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr))) < 0) {
|
||||||
|
IOT_ERROR("ERROR on binding");
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if ((listen(sockfd, 5)) < 0){
|
||||||
|
IOT_ERROR("ERROR on listening tcp server socket fd");
|
||||||
|
ret = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
clilen = sizeof(cli_addr);
|
||||||
|
newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, (socklen_t*)&clilen);
|
||||||
|
if (newsockfd < 0) {
|
||||||
|
IOT_ERROR("ERROR on accept");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
ret = read(newsockfd, rx_buffer, MAX_BUFFER_SIZE);
|
||||||
|
if (ret <= 0){
|
||||||
|
IOT_ERROR("ERROR reading from socket");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
IOT_DEBUG("Request received: %s, byte: %d\r\n",rx_buffer, ret);
|
||||||
|
if(handshake == 1){
|
||||||
|
if(strncmp(rx_buffer,"PAIR", strlen("PAIR")) != 0){
|
||||||
|
write(newsockfd, "ERROR", strlen("ERROR"));
|
||||||
|
IOT_ERROR("ERROR on first handshake!");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(handshake == 2){
|
||||||
|
if((rx_buffer == NULL) ||(strlen(rx_buffer) < 32)){
|
||||||
|
write(newsockfd, "ERROR", strlen("ERROR"));
|
||||||
|
IOT_ERROR("ERROR on second handshake!");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(handshake == 3){
|
||||||
|
unsigned char account[64];
|
||||||
|
unsigned char enc_acc[64];
|
||||||
|
char *result = NULL, *backup = NULL;
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
char *delims = ", ";
|
||||||
|
int j, k = 1;
|
||||||
|
if (!strncmp(rx_buffer, "[", strlen("["))){
|
||||||
|
data = rx_buffer + strlen("[");
|
||||||
|
for(j = 1; j < 5; j++){
|
||||||
|
if (data[ret - j] == ']')
|
||||||
|
data[ret -j] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strcpy(data, rx_buffer);
|
||||||
|
memset(enc_acc, 0, sizeof(enc_acc));
|
||||||
|
result = strtok_r(data, delims, &backup);
|
||||||
|
enc_acc[0]=(uint8_t)atoi(result);
|
||||||
|
while((result = strtok_r(NULL, delims, &backup)) != NULL)
|
||||||
|
enc_acc[k++]=(uint8_t)atoi(result);
|
||||||
|
IOT_DEBUG("The value of k: %d", k);
|
||||||
|
memset(account, 0, sizeof(account));
|
||||||
|
decrypt_data_aes(enc_acc, account, k);
|
||||||
|
|
||||||
|
if((strncmp(account,"https://", strlen("https://"))) != 0){
|
||||||
|
write(newsockfd, "ERROR", strlen("ERROR"));
|
||||||
|
IOT_ERROR("ERROR on third handshake!");
|
||||||
|
ret = -1;
|
||||||
|
goto exit2;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
IOT_DEBUG("The received Firebase URL:%s", account);
|
||||||
|
memset(rx_buffer, 0, strlen(rx_buffer));
|
||||||
|
memcpy(rx_buffer, (account+strlen("https://")), (strlen(account) + strlen("https://")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ret = write(newsockfd, tx_buffer, strlen(tx_buffer));
|
||||||
|
IOT_DEBUG("Data send: %s\r\n",tx_buffer);
|
||||||
|
|
||||||
|
if (ret < 0){
|
||||||
|
IOT_ERROR("ERROR writing to socket");
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
if(close(newsockfd) != 0)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
exit2:
|
||||||
|
if(close(sockfd) != 0)
|
||||||
|
goto exit2;
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pair_device_task(void)
|
||||||
|
{
|
||||||
|
int i, j, k, HANDSHAKE;
|
||||||
|
uint8_t PAIR_STATE[1] = {0};
|
||||||
|
|
||||||
|
if(CONTROL_TYPE == 1){
|
||||||
|
printf("\r\n\r\n<<<<<<CONTROL_TYPE = 1 Need 3 times handshake>>>>>>\r\n\r\n");
|
||||||
|
HANDSHAKE = 3;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
printf("\r\n\r\n<<<<<<CONTROL_TYPE = 0 Need 2 times handshake>>>>>>\r\n\r\n");
|
||||||
|
HANDSHAKE = 2;
|
||||||
|
}
|
||||||
|
printf("\r\n\r\n=========>PAIR_STATE = 0 Start to pair\r\n\r\n");
|
||||||
|
for(i = 0; i < HANDSHAKE; i++){
|
||||||
|
static const uint8_t basepoint[32] = {9};
|
||||||
|
uint8_t mysecret[32];
|
||||||
|
uint8_t mypublic[32];
|
||||||
|
uint8_t theirpublic[32] = {0};
|
||||||
|
uint8_t shared_key[32];
|
||||||
|
//First handshake
|
||||||
|
if(i == 0){
|
||||||
|
printf("\r\n\r\n===>Start the first handshake\r\n\r\n");
|
||||||
|
memset(tx_buffer, 0, sizeof(tx_buffer));
|
||||||
|
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||||
|
for(j = 0; j < 32; j ++)
|
||||||
|
mysecret[j] = (uint8_t) wgg_arc4random();
|
||||||
|
mysecret[j] = '\0';
|
||||||
|
curve25519_donna(mypublic, mysecret, basepoint);
|
||||||
|
for (j = 0; j < 32; j++){
|
||||||
|
char *temp;
|
||||||
|
temp = iot_itoa(mypublic[j]);
|
||||||
|
if(j == 0)
|
||||||
|
strcpy(tx_buffer, "[");
|
||||||
|
strcat(tx_buffer,temp);
|
||||||
|
if (j == 31)
|
||||||
|
strcat(tx_buffer,"]");
|
||||||
|
else
|
||||||
|
strcat(tx_buffer,",");
|
||||||
|
free(temp);
|
||||||
|
temp = NULL;
|
||||||
|
}
|
||||||
|
if(pair_device(tx_buffer, rx_buffer, 1) >= 0)
|
||||||
|
printf("\r\n\r\n<===First handshake OK!!\r\n\r\n");
|
||||||
|
else{
|
||||||
|
i--;
|
||||||
|
printf("\r\n\r\n<===First handshake FAILED!!\r\n\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Second handshake
|
||||||
|
if(i == 1){
|
||||||
|
printf("\r\n\r\n=====>Start the second handshake\r\n\r\n");
|
||||||
|
vTaskDelay(200);
|
||||||
|
memset(tx_buffer, 0, sizeof(tx_buffer));
|
||||||
|
if(CONTROL_TYPE == 1)
|
||||||
|
memcpy(tx_buffer, "FIREBASE URL", sizeof("FIREBASE URL"));
|
||||||
|
else
|
||||||
|
memcpy(tx_buffer, "PAIR OK", sizeof("PAIR OK"));
|
||||||
|
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||||
|
|
||||||
|
if(pair_device(tx_buffer, rx_buffer, 2) >= 0){
|
||||||
|
char *result = NULL, *backup = NULL;
|
||||||
|
unsigned char *data = NULL;
|
||||||
|
char *delims = ", ";
|
||||||
|
k = 1;
|
||||||
|
if (!strncmp(rx_buffer, "[", strlen("["))){
|
||||||
|
data = rx_buffer + strlen("[");
|
||||||
|
int len;
|
||||||
|
len = strlen(data);
|
||||||
|
for(j = 1; j < 5; j++){
|
||||||
|
if (data[len - j] == ']')
|
||||||
|
data[len -j] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
strcpy(data, rx_buffer);
|
||||||
|
|
||||||
|
memset(theirpublic, 0, sizeof(theirpublic));
|
||||||
|
|
||||||
|
result = strtok_r(data, delims, &backup);
|
||||||
|
theirpublic[0]=(uint8_t)atoi(result);
|
||||||
|
|
||||||
|
while((result = strtok_r(NULL, delims, &backup)) != NULL)
|
||||||
|
theirpublic[k++] = (uint8_t)atoi(result);
|
||||||
|
|
||||||
|
curve25519_donna(shared_key, mysecret, theirpublic);
|
||||||
|
for(j = 0; j < 16; j ++)
|
||||||
|
aes_key[j] = shared_key[j];
|
||||||
|
//Store the KEY in FLASH
|
||||||
|
if(CONTROL_TYPE == 0){
|
||||||
|
PAIR_STATE[0] = 1;
|
||||||
|
uint8_t data[33];
|
||||||
|
memset(data, 0, 33);
|
||||||
|
memcpy(data, PAIR_STATE, 1);
|
||||||
|
memcpy(data+1, shared_key, 32);
|
||||||
|
flash_erase_sector(&iot_flash, FLASH_IOT_DATA);
|
||||||
|
flash_stream_write(&iot_flash, FLASH_IOT_DATA, 33, (uint8_t *) data);
|
||||||
|
IOT_DEBUG("PAIR_STATE: %d\r\n", PAIR_STATE[0]);
|
||||||
|
}
|
||||||
|
printf("\r\n\r\n<=====Second handshake OK!!\r\n\r\n");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
i = i - 2;
|
||||||
|
printf("\r\n\r\n<=====Second handshake FAILED!!\r\n\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Third handshake
|
||||||
|
if(i == 2){
|
||||||
|
printf("\r\n\r\n=======>Start the third handshake\r\n\r\n");
|
||||||
|
vTaskDelay(200);
|
||||||
|
|
||||||
|
memset(tx_buffer, 0, sizeof(tx_buffer));
|
||||||
|
memcpy(tx_buffer, "PAIR OK", sizeof("PAIR OK"));
|
||||||
|
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||||
|
|
||||||
|
if(pair_device(tx_buffer, rx_buffer, 3) >= 0){
|
||||||
|
IOT_DEBUG("rx_buffer: %s, sizeof rx_buffer:%d\r\n", rx_buffer, sizeof(rx_buffer));
|
||||||
|
PAIR_STATE[0] = 1;
|
||||||
|
uint8_t data[97];
|
||||||
|
memset(data, 0, 97);
|
||||||
|
memcpy(data, PAIR_STATE, 1);
|
||||||
|
memcpy(data+1, shared_key, 32);
|
||||||
|
memcpy(data+33, rx_buffer, 64);
|
||||||
|
flash_erase_sector(&iot_flash, FLASH_IOT_DATA);
|
||||||
|
flash_stream_write(&iot_flash, FLASH_IOT_DATA, 97, (uint8_t *) data);
|
||||||
|
IOT_DEBUG("PAIR_STATE: %d\r\n", PAIR_STATE[0]);
|
||||||
|
|
||||||
|
printf("\r\n\r\n<=======Third handshake OK!!\r\n\r\n");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
i = i - 3;
|
||||||
|
printf("\r\n\r\n<=======Third handshake FAILED!!\r\n\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\r\n\r\n<=========Pairing OK!!\r\n\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mdns_task(void *param)
|
||||||
|
{
|
||||||
|
DNSServiceRef dnsServiceRef = NULL;
|
||||||
|
TXTRecordRef txtRecord;
|
||||||
|
unsigned char txt_buf[128];
|
||||||
|
uint8_t *mac, *ip;
|
||||||
|
int j, ret = 0;
|
||||||
|
uint8_t *flash_data;
|
||||||
|
uint8_t PAIR_STATE[1] = {0};
|
||||||
|
static unsigned char MAC_ADD[21];
|
||||||
|
static unsigned char IP[16];
|
||||||
|
static unsigned char port[6];
|
||||||
|
uint16_t shtc1_id;
|
||||||
|
|
||||||
|
// Delay to wait for IP by DHCP and get the information of IP and MAC
|
||||||
|
printf("\n\r\n\r\n\r\n\r<<<<<<Waiting for 20 seconds to connect Wi-Fi>>>>>>>\n\r\n\r\n\r\n\r");
|
||||||
|
vTaskDelay(20000);
|
||||||
|
ip = LwIP_GetIP(&xnetif[0]);
|
||||||
|
mac = LwIP_GetMAC(&xnetif[0]);
|
||||||
|
|
||||||
|
sprintf(MAC_ADD, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||||
|
sprintf(IP, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
sprintf(port, "%d", PORT);
|
||||||
|
|
||||||
|
IOT_DEBUG("MAC => %s\r\n", MAC_ADD) ;
|
||||||
|
IOT_DEBUG("IP => %s\r\n", IP);
|
||||||
|
IOT_DEBUG("PORT => %s\r\n", port);
|
||||||
|
|
||||||
|
//Get the value of PAIR_STATE and the AES key in flash
|
||||||
|
flash_data = (uint8_t *)malloc(33);
|
||||||
|
flash_stream_read(&iot_flash, FLASH_IOT_DATA, 33, (uint8_t *)flash_data);
|
||||||
|
memcpy(PAIR_STATE, flash_data, 1);
|
||||||
|
if(PAIR_STATE[0] != 0x1)
|
||||||
|
PAIR_STATE[0] = 0;
|
||||||
|
else{
|
||||||
|
for(j = 0;j < 16; j++){
|
||||||
|
aes_key[j] = flash_data[j+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(flash_data);
|
||||||
|
IOT_DEBUG("PAIR_STATE now: %d\r\n", PAIR_STATE[0]);
|
||||||
|
|
||||||
|
IOT_DEBUG("=>mDNS Init\r\n");
|
||||||
|
if(mDNSResponderInit() == 0) {
|
||||||
|
printf("\r\n\r\n========>Start to register mDNS service\r\n\r\n");
|
||||||
|
//The device not paired before
|
||||||
|
if(PAIR_STATE[0] == 0){
|
||||||
|
TXTRecordCreate(&txtRecord, sizeof(txt_buf), txt_buf);
|
||||||
|
|
||||||
|
TXTRecordSetValue(&txtRecord, "IP", strlen(IP), IP);
|
||||||
|
TXTRecordSetValue(&txtRecord, "PORT", strlen(port), port);
|
||||||
|
TXTRecordSetValue(&txtRecord, "MAC_ADDR", strlen(MAC_ADD), MAC_ADD);
|
||||||
|
TXTRecordSetValue(&txtRecord, "PAIR_STATE", strlen("0"), "0");
|
||||||
|
TXTRecordSetValue(&txtRecord, "SERVICE_NAME", strlen("ht_sensor"), "ht_sensor");
|
||||||
|
if(CONTROL_TYPE == 1)
|
||||||
|
TXTRecordSetValue(&txtRecord, "CONTROL_TYPE", strlen("1"), "1");
|
||||||
|
else
|
||||||
|
TXTRecordSetValue(&txtRecord, "CONTROL_TYPE", strlen("0"), "0");
|
||||||
|
dnsServiceRef = mDNSRegisterService("ht_sensor", "_Ameba._tcp", "local", PORT, &txtRecord);
|
||||||
|
TXTRecordDeallocate(&txtRecord);
|
||||||
|
printf("\r\n\r\n<========Registering mDNS service OK!!\r\n\r\n");
|
||||||
|
pair_device_task();
|
||||||
|
}
|
||||||
|
//The device was paired
|
||||||
|
else if(PAIR_STATE[0] == 0x1){
|
||||||
|
TXTRecordCreate(&txtRecord, sizeof(txt_buf), txt_buf);
|
||||||
|
|
||||||
|
TXTRecordSetValue(&txtRecord, "IP", strlen(ip), ip);
|
||||||
|
TXTRecordSetValue(&txtRecord, "PORT", strlen(port), port);
|
||||||
|
TXTRecordSetValue(&txtRecord, "MAC_ADDR", strlen(MAC_ADD), MAC_ADD);
|
||||||
|
TXTRecordSetValue(&txtRecord, "PAIR_STATE", strlen("1"), "1");
|
||||||
|
TXTRecordSetValue(&txtRecord, "SERVICE_NAME", strlen("ht_sensor"), "ht_sensor");
|
||||||
|
if(CONTROL_TYPE == 1)
|
||||||
|
TXTRecordSetValue(&txtRecord, "CONTROL_TYPE", strlen("1"), "1");
|
||||||
|
else
|
||||||
|
TXTRecordSetValue(&txtRecord, "CONTROL_TYPE", strlen("0"), "0");
|
||||||
|
|
||||||
|
dnsServiceRef = mDNSRegisterService("ht_sensor", "_Ameba._tcp", "local", PORT, &txtRecord);
|
||||||
|
TXTRecordDeallocate(&txtRecord);
|
||||||
|
printf("\r\n\r\n<========Registering mDNS service OK!! PAIR_STATE = 1\r\n\r\n");
|
||||||
|
}
|
||||||
|
#if PSEUDO_DATA
|
||||||
|
printf("\r\n\r\n========>Using the speudo data\r\n\r\n");
|
||||||
|
if(CONTROL_TYPE == 1) start_cloud_link();
|
||||||
|
start_local_link();
|
||||||
|
#else
|
||||||
|
//Init the shtc1 sensor
|
||||||
|
printf("\r\n\r\n========>Init the temperature and humidity sensor\r\n\r\n");
|
||||||
|
ret = SHTC_Init(&shtc1_id);
|
||||||
|
if ( ret == NO_ERROR ){
|
||||||
|
printf("\r\n\r\n<========Senser init OK! ID = 0x%x \r\n\r\n", shtc1_id);
|
||||||
|
if(CONTROL_TYPE == 1) start_cloud_link();
|
||||||
|
start_local_link();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("\r\n\r\n<========Senser init FAILED! ID = 0x%x \r\n\r\n", shtc1_id);
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ret = -1;
|
||||||
|
if(ret == 0){
|
||||||
|
while(1){
|
||||||
|
IOT_DEBUG("Update the mDNS textrecord!\r\n");
|
||||||
|
TXTRecordCreate(&txtRecord, sizeof(txt_buf), txt_buf);
|
||||||
|
TXTRecordSetValue(&txtRecord, "IP", strlen(IP), IP);
|
||||||
|
TXTRecordSetValue(&txtRecord, "PORT", strlen(port), port);
|
||||||
|
TXTRecordSetValue(&txtRecord, "MAC_ADDR", strlen(MAC_ADD), MAC_ADD);
|
||||||
|
TXTRecordSetValue(&txtRecord, "PAIR_STATE", strlen("1"), "1");
|
||||||
|
if(CONTROL_TYPE == 1)
|
||||||
|
TXTRecordSetValue(&txtRecord, "CONTROL_TYPE", strlen("1"), "1");
|
||||||
|
else
|
||||||
|
TXTRecordSetValue(&txtRecord, "CONTROL_TYPE", strlen("0"), "0");
|
||||||
|
TXTRecordSetValue(&txtRecord, "SERVICE_NAME", strlen("ht_sensor"), "ht_sensor");
|
||||||
|
|
||||||
|
mDNSUpdateService(dnsServiceRef, &txtRecord, 0);
|
||||||
|
TXTRecordDeallocate(&txtRecord);
|
||||||
|
vTaskDelay(2*60*1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(dnsServiceRef)
|
||||||
|
mDNSDeregisterService(dnsServiceRef);
|
||||||
|
IOT_DEBUG("<=mDNS Deinit\r\n\r\n");
|
||||||
|
mDNSResponderDeinit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void example_wigadget(void)
|
||||||
|
{
|
||||||
|
if(xTaskCreate(mdns_task, ((const char*)"mdns_task"), 3072, NULL, tskIDLE_PRIORITY + 1, NULL) != pdPASS)
|
||||||
|
printf("\n\r%s xTaskCreate failed", __FUNCTION__);
|
||||||
|
|
||||||
|
gpio_t gpio_softap_reset_button;
|
||||||
|
gpio_irq_t gpioirq_softap_reset_button;
|
||||||
|
|
||||||
|
gpio_irq_init(&gpioirq_softap_reset_button, GPIO_SOFTAP_RESET_PIN, iotapp_reset_irq_handler, (uint32_t)(&gpio_softap_reset_button));
|
||||||
|
gpio_irq_set(&gpioirq_softap_reset_button, IRQ_FALL, 1);
|
||||||
|
gpio_irq_enable(&gpioirq_softap_reset_button);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // LWIP_SOCKET
|
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef WIGADGET_H
|
||||||
|
#define WIGADGET_H
|
||||||
|
|
||||||
|
#define FLASH_IOT_DATA (0x0007E000)
|
||||||
|
#define PSEUDO_DATA 1
|
||||||
|
|
||||||
|
void example_wigadget(void);
|
||||||
|
void gen_json_data(char *i, char *j, unsigned char *json_data);
|
||||||
|
|
||||||
|
#endif /* WIGADGET_H */
|
||||||
|
|
1075
RTL00_SDKV35a/component/common/application/xmodem/uart_fw_update.c
Normal file
1075
RTL00_SDKV35a/component/common/application/xmodem/uart_fw_update.c
Normal file
File diff suppressed because it is too large
Load diff
86
RTL00_SDKV35a/component/common/application/xmodem/xmodem.h
Normal file
86
RTL00_SDKV35a/component/common/application/xmodem/xmodem.h
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
X-Modem Header File
|
||||||
|
|
||||||
|
1999/09/03 sprite, support Xmode Tx & Rx
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _XMODE_H_
|
||||||
|
#define _XMODE_H_
|
||||||
|
|
||||||
|
#include <basic_types.h>
|
||||||
|
|
||||||
|
/*****************
|
||||||
|
* X-Modem status
|
||||||
|
*****************/
|
||||||
|
#define XMODEM_OK 1
|
||||||
|
#define XMODEM_CANCEL 2
|
||||||
|
#define XMODEM_ACK 3
|
||||||
|
#define XMODEM_NAK 4
|
||||||
|
#define XMODEM_COMPLETE 5
|
||||||
|
#define XMODEM_NO_SESSION 6
|
||||||
|
#define XMODEM_ABORT 7
|
||||||
|
#define XMODEM_TIMEOUT 8
|
||||||
|
|
||||||
|
/****************************
|
||||||
|
* flow control character
|
||||||
|
****************************/
|
||||||
|
#define SOH 0x01 /* Start of header */
|
||||||
|
#define STX 0x02 /* Start of header XModem-1K */
|
||||||
|
#define EOT 0x04 /* End of transmission */
|
||||||
|
#define ACK 0x06 /* Acknowledge */
|
||||||
|
#define NAK 0x15 /* Not acknowledge */
|
||||||
|
#define CAN 0x18 /* Cancel */
|
||||||
|
#define ESC 0x1b /* User Break */
|
||||||
|
|
||||||
|
/****************************
|
||||||
|
* Xmode paramters
|
||||||
|
****************************/
|
||||||
|
#define FRAME_SIZE 132 /* X-modem structure */
|
||||||
|
#define FRAME_SIZE_1K 1028 /* X-modem structure */
|
||||||
|
#define XM_BUFFER_SIZE 1024 /* X-modem buffer */
|
||||||
|
#define TIMEOUT 180 /* max timeout */
|
||||||
|
#define RETRY_COUNT 20 /* Try times */
|
||||||
|
#define xWAITTIME 0x00400000 /* waitiing time */
|
||||||
|
#define WAIT_FRAME_TIME (10000*100) /* 10 sec, wait frame timeout */
|
||||||
|
#define WAIT_CHAR_TIME (1000*100) /* 1 sec, wait char timeout */
|
||||||
|
|
||||||
|
/***********************
|
||||||
|
* frame structure
|
||||||
|
***********************/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned char soh;
|
||||||
|
unsigned char recordNo;
|
||||||
|
unsigned char recordNoInverted;
|
||||||
|
unsigned char buffer[XM_BUFFER_SIZE];
|
||||||
|
unsigned char CRC;
|
||||||
|
} XMODEM_FRAME;
|
||||||
|
|
||||||
|
typedef struct _XMODEM_COM_PORT_ {
|
||||||
|
char (*poll) (void);
|
||||||
|
char (*get)(void);
|
||||||
|
void (*put)(char c);
|
||||||
|
}XMODEM_COM_PORT, *PXMODEM_COM_PORT;
|
||||||
|
|
||||||
|
typedef struct _XMODEM_CTRL_ {
|
||||||
|
u16 xMUsing;
|
||||||
|
u16 currentFrame; /* current frame number */
|
||||||
|
u16 previousFrame; /* previous frame number */
|
||||||
|
u16 expected;
|
||||||
|
s16 rStatus;
|
||||||
|
s32 rFinish;
|
||||||
|
u32 total_frame;
|
||||||
|
u32 rx_len;
|
||||||
|
char *pXFrameBuf;
|
||||||
|
u32 (*RxFrameHandler)(char *ptr, u32 frame_num, u32 frame_size);
|
||||||
|
XMODEM_COM_PORT ComPort;
|
||||||
|
}XMODEM_CTRL, *PXMODEM_CTRL;
|
||||||
|
|
||||||
|
typedef u32 (*RxFrameHandler_t)(char *ptr, u32 frame_num, u32 frame_size);
|
||||||
|
|
||||||
|
extern s16 xModemStart(XMODEM_CTRL *pXMCtrl, char *FrameBuf, RxFrameHandler_t RxFrameHdl);
|
||||||
|
extern s16 xModemEnd(XMODEM_CTRL *pXMCtrl);
|
||||||
|
extern s32 xModemRxBuffer(XMODEM_CTRL *pXMCtrl, s32 MaxSize);
|
||||||
|
|
||||||
|
#endif /* _XMODE_H_ */
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _XMPORT_LOGUART_H_
|
||||||
|
#define _XMPORT_LOGUART_H_
|
||||||
|
|
||||||
|
#include "xmodem.h"
|
||||||
|
|
||||||
|
//void xmodem_loguart_init(void);
|
||||||
|
void xmodem_loguart_init(u32 BaudRate);
|
||||||
|
void xmodem_loguart_func_hook(XMODEM_COM_PORT *pXComPort);
|
||||||
|
void xmodem_loguart_deinit(void);
|
||||||
|
char xmodem_loguart_readable(void);
|
||||||
|
char xmodem_loguart_writable(void);
|
||||||
|
char xmodem_loguart_getc(void);
|
||||||
|
void xmodem_loguart_putc(char c);
|
||||||
|
|
||||||
|
#endif // end of "#define _XMPORT_LOGUART_H_"
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _XMPORT_UART_H_
|
||||||
|
#define _XMPORT_UART_H_
|
||||||
|
|
||||||
|
#include "xmodem.h"
|
||||||
|
|
||||||
|
void xmodem_uart_init(u8 uart_idx, u8 pin_mux, u32 baud_rate);
|
||||||
|
void xmodem_uart_func_hook(XMODEM_COM_PORT *pXComPort);
|
||||||
|
void xmodem_uart_deinit(void);
|
||||||
|
char xmodem_uart_readable(void);
|
||||||
|
char xmodem_uart_writable(void);
|
||||||
|
char xmodem_uart_getc(void);
|
||||||
|
void xmodem_uart_putc(char c);
|
||||||
|
|
||||||
|
#endif // end of "#define _XMPORT_UART_H_"
|
||||||
|
|
|
@ -0,0 +1,251 @@
|
||||||
|
#include "rtl8195a.h"
|
||||||
|
#include "build_info.h"
|
||||||
|
#ifdef PLATFORM_FREERTOS
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
#endif
|
||||||
|
#include "osdep_service.h"
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
#include "ethernet_api.h"
|
||||||
|
#include "lwip_intf.h"
|
||||||
|
#include "ethernet_mii.h"
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#include "ethernet_ex_api.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_MII_EN)
|
||||||
|
|
||||||
|
static _sema mii_rx_sema;
|
||||||
|
static _mutex mii_tx_mutex;
|
||||||
|
|
||||||
|
extern struct netif xnetif[NET_IF_NUM];
|
||||||
|
|
||||||
|
static u8 TX_BUFFER[1518];
|
||||||
|
static u8 RX_BUFFER[1518];
|
||||||
|
|
||||||
|
static u8 *pTmpTxDesc = NULL;
|
||||||
|
static u8 *pTmpRxDesc = NULL;
|
||||||
|
static u8 *pTmpTxPktBuf = NULL;
|
||||||
|
static u8 *pTmpRxPktBuf = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
int dhcp_ethernet_mii = 1;
|
||||||
|
int ethernet_if_default = 0;
|
||||||
|
|
||||||
|
extern int lwip_init_done;
|
||||||
|
|
||||||
|
static _sema mii_linkup_sema;
|
||||||
|
|
||||||
|
void mii_rx_thread(void* param){
|
||||||
|
u32 len = 0;
|
||||||
|
u8* pbuf = RX_BUFFER;
|
||||||
|
while(1){
|
||||||
|
if (rtw_down_sema(&mii_rx_sema) == _FAIL){
|
||||||
|
DBG_8195A("%s, Take Semaphore Fail\n", __FUNCTION__);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
// continues read the rx ring until its empty
|
||||||
|
while(1){
|
||||||
|
len = ethernet_receive();
|
||||||
|
if(len){
|
||||||
|
//DBG_8195A("mii_recv len = %d\n\r", len);
|
||||||
|
ethernet_read(pbuf, len);
|
||||||
|
// calculate the time duration
|
||||||
|
ethernetif_mii_recv(&xnetif[NET_IF_NUM - 1], len);
|
||||||
|
//__rtl_memDump_v1_00(pbuf, len, "ethernet_receive Data:");
|
||||||
|
//rtw_memset(pbuf, 0, len);
|
||||||
|
}else if(len == 0){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit:
|
||||||
|
rtw_free_sema(&mii_rx_sema);
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dhcp_start_mii(void* param)
|
||||||
|
{
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
if (rtw_down_sema(&mii_linkup_sema) == _FAIL){
|
||||||
|
DBG_8195A("%s, Take Semaphore Fail\n", __FUNCTION__);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
LwIP_DHCP(NET_IF_NUM - 1, DHCP_START);
|
||||||
|
}
|
||||||
|
rtw_free_sema(&mii_linkup_sema);
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void mii_intr_handler(u32 Event, u32 Data)
|
||||||
|
{
|
||||||
|
switch(Event)
|
||||||
|
{
|
||||||
|
case ETH_TXDONE:
|
||||||
|
//DBG_8195A("TX Data = %d\n", Data);
|
||||||
|
break;
|
||||||
|
case ETH_RXDONE:
|
||||||
|
//DBG_8195A("\r\nRX Data = %d\n", Data);
|
||||||
|
// wake up rx thread to receive data
|
||||||
|
rtw_up_sema_from_isr(&mii_rx_sema);
|
||||||
|
break;
|
||||||
|
case ETH_LINKUP:
|
||||||
|
DBG_8195A("Link Up\n");
|
||||||
|
|
||||||
|
if(dhcp_ethernet_mii == 1)
|
||||||
|
rtw_up_sema_from_isr(&mii_linkup_sema);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ETH_LINKDOWN:
|
||||||
|
DBG_8195A("Link Down\n");
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DBG_8195A("Unknown event !!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ethernet_demo(void* param){
|
||||||
|
u8 mac[6];
|
||||||
|
/* Initilaize the LwIP stack */
|
||||||
|
// can not init twice
|
||||||
|
if(!lwip_init_done)
|
||||||
|
LwIP_Init();
|
||||||
|
DBG_8195A("LWIP Init done\n");
|
||||||
|
|
||||||
|
ethernet_irq_hook(mii_intr_handler);
|
||||||
|
|
||||||
|
if(pTmpTxDesc)
|
||||||
|
{
|
||||||
|
free(pTmpTxDesc);
|
||||||
|
pTmpTxDesc = NULL;
|
||||||
|
}
|
||||||
|
if(pTmpRxDesc)
|
||||||
|
{
|
||||||
|
free(pTmpRxDesc);
|
||||||
|
pTmpRxDesc = NULL;
|
||||||
|
}
|
||||||
|
if(pTmpTxPktBuf)
|
||||||
|
{
|
||||||
|
free(pTmpTxPktBuf);
|
||||||
|
pTmpTxPktBuf = NULL;
|
||||||
|
}
|
||||||
|
if(pTmpRxPktBuf)
|
||||||
|
{
|
||||||
|
free(pTmpRxPktBuf);
|
||||||
|
pTmpRxPktBuf = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pTmpTxDesc = (u8 *)malloc(/*MII_TX_DESC_CNT*/MII_TX_DESC_NO * ETH_TX_DESC_SIZE);
|
||||||
|
pTmpRxDesc = (u8 *)malloc(/*MII_RX_DESC_CNT*/MII_RX_DESC_NO * ETH_RX_DESC_SIZE);
|
||||||
|
pTmpTxPktBuf = (u8 *)malloc(/*MII_TX_DESC_CNT*/MII_TX_DESC_NO * ETH_PKT_BUF_SIZE);
|
||||||
|
pTmpRxPktBuf = (u8 *)malloc(/*MII_RX_DESC_CNT*/MII_RX_DESC_NO * ETH_PKT_BUF_SIZE);
|
||||||
|
if(pTmpTxDesc == NULL || pTmpRxDesc == NULL || pTmpTxPktBuf == NULL || pTmpRxPktBuf == NULL)
|
||||||
|
{
|
||||||
|
printf("TX/RX descriptor malloc fail\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memset(pTmpTxDesc, 0, MII_TX_DESC_NO * ETH_TX_DESC_SIZE);
|
||||||
|
memset(pTmpRxDesc, 0, MII_RX_DESC_NO * ETH_RX_DESC_SIZE);
|
||||||
|
memset(pTmpTxPktBuf, 0, MII_TX_DESC_NO * ETH_PKT_BUF_SIZE);
|
||||||
|
memset(pTmpRxPktBuf, 0, MII_RX_DESC_NO * ETH_PKT_BUF_SIZE);
|
||||||
|
//size 160 128 12288 12288
|
||||||
|
|
||||||
|
ethernet_set_descnum(MII_TX_DESC_NO, MII_RX_DESC_NO);
|
||||||
|
printf("TRX descriptor number setting done\n");
|
||||||
|
ethernet_trx_pre_setting(pTmpTxDesc, pTmpRxDesc, pTmpTxPktBuf, pTmpRxPktBuf);
|
||||||
|
printf("TRX pre setting done\n");
|
||||||
|
|
||||||
|
ethernet_init();
|
||||||
|
|
||||||
|
DBG_INFO_MSG_OFF(_DBG_MII_);
|
||||||
|
DBG_WARN_MSG_OFF(_DBG_MII_);
|
||||||
|
DBG_ERR_MSG_ON(_DBG_MII_);
|
||||||
|
|
||||||
|
/*get mac*/
|
||||||
|
ethernet_address(mac);
|
||||||
|
memcpy((void*)xnetif[NET_IF_NUM - 1].hwaddr,(void*)mac, 6);
|
||||||
|
|
||||||
|
rtw_init_sema(&mii_rx_sema,0);
|
||||||
|
rtw_mutex_init(&mii_tx_mutex);
|
||||||
|
|
||||||
|
if(xTaskCreate(mii_rx_thread, ((const char*)"mii_rx_thread"), 1024, NULL, tskIDLE_PRIORITY+5, NULL) != pdPASS)
|
||||||
|
DBG_8195A("\n\r%s xTaskCreate(mii_rx_thread) failed", __FUNCTION__);
|
||||||
|
|
||||||
|
DBG_8195A("\nEthernet_mii Init done, interface %d",NET_IF_NUM - 1);
|
||||||
|
|
||||||
|
if(dhcp_ethernet_mii == 1)
|
||||||
|
LwIP_DHCP(NET_IF_NUM - 1, DHCP_START);
|
||||||
|
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ethernet_mii_init()
|
||||||
|
{
|
||||||
|
printf("\ninitializing Ethernet_mii......\n");
|
||||||
|
|
||||||
|
// set the ethernet interface as default
|
||||||
|
ethernet_if_default = 1;
|
||||||
|
rtw_init_sema(&mii_linkup_sema,0);
|
||||||
|
|
||||||
|
if( xTaskCreate((TaskFunction_t)dhcp_start_mii, "DHCP_START_MII", 1024, NULL, 2, NULL) != pdPASS) {
|
||||||
|
DBG_8195A("Cannot create demo task\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xTaskCreate((TaskFunction_t)ethernet_demo, "ETHERNET DEMO", 1024, NULL, 2, NULL) != pdPASS) {
|
||||||
|
DBG_8195A("Cannot create demo task\n\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rltk_mii_recv(struct eth_drv_sg *sg_list, int sg_len){
|
||||||
|
struct eth_drv_sg *last_sg;
|
||||||
|
u8* pbuf = RX_BUFFER;
|
||||||
|
|
||||||
|
for (last_sg = &sg_list[sg_len]; sg_list < last_sg; ++sg_list) {
|
||||||
|
if (sg_list->buf != 0) {
|
||||||
|
rtw_memcpy((void *)(sg_list->buf), pbuf, sg_list->len);
|
||||||
|
pbuf+=sg_list->len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
s8 rltk_mii_send(struct eth_drv_sg *sg_list, int sg_len, int total_len){
|
||||||
|
int ret =0;
|
||||||
|
struct eth_drv_sg *last_sg;
|
||||||
|
u8* pdata = TX_BUFFER;
|
||||||
|
u8 retry_cnt = 0;
|
||||||
|
u32 size = 0;
|
||||||
|
for (last_sg = &sg_list[sg_len]; sg_list < last_sg; ++sg_list) {
|
||||||
|
rtw_memcpy(pdata, (void *)(sg_list->buf), sg_list->len);
|
||||||
|
pdata += sg_list->len;
|
||||||
|
size += sg_list->len;
|
||||||
|
}
|
||||||
|
pdata = TX_BUFFER;
|
||||||
|
//DBG_8195A("mii_send len= %d\n\r", size);
|
||||||
|
rtw_mutex_get(&mii_tx_mutex);
|
||||||
|
while(1){
|
||||||
|
ret = ethernet_write(pdata, size);
|
||||||
|
if(ret > 0){
|
||||||
|
ethernet_send();
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(++retry_cnt > 3){
|
||||||
|
DBG_8195A("TX drop\n\r");
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rtw_udelay_os(1);
|
||||||
|
}
|
||||||
|
rtw_mutex_put(&mii_tx_mutex);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //CONFIG_MII_EN
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef __MII_ETHERNETIF_H__
|
||||||
|
#define __MII_ETHERNETIF_H__
|
||||||
|
|
||||||
|
#include "lwip_netconf.h"
|
||||||
|
|
||||||
|
#define MII_TX_DESC_CNT 4
|
||||||
|
#define MII_RX_DESC_CNT 10
|
||||||
|
|
||||||
|
extern s8 rltk_mii_send(struct eth_drv_sg *sg_list, int sg_len, int total_len);
|
||||||
|
extern void rltk_mii_recv(struct eth_drv_sg *sg_list, int sg_len);
|
||||||
|
|
||||||
|
#endif // __MII_ETHERNETIF_H__
|
|
@ -0,0 +1,39 @@
|
||||||
|
#ifndef _SD_DRIVER_H
|
||||||
|
#define _SD_DRIVER_H
|
||||||
|
|
||||||
|
#include "basic_types.h"
|
||||||
|
|
||||||
|
#define CONFIG_SD_SDIO 1
|
||||||
|
#define CONFIG_SD_SPI 0
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SD_OK = 0,
|
||||||
|
SD_NODISK,
|
||||||
|
SD_INITERR,
|
||||||
|
SD_PROTECTED,
|
||||||
|
SD_ERROR,
|
||||||
|
}SD_RESULT;
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
SD_CLK_LOW,
|
||||||
|
SD_CLK_MID,
|
||||||
|
SD_CLK_HIGH,
|
||||||
|
SD_CLK_RSV,
|
||||||
|
}SD_CLK;
|
||||||
|
|
||||||
|
SD_RESULT SD_WaitReady(void);
|
||||||
|
SD_RESULT SD_Init(void);
|
||||||
|
SD_RESULT SD_DeInit(void);
|
||||||
|
SD_RESULT SD_SetCLK(SD_CLK CLK);
|
||||||
|
|
||||||
|
SD_RESULT SD_Status(void);
|
||||||
|
|
||||||
|
SD_RESULT SD_GetCID(u8 *cid_data); // read sd card CID
|
||||||
|
SD_RESULT SD_GetCSD(u8 *csd_data); // read sd card CSD
|
||||||
|
SD_RESULT SD_GetCapacity(u32* sector_count); // read sd card Capacity
|
||||||
|
|
||||||
|
SD_RESULT SD_ReadBlocks(u32 sector,u8 *data,u32 count); //read multi sector
|
||||||
|
SD_RESULT SD_WriteBlocks(u32 sector,const u8 *data,u32 count); //write multi sector
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef _SDIO_HOST_H
|
||||||
|
#define _SDIO_HOST_H
|
||||||
|
#include "basic_types.h"
|
||||||
|
#include "rtl8195a_sdio_host.h"
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
SDIO_INIT_NONE = -1,
|
||||||
|
SDIO_INIT_FAIL = 0,
|
||||||
|
SDIO_INIT_OK = 1,
|
||||||
|
SDIO_SD_NONE = 2,
|
||||||
|
SDIO_SD_OK = 3,
|
||||||
|
}_sdio_init_s;
|
||||||
|
|
||||||
|
|
||||||
|
s8 sdio_init_host(void); // init sdio host interface
|
||||||
|
void sdio_deinit_host(void);
|
||||||
|
|
||||||
|
s8 sdio_sd_init(void); // init sd card through sdio
|
||||||
|
void sdio_sd_deinit(void); //de-init sd card through sdio
|
||||||
|
s8 sdio_sd_status(void);
|
||||||
|
u32 sdio_sd_getCapacity(void);
|
||||||
|
s8 sdio_sd_getProtection(void);
|
||||||
|
s8 sdio_sd_setProtection(bool protected);
|
||||||
|
s8 sdio_sd_getCSD(u8* CSD);
|
||||||
|
s8 sdio_sd_isReady();
|
||||||
|
s8 sdio_sd_setClock(SD_CLK_FREQUENCY SDCLK);
|
||||||
|
|
||||||
|
|
||||||
|
s8 sdio_read_blocks(u32 sector, u8 *buffer, u32 count);
|
||||||
|
s8 sdio_write_blocks(u32 sector, const u8 *buffer, u32 count);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,71 @@
|
||||||
|
#ifndef __LINUX_UVCVIDEO_H_
|
||||||
|
#define __LINUX_UVCVIDEO_H_
|
||||||
|
#if 0
|
||||||
|
#include <linux/ioctl.h>
|
||||||
|
#include <linux/types.h>
|
||||||
|
#endif
|
||||||
|
#include "uvc_os_wrap_via_osdep_api.h"
|
||||||
|
/*
|
||||||
|
* Dynamic controls
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Data types for UVC control data */
|
||||||
|
#define UVC_CTRL_DATA_TYPE_RAW 0
|
||||||
|
#define UVC_CTRL_DATA_TYPE_SIGNED 1
|
||||||
|
#define UVC_CTRL_DATA_TYPE_UNSIGNED 2
|
||||||
|
#define UVC_CTRL_DATA_TYPE_BOOLEAN 3
|
||||||
|
#define UVC_CTRL_DATA_TYPE_ENUM 4
|
||||||
|
#define UVC_CTRL_DATA_TYPE_BITMASK 5
|
||||||
|
|
||||||
|
/* Control flags */
|
||||||
|
#define UVC_CTRL_FLAG_SET_CUR (1 << 0)
|
||||||
|
#define UVC_CTRL_FLAG_GET_CUR (1 << 1)
|
||||||
|
#define UVC_CTRL_FLAG_GET_MIN (1 << 2)
|
||||||
|
#define UVC_CTRL_FLAG_GET_MAX (1 << 3)
|
||||||
|
#define UVC_CTRL_FLAG_GET_RES (1 << 4)
|
||||||
|
#define UVC_CTRL_FLAG_GET_DEF (1 << 5)
|
||||||
|
/* Control should be saved at suspend and restored at resume. */
|
||||||
|
#define UVC_CTRL_FLAG_RESTORE (1 << 6)
|
||||||
|
/* Control can be updated by the camera. */
|
||||||
|
#define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7)
|
||||||
|
|
||||||
|
#define UVC_CTRL_FLAG_GET_RANGE \
|
||||||
|
(UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \
|
||||||
|
UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \
|
||||||
|
UVC_CTRL_FLAG_GET_DEF)
|
||||||
|
|
||||||
|
struct uvc_menu_info {
|
||||||
|
__u32 value;
|
||||||
|
__u8 name[32];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_xu_control_mapping {
|
||||||
|
__u32 id;
|
||||||
|
__u8 name[32];
|
||||||
|
__u8 entity[16];
|
||||||
|
__u8 selector;
|
||||||
|
|
||||||
|
__u8 size;
|
||||||
|
__u8 offset;
|
||||||
|
__u32 v4l2_type;
|
||||||
|
__u32 data_type;
|
||||||
|
|
||||||
|
struct uvc_menu_info __user *menu_info;
|
||||||
|
__u32 menu_count;
|
||||||
|
|
||||||
|
__u32 reserved[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_xu_control_query {
|
||||||
|
__u8 unit;
|
||||||
|
__u8 selector;
|
||||||
|
__u8 query; /* Video Class-Specific Request Code, */
|
||||||
|
/* defined in linux/usb/video.h A.8. */
|
||||||
|
__u16 size;
|
||||||
|
__u8 __user *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define UVCIOC_CTRL_MAP _IOWR('u', 0x20, struct uvc_xu_control_mapping)
|
||||||
|
#define UVCIOC_CTRL_QUERY _IOWR('u', 0x21, struct uvc_xu_control_query)
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,54 @@
|
||||||
|
#ifndef _UVC_INTF_H_
|
||||||
|
#define _UVC_INTF_H_
|
||||||
|
|
||||||
|
enum uvc_format_type{
|
||||||
|
UVC_FORMAT_MJPEG = 1,
|
||||||
|
UVC_FORMAT_H264 = 2,
|
||||||
|
UVC_FORMAT_UNKNOWN = -1,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum uvc_format_type uvc_fmt_t;
|
||||||
|
|
||||||
|
struct uvc_context
|
||||||
|
{
|
||||||
|
uvc_fmt_t fmt_type; //video format type
|
||||||
|
int width;//video frame width
|
||||||
|
int height;//video frame height
|
||||||
|
int frame_rate;//video frame rate
|
||||||
|
int compression_ratio;//compression format video compression ratio
|
||||||
|
};
|
||||||
|
|
||||||
|
#define USER_CTRL_SATURATION 1
|
||||||
|
|
||||||
|
struct uvc_user_ctrl
|
||||||
|
{
|
||||||
|
u32 ctrl_id;
|
||||||
|
s32 ctrl_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_buf_context
|
||||||
|
{
|
||||||
|
int index; //index of internal uvc buffer
|
||||||
|
unsigned char *data; //address of uvc data
|
||||||
|
int len; //length of uvc data
|
||||||
|
u32 timestamp; //timestamp
|
||||||
|
};
|
||||||
|
|
||||||
|
int uvc_stream_init(void); //entry function to start uvc
|
||||||
|
void uvc_stream_free(void); // free streaming resources
|
||||||
|
int uvc_is_stream_ready(void); // return true if uvc device is initialized successfully
|
||||||
|
int uvc_is_stream_on(void); //return true if uvc device is streaming now
|
||||||
|
int uvc_stream_on(void); //enable camera streaming
|
||||||
|
void uvc_stream_off(void); //disable camera streaming
|
||||||
|
int uvc_set_param(uvc_fmt_t fmt_type, int *width, int *height, int *frame_rate, int *compression_ratio);//set camera streaming video parameters:video format, resolution and frame rate.
|
||||||
|
int uvc_get_user_ctrl(struct uvc_user_ctrl *user_ctrl);
|
||||||
|
int uvc_set_user_ctrl(struct uvc_user_ctrl *user_ctrl);
|
||||||
|
int uvc_buf_check(struct uvc_buf_context *b); //check if uvc_buf_context is legal (return 0 is legal otherwise -1)
|
||||||
|
int uvc_dqbuf(struct uvc_buf_context *b); //dequeue internal buffer & get internal buffer info
|
||||||
|
int uvc_qbuf(struct uvc_buf_context *b); //queue internal buffer
|
||||||
|
int is_pure_thru_on(void); //return 1 if pure throughput test mode is on otherwise return 0
|
||||||
|
void uvc_pure_thru_on(void); //turn on pure uvc throughput test mode (i.e. no decoding is involved)
|
||||||
|
void uvc_dec_thru_on(void); //turn on uvc throughput test mode with uvc payload decoding
|
||||||
|
void uvc_thru_off(void); //turn off uvc throughput log service
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,570 @@
|
||||||
|
#ifndef _UVC_OSDEP_WRAP_H_
|
||||||
|
#define _UVC_OSDEP_WRAP_H_
|
||||||
|
|
||||||
|
//#include "rtl_utility.h"
|
||||||
|
#include "platform/platform_stdlib.h"
|
||||||
|
#include "basic_types.h"
|
||||||
|
#include "osdep_api.h"
|
||||||
|
#include "usb_defs.h"
|
||||||
|
|
||||||
|
#include "errno.h"
|
||||||
|
#include "dlist.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define UVC_LAYER_DEBUG 0
|
||||||
|
#if UVC_LAYER_DEBUG
|
||||||
|
#define UVC_PRINTF(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||||
|
#define UVC_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||||
|
#define FUN_ENTER //printf("\n\r%s ==>\n", __func__)
|
||||||
|
#define FUN_EXIT //printf("\n\r%s <==\n", __func__)
|
||||||
|
#define FUN_TRACE //printf("\n\r%s:%d \n", __func__, __LINE__)
|
||||||
|
#else
|
||||||
|
#define UVC_PRINTF(fmt, args...)
|
||||||
|
#define UVC_ERROR(fmt, args...) printf("\n\r%s: " fmt, __FUNCTION__, ## args)
|
||||||
|
#define FUN_ENTER
|
||||||
|
#define FUN_EXIT
|
||||||
|
#define FUN_TRACE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* add by Ian -- define uvc task priority */
|
||||||
|
#define UVC_TASK_PRIORITY 2
|
||||||
|
|
||||||
|
#ifndef __u8
|
||||||
|
#define __u8 u8
|
||||||
|
#endif
|
||||||
|
#ifndef __u16
|
||||||
|
#define __u16 u16
|
||||||
|
#endif
|
||||||
|
#ifndef __u32
|
||||||
|
#define __u32 u32
|
||||||
|
#endif
|
||||||
|
#ifndef __u64
|
||||||
|
#define __u64 u64
|
||||||
|
#endif
|
||||||
|
#ifndef __s8
|
||||||
|
#define __s8 s8
|
||||||
|
#endif
|
||||||
|
#ifndef __s16
|
||||||
|
#define __s16 s16
|
||||||
|
#endif
|
||||||
|
#ifndef __s32
|
||||||
|
#define __s32 s32
|
||||||
|
#endif
|
||||||
|
#ifndef __s64
|
||||||
|
#define __s64 s64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef gfp_t
|
||||||
|
#define gfp_t u32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ALIGN(x, a, type_of_x) (((x) + ((type_of_x)(a) - 1)) & ~((type_of_x)(a) - 1))
|
||||||
|
|
||||||
|
#ifndef IS_ALIGNED
|
||||||
|
#define IS_ALIGNED(x, a, type_of_x) (((x) & ((type_of_x)(a) - 1)) == 0)
|
||||||
|
#endif
|
||||||
|
#ifndef ARRAY_SIZE
|
||||||
|
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BITS_PER_LONG
|
||||||
|
#define BITS_PER_LONG (32)
|
||||||
|
#endif
|
||||||
|
#ifndef BITS_PER_LONG_LONG
|
||||||
|
#define BITS_PER_LONG_LONG (32)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Atomic integer operations */
|
||||||
|
#ifndef atomic_set
|
||||||
|
#define atomic_set(v, i) RTL_ATOMIC_SET((v), (i))
|
||||||
|
#endif
|
||||||
|
#ifndef atomic_read
|
||||||
|
#define atomic_read(v) RTL_ATOMIC_READ((v))
|
||||||
|
#endif
|
||||||
|
#ifndef atomic_add
|
||||||
|
#define atomic_add(v, i) RTL_ATOMIC_ADD((v), (i))
|
||||||
|
#endif
|
||||||
|
#ifndef atomic_sub
|
||||||
|
#define atomic_sub(v, i) RTL_ATOMIC_SUB((v), (i))
|
||||||
|
#endif
|
||||||
|
#ifndef atomic_inc
|
||||||
|
#define atomic_inc(v) RTL_ATOMIC_INC((v))
|
||||||
|
#endif
|
||||||
|
#ifndef atomic_dec
|
||||||
|
#define atomic_dec(v) RTL_ATOMIC_DEC((v))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MEDIA_PAD_FL_SINK
|
||||||
|
#define MEDIA_PAD_FL_SINK (1 << 0)
|
||||||
|
#endif
|
||||||
|
#ifndef MEDIA_PAD_FL_SOURCE
|
||||||
|
#define MEDIA_PAD_FL_SOURCE (1 << 1)
|
||||||
|
#endif
|
||||||
|
#ifndef MEDIA_PAD_FL_MUST_CONNECT
|
||||||
|
#define MEDIA_PAD_FL_MUST_CONNECT (1 << 2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline u16 __get_unaligned_le16(const u8 *p)
|
||||||
|
{
|
||||||
|
return p[0] | p[1] << 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 __get_unaligned_le32(const u8 *p)
|
||||||
|
{
|
||||||
|
return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u64 __get_unaligned_le64(const u8 *p)
|
||||||
|
{
|
||||||
|
return (u64)__get_unaligned_le32(p + 4) << 32 |
|
||||||
|
__get_unaligned_le32(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __put_unaligned_le16(u16 val, u8 *p)
|
||||||
|
{
|
||||||
|
*p++ = val;
|
||||||
|
*p++ = val >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __put_unaligned_le32(u32 val, u8 *p)
|
||||||
|
{
|
||||||
|
__put_unaligned_le16(val >> 16, p + 2);
|
||||||
|
__put_unaligned_le16(val, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __put_unaligned_le64(u64 val, u8 *p)
|
||||||
|
{
|
||||||
|
__put_unaligned_le32(val >> 32, p + 4);
|
||||||
|
__put_unaligned_le32(val, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u16 get_unaligned_le16(const void *p)
|
||||||
|
{
|
||||||
|
return __get_unaligned_le16((const u8 *)p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u32 get_unaligned_le32(const void *p)
|
||||||
|
{
|
||||||
|
return __get_unaligned_le32((const u8 *)p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u64 get_unaligned_le64(const void *p)
|
||||||
|
{
|
||||||
|
return __get_unaligned_le64((const u8 *)p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void put_unaligned_le16(u16 val, void *p)
|
||||||
|
{
|
||||||
|
__put_unaligned_le16(val, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void put_unaligned_le32(u32 val, void *p)
|
||||||
|
{
|
||||||
|
__put_unaligned_le32(val, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void put_unaligned_le64(u64 val, void *p)
|
||||||
|
{
|
||||||
|
__put_unaligned_le64(val, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kmemdup - duplicate region of memory
|
||||||
|
*
|
||||||
|
* @src: memory region to duplicate
|
||||||
|
* @len: memory region length
|
||||||
|
* @gfp: GFP mask to use
|
||||||
|
*/
|
||||||
|
static inline void *kmemdup(const void *src, size_t len, gfp_t gfp)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
//p = kmalloc_track_caller(len, gfp);
|
||||||
|
//p = kmalloc(len, gfp);
|
||||||
|
p = malloc(len);
|
||||||
|
if (p)
|
||||||
|
memcpy(p, src, len);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
#ifndef __force
|
||||||
|
#define __force __attribute__((force))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
typedef __u16 __bitwise __le16;
|
||||||
|
typedef __u16 __bitwise __be16;
|
||||||
|
typedef __u32 __bitwise __le32;
|
||||||
|
typedef __u32 __bitwise __be32;
|
||||||
|
typedef __u64 __bitwise __le64;
|
||||||
|
typedef __u64 __bitwise __be64;
|
||||||
|
typedef __u16 __bitwise __sum16;
|
||||||
|
typedef __u32 __bitwise __wsum;
|
||||||
|
#endif
|
||||||
|
//edit by Ian -- remove duplicated definitions
|
||||||
|
#if 0
|
||||||
|
typedef __u16 __le16;
|
||||||
|
typedef __u16 __be16;
|
||||||
|
typedef __u32 __le32;
|
||||||
|
typedef __u32 __be32;
|
||||||
|
typedef __u64 __le64;
|
||||||
|
typedef __u64 __be64;
|
||||||
|
typedef __u16 __sum16;
|
||||||
|
typedef __u32 __wsum;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __le16
|
||||||
|
#define __le16 __u16
|
||||||
|
#endif
|
||||||
|
#ifndef __be16
|
||||||
|
#define __be16 __u16
|
||||||
|
#endif
|
||||||
|
#ifndef __le32
|
||||||
|
#define __le32 __u32
|
||||||
|
#endif
|
||||||
|
#ifndef __be32
|
||||||
|
#define __be32 __u32
|
||||||
|
#endif
|
||||||
|
static inline __u32 le32_to_cpup(const __le32 *p)
|
||||||
|
{
|
||||||
|
//return (__force __u32)*p;
|
||||||
|
return (__u32)*p;
|
||||||
|
}
|
||||||
|
static inline __u16 le16_to_cpup(const __le16 *p)
|
||||||
|
{
|
||||||
|
//return (__force __u16)*p;
|
||||||
|
return (__u16)*p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Endian macros */
|
||||||
|
#ifndef htonl
|
||||||
|
#define htonl(x) rtk_cpu_to_be32(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ntohl
|
||||||
|
#define ntohl(x) rtk_be32_to_cpu(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef htons
|
||||||
|
#define htons(x) rtk_cpu_to_be16(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ntohs
|
||||||
|
#define ntohs(x) rtk_be16_to_cpu(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cpu_to_le32
|
||||||
|
#define cpu_to_le32(x) rtk_cpu_to_le32(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef le32_to_cpu
|
||||||
|
#define le32_to_cpu(x) rtk_le32_to_cpu(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cpu_to_le16
|
||||||
|
#define cpu_to_le16(x) rtk_cpu_to_le16(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef le16_to_cpu
|
||||||
|
#define le16_to_cpu(x) rtk_le16_to_cpu(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cpu_to_be32
|
||||||
|
#define cpu_to_be32(x) rtk_cpu_to_be32(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef be32_to_cpu
|
||||||
|
#define be32_to_cpu(x) rtk_be32_to_cpu(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cpu_to_be16
|
||||||
|
#define cpu_to_be16(x) rtk_cpu_to_be16(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef be16_to_cpu
|
||||||
|
#define be16_to_cpu(x) rtk_be16_to_cpu(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Parameters used to convert the timespec values: */
|
||||||
|
#ifndef MSEC_PER_SEC
|
||||||
|
#define MSEC_PER_SEC 1000L
|
||||||
|
#endif
|
||||||
|
#ifndef USEC_PER_MSEC
|
||||||
|
#define USEC_PER_MSEC 1000L
|
||||||
|
#endif
|
||||||
|
#ifndef NSEC_PER_USEC
|
||||||
|
#define NSEC_PER_USEC 1000L
|
||||||
|
#endif
|
||||||
|
#ifndef NSEC_PER_MSEC
|
||||||
|
#define NSEC_PER_MSEC 1000000L
|
||||||
|
#endif
|
||||||
|
#ifndef USEC_PER_SEC
|
||||||
|
#define USEC_PER_SEC 1000000L
|
||||||
|
#endif
|
||||||
|
#ifndef NSEC_PER_SEC
|
||||||
|
#define NSEC_PER_SEC 1000000000L
|
||||||
|
#endif
|
||||||
|
#ifndef FSEC_PER_SEC
|
||||||
|
#define FSEC_PER_SEC 1000000000000000LL
|
||||||
|
#endif
|
||||||
|
#ifndef TIME_T_MAX
|
||||||
|
#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __GFP_WAIT
|
||||||
|
#define __GFP_WAIT (0x10u)
|
||||||
|
#endif
|
||||||
|
#ifndef __GFP_HIGH
|
||||||
|
#define __GFP_HIGH (0x20u)
|
||||||
|
#endif
|
||||||
|
#ifndef __GFP_IO
|
||||||
|
#define __GFP_IO (0x40u)
|
||||||
|
#endif
|
||||||
|
#ifndef __GFP_FS
|
||||||
|
#define __GFP_FS (0x80u)
|
||||||
|
#endif
|
||||||
|
#ifndef GFP_NOIO
|
||||||
|
#define GFP_NOIO (0x10u)
|
||||||
|
#endif
|
||||||
|
#ifndef __GFP_NOWARN
|
||||||
|
#define __GFP_NOWARN (0x200u)
|
||||||
|
#endif
|
||||||
|
#ifndef GFP_KERNEL
|
||||||
|
#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef copy_from_user
|
||||||
|
#define copy_from_user(to, from, sz) RtlMemcpy((to), (from), (sz))
|
||||||
|
#endif
|
||||||
|
#ifndef copy_to_user
|
||||||
|
#define copy_to_user(to, from, sz) RtlMemcpy((to), (from), (sz))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef u32 compat_caddr_t; //used for compatibility in uvc_v4l2.c
|
||||||
|
|
||||||
|
/**
|
||||||
|
* strlcpy - Copy a %NUL terminated string into a sized buffer
|
||||||
|
* @dest: Where to copy the string to
|
||||||
|
* @src: Where to copy the string from
|
||||||
|
* @size: size of destination buffer
|
||||||
|
*
|
||||||
|
* Compatible with *BSD: the result is always a valid
|
||||||
|
* NUL-terminated string that fits in the buffer (unless,
|
||||||
|
* of course, the buffer size is zero). It does not pad
|
||||||
|
* out the result like strncpy() does.
|
||||||
|
*/
|
||||||
|
static inline size_t strlcpy(char *dest, const char *src, size_t size)
|
||||||
|
{
|
||||||
|
size_t ret = _strlen(src);
|
||||||
|
|
||||||
|
if (size) {
|
||||||
|
size_t len = (ret >= size) ? size - 1 : ret;
|
||||||
|
memcpy(dest, src, len);
|
||||||
|
dest[len] = '\0';
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clamp - return a value clamped to a given range with strict typechecking
|
||||||
|
* @val: current value
|
||||||
|
* @min: minimum allowable value
|
||||||
|
* @max: maximum allowable value
|
||||||
|
*
|
||||||
|
* This macro does strict typechecking of min/max to make sure they are of the
|
||||||
|
* same type as val. See the unnecessary pointer comparisons.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef clamp
|
||||||
|
#define clamp(new_val, val, min, max, type) do{ \
|
||||||
|
type __val = (val); \
|
||||||
|
type __min = (min); \
|
||||||
|
type __max = (max); \
|
||||||
|
(void) (&__val == &__min); \
|
||||||
|
(void) (&__val == &__max); \
|
||||||
|
__val = (__val < __min) ? __min: __val; \
|
||||||
|
new_val = (__val > __max) ? __max: __val; }while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compile time versions of __arch_hweightN()
|
||||||
|
*/
|
||||||
|
#ifndef __const_hweight8
|
||||||
|
#define __const_hweight8(w) \
|
||||||
|
( (!!((w) & (1ULL << 0))) + \
|
||||||
|
(!!((w) & (1ULL << 1))) + \
|
||||||
|
(!!((w) & (1ULL << 2))) + \
|
||||||
|
(!!((w) & (1ULL << 3))) + \
|
||||||
|
(!!((w) & (1ULL << 4))) + \
|
||||||
|
(!!((w) & (1ULL << 5))) + \
|
||||||
|
(!!((w) & (1ULL << 6))) + \
|
||||||
|
(!!((w) & (1ULL << 7))) )
|
||||||
|
#endif
|
||||||
|
#ifndef hweight8
|
||||||
|
#define hweight8(w) __const_hweight8(w)
|
||||||
|
#endif
|
||||||
|
#ifndef BITMAP_LAST_WORD_MASK
|
||||||
|
#define BITMAP_LAST_WORD_MASK(nbits) \
|
||||||
|
( \
|
||||||
|
((nbits) % BITS_PER_LONG) ? \
|
||||||
|
(1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
|
||||||
|
)
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* hweightN - returns the hamming weight of a N-bit word
|
||||||
|
* @x: the word to weigh
|
||||||
|
*
|
||||||
|
* The Hamming Weight of a number is the total number of bits set in it.
|
||||||
|
*/
|
||||||
|
static inline unsigned int hweight32(unsigned int w)
|
||||||
|
{
|
||||||
|
unsigned int res = w - ((w >> 1) & 0x55555555);
|
||||||
|
res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
|
||||||
|
res = (res + (res >> 4)) & 0x0F0F0F0F;
|
||||||
|
res = res + (res >> 8);
|
||||||
|
return (res + (res >> 16)) & 0x000000FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned long hweight64(__u64 w)
|
||||||
|
{
|
||||||
|
#if BITS_PER_LONG == 32
|
||||||
|
return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w);
|
||||||
|
#elif BITS_PER_LONG == 64
|
||||||
|
__u64 res = w - ((w >> 1) & 0x5555555555555555ul);
|
||||||
|
res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
|
||||||
|
res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful;
|
||||||
|
res = res + (res >> 8);
|
||||||
|
res = res + (res >> 16);
|
||||||
|
return (res + (res >> 32)) & 0x00000000000000FFul;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline unsigned long hweight_long(unsigned long w)
|
||||||
|
{
|
||||||
|
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int __bitmap_weight(const unsigned long *bitmap, int bits)
|
||||||
|
{
|
||||||
|
int k, w = 0, lim = bits/BITS_PER_LONG;
|
||||||
|
|
||||||
|
for (k = 0; k < lim; k++)
|
||||||
|
w += hweight_long(bitmap[k]);
|
||||||
|
|
||||||
|
if (bits % BITS_PER_LONG)
|
||||||
|
w += hweight_long(bitmap[k] & BITMAP_LAST_WORD_MASK(bits));
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int bitmap_weight(const unsigned long *src, int nbits)
|
||||||
|
{
|
||||||
|
// if (small_const_nbits(nbits))
|
||||||
|
// return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
|
||||||
|
return __bitmap_weight(src, nbits);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* memweight - count the total number of bits set in memory area
|
||||||
|
* @ptr: pointer to the start of the area
|
||||||
|
* @bytes: the size of the area
|
||||||
|
*/
|
||||||
|
static inline size_t memweight(const void *ptr, size_t bytes)
|
||||||
|
{
|
||||||
|
size_t ret = 0;
|
||||||
|
size_t longs;
|
||||||
|
const unsigned char *bitmap = ptr;
|
||||||
|
|
||||||
|
for (; bytes > 0 && ((unsigned long)bitmap) % sizeof(long);
|
||||||
|
bytes--, bitmap++)
|
||||||
|
ret += hweight8(*bitmap);
|
||||||
|
|
||||||
|
longs = bytes / sizeof(long);
|
||||||
|
if (longs) {
|
||||||
|
//BUG_ON(longs >= INT_MAX / BITS_PER_LONG);
|
||||||
|
ret += bitmap_weight((unsigned long *)bitmap, longs * BITS_PER_LONG);
|
||||||
|
bytes -= longs * sizeof(long);
|
||||||
|
bitmap += longs * sizeof(long);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* The reason that this last loop is distinct from the preceding
|
||||||
|
* bitmap_weight() call is to compute 1-bits in the last region smaller
|
||||||
|
* than sizeof(long) properly on big-endian systems.
|
||||||
|
*/
|
||||||
|
for (; bytes > 0; bytes--, bitmap++)
|
||||||
|
ret += hweight8(*bitmap);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* strlcat - Append a length-limited, %NUL-terminated string to another
|
||||||
|
* @dest: The string to be appended to
|
||||||
|
* @src: The string to append to it
|
||||||
|
* @count: The size of the destination buffer.
|
||||||
|
*/
|
||||||
|
static inline size_t strlcat(char *dest, const char *src, size_t count)
|
||||||
|
{
|
||||||
|
size_t dsize = _strlen(dest);
|
||||||
|
size_t len = _strlen(src);
|
||||||
|
size_t res = dsize + len;
|
||||||
|
|
||||||
|
/* This would be a bug */
|
||||||
|
//BUG_ON(dsize >= count);
|
||||||
|
|
||||||
|
dest += dsize;
|
||||||
|
count -= dsize;
|
||||||
|
if (len >= count)
|
||||||
|
len = count-1;
|
||||||
|
memcpy(dest, src, len);
|
||||||
|
dest[len] = 0;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* atomic_dec_and_test - decrement and test
|
||||||
|
* @v: pointer of type atomic_t
|
||||||
|
*
|
||||||
|
* Atomically decrements @v by 1 and
|
||||||
|
* returns true if the result is 0, or false for all other
|
||||||
|
* cases.
|
||||||
|
*/
|
||||||
|
static inline int atomic_dec_and_test(atomic_t *v)
|
||||||
|
{
|
||||||
|
atomic_dec(v);
|
||||||
|
if (v->counter == 0)
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kcalloc - allocate memory for an array. The memory is set to zero.
|
||||||
|
* @n: number of elements.
|
||||||
|
* @size: element size.
|
||||||
|
* @flags: the type of memory to allocate (see kmalloc).
|
||||||
|
*/
|
||||||
|
static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
|
||||||
|
{
|
||||||
|
return RtlZmalloc(((n) * (size)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef GFP_ATOMIC
|
||||||
|
#define GFP_ATOMIC GFP_KERNEL
|
||||||
|
#endif
|
||||||
|
#ifndef offsetof
|
||||||
|
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//enum linux kernel version
|
||||||
|
#ifndef KERNEL_VERSION
|
||||||
|
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
||||||
|
#endif
|
||||||
|
#ifndef LINUX_VERSION_CODE
|
||||||
|
#define LINUX_VERSION_CODE KERNEL_VERSION(3, 12, 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //_UVC_OSDEP_WRAP_H_
|
|
@ -0,0 +1,774 @@
|
||||||
|
#ifndef _USB_VIDEO_H_
|
||||||
|
#define _USB_VIDEO_H_
|
||||||
|
#if 0
|
||||||
|
#ifndef __KERNEL__
|
||||||
|
#error "The uvcvideo.h header is deprecated, use linux/uvcvideo.h instead."
|
||||||
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "usb.h"
|
||||||
|
#include "video.h"
|
||||||
|
#include "uvcvideo.h"
|
||||||
|
|
||||||
|
#include "videodev2.h"
|
||||||
|
#include "media-device.h"
|
||||||
|
#include "v4l2-device.h"
|
||||||
|
#include "v4l2-event.h"
|
||||||
|
#include "v4l2-fh.h"
|
||||||
|
#include "videobuf2-core.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------
|
||||||
|
* UVC constants
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define UVC_TERM_INPUT 0x0000
|
||||||
|
#define UVC_TERM_OUTPUT 0x8000
|
||||||
|
#define UVC_TERM_DIRECTION(term) ((term)->type & 0x8000)
|
||||||
|
|
||||||
|
#define UVC_ENTITY_TYPE(entity) ((entity)->type & 0x7fff)
|
||||||
|
#define UVC_ENTITY_IS_UNIT(entity) (((entity)->type & 0xff00) == 0)
|
||||||
|
#define UVC_ENTITY_IS_TERM(entity) (((entity)->type & 0xff00) != 0)
|
||||||
|
#define UVC_ENTITY_IS_ITERM(entity) \
|
||||||
|
(UVC_ENTITY_IS_TERM(entity) && \
|
||||||
|
((entity)->type & 0x8000) == UVC_TERM_INPUT)
|
||||||
|
#define UVC_ENTITY_IS_OTERM(entity) \
|
||||||
|
(UVC_ENTITY_IS_TERM(entity) && \
|
||||||
|
((entity)->type & 0x8000) == UVC_TERM_OUTPUT)
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* GUIDs
|
||||||
|
*/
|
||||||
|
#define UVC_GUID_UVC_CAMERA \
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
|
||||||
|
#define UVC_GUID_UVC_OUTPUT \
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}
|
||||||
|
#define UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT \
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
|
||||||
|
#define UVC_GUID_UVC_PROCESSING \
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01}
|
||||||
|
#define UVC_GUID_UVC_SELECTOR \
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02}
|
||||||
|
|
||||||
|
#define UVC_GUID_FORMAT_MJPEG \
|
||||||
|
{ 'M', 'J', 'P', 'G', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_YUY2 \
|
||||||
|
{ 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_YUY2_ISIGHT \
|
||||||
|
{ 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_NV12 \
|
||||||
|
{ 'N', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_YV12 \
|
||||||
|
{ 'Y', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_I420 \
|
||||||
|
{ 'I', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_UYVY \
|
||||||
|
{ 'U', 'Y', 'V', 'Y', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_Y800 \
|
||||||
|
{ 'Y', '8', '0', '0', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_Y8 \
|
||||||
|
{ 'Y', '8', ' ', ' ', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_Y10 \
|
||||||
|
{ 'Y', '1', '0', ' ', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_Y12 \
|
||||||
|
{ 'Y', '1', '2', ' ', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_Y16 \
|
||||||
|
{ 'Y', '1', '6', ' ', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_BY8 \
|
||||||
|
{ 'B', 'Y', '8', ' ', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_RGBP \
|
||||||
|
{ 'R', 'G', 'B', 'P', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_M420 \
|
||||||
|
{ 'M', '4', '2', '0', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
|
||||||
|
#define UVC_GUID_FORMAT_H264 \
|
||||||
|
{ 'H', '2', '6', '4', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
/* edit by Ian -- patch for GEO add two new guids*/
|
||||||
|
#define UVC_GUID_FORMAT_MPEG \
|
||||||
|
{ 'M', 'P', 'E', 'G', 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
#define UVC_GUID_FORMAT_MUX \
|
||||||
|
{ 'M', 'U', 'X', 0x00, 0x00, 0x00, 0x10, 0x00, \
|
||||||
|
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Driver specific constants.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DRIVER_VERSION "1.1.1"
|
||||||
|
|
||||||
|
/* Number of isochronous URBs. */
|
||||||
|
#define UVC_URBS 2
|
||||||
|
/* Maximum number of packets per URB. */
|
||||||
|
#define UVC_MAX_PACKETS 32
|
||||||
|
/* Maximum number of video buffers. */
|
||||||
|
#define UVC_MAX_VIDEO_BUFFERS 8
|
||||||
|
/* Maximum status buffer size in bytes of interrupt URB. */
|
||||||
|
#define UVC_MAX_STATUS_SIZE 16
|
||||||
|
|
||||||
|
//modified by Ian
|
||||||
|
#define UVC_REQBUF_SIZE (150000)
|
||||||
|
|
||||||
|
#define UVC_CTRL_CONTROL_TIMEOUT 300
|
||||||
|
#define UVC_CTRL_STREAMING_TIMEOUT 5000
|
||||||
|
|
||||||
|
/* Maximum allowed number of control mappings per device */
|
||||||
|
#define UVC_MAX_CONTROL_MAPPINGS 1024
|
||||||
|
#define UVC_MAX_CONTROL_MENU_ENTRIES 32
|
||||||
|
|
||||||
|
/* Devices quirks */
|
||||||
|
#define UVC_QUIRK_STATUS_INTERVAL 0x00000001
|
||||||
|
#define UVC_QUIRK_PROBE_MINMAX 0x00000002
|
||||||
|
#define UVC_QUIRK_PROBE_EXTRAFIELDS 0x00000004
|
||||||
|
#define UVC_QUIRK_BUILTIN_ISIGHT 0x00000008
|
||||||
|
#define UVC_QUIRK_STREAM_NO_FID 0x00000010
|
||||||
|
#define UVC_QUIRK_IGNORE_SELECTOR_UNIT 0x00000020
|
||||||
|
#define UVC_QUIRK_FIX_BANDWIDTH 0x00000080
|
||||||
|
#define UVC_QUIRK_PROBE_DEF 0x00000100
|
||||||
|
#define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200
|
||||||
|
|
||||||
|
/* Format flags */
|
||||||
|
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
|
||||||
|
#define UVC_FMT_FLAG_STREAM 0x00000002
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Structures.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct uvc_device;
|
||||||
|
|
||||||
|
/* TODO: Put the most frequently accessed fields at the beginning of
|
||||||
|
* structures to maximize cache efficiency.
|
||||||
|
*/
|
||||||
|
struct uvc_control_info {
|
||||||
|
struct list_head mappings;
|
||||||
|
__u8 entity[16];
|
||||||
|
__u8 index; /* Bit index in bmControls */
|
||||||
|
__u8 selector;
|
||||||
|
|
||||||
|
__u16 size;
|
||||||
|
__u32 flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_control_mapping {
|
||||||
|
struct list_head list;
|
||||||
|
struct list_head ev_subs;
|
||||||
|
|
||||||
|
__u32 id;
|
||||||
|
__u8 name[32];
|
||||||
|
__u8 entity[16];
|
||||||
|
__u8 selector;
|
||||||
|
|
||||||
|
__u8 size;
|
||||||
|
__u8 offset;
|
||||||
|
enum v4l2_ctrl_type v4l2_type;
|
||||||
|
__u32 data_type;
|
||||||
|
|
||||||
|
struct uvc_menu_info *menu_info;
|
||||||
|
__u32 menu_count;
|
||||||
|
|
||||||
|
__u32 master_id;
|
||||||
|
__s32 master_manual;
|
||||||
|
__u32 slave_ids[2];
|
||||||
|
|
||||||
|
__s32 (*get) (struct uvc_control_mapping *mapping, __u8 query,
|
||||||
|
const __u8 *data);
|
||||||
|
void (*set) (struct uvc_control_mapping *mapping, __s32 value,
|
||||||
|
__u8 *data);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_control {
|
||||||
|
struct uvc_entity *entity;
|
||||||
|
struct uvc_control_info info;
|
||||||
|
|
||||||
|
__u8 index; /* Used to match the uvc_control entry with a
|
||||||
|
uvc_control_info. */
|
||||||
|
__u8 dirty:1,
|
||||||
|
loaded:1,
|
||||||
|
modified:1,
|
||||||
|
cached:1,
|
||||||
|
initialized:1;
|
||||||
|
|
||||||
|
__u8 *uvc_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_format_desc {
|
||||||
|
char *name;
|
||||||
|
__u8 guid[16];
|
||||||
|
__u32 fcc;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The term 'entity' refers to both UVC units and UVC terminals.
|
||||||
|
*
|
||||||
|
* The type field is either the terminal type (wTerminalType in the terminal
|
||||||
|
* descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
|
||||||
|
* As the bDescriptorSubtype field is one byte long, the type value will
|
||||||
|
* always have a null MSB for units. All terminal types defined by the UVC
|
||||||
|
* specification have a non-null MSB, so it is safe to use the MSB to
|
||||||
|
* differentiate between units and terminals as long as the descriptor parsing
|
||||||
|
* code makes sure terminal types have a non-null MSB.
|
||||||
|
*
|
||||||
|
* For terminals, the type's most significant bit stores the terminal
|
||||||
|
* direction (either UVC_TERM_INPUT or UVC_TERM_OUTPUT). The type field should
|
||||||
|
* always be accessed with the UVC_ENTITY_* macros and never directly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define UVC_ENTITY_FLAG_DEFAULT (1 << 0)
|
||||||
|
|
||||||
|
struct uvc_entity {
|
||||||
|
struct list_head list; /* Entity as part of a UVC device. */
|
||||||
|
struct list_head chain; /* Entity as part of a video device
|
||||||
|
* chain. */
|
||||||
|
unsigned int flags;
|
||||||
|
|
||||||
|
__u8 id;
|
||||||
|
__u16 type;
|
||||||
|
char name[64];
|
||||||
|
|
||||||
|
/* Media controller-related fields. */
|
||||||
|
struct video_device *vdev;
|
||||||
|
struct v4l2_subdev subdev;
|
||||||
|
unsigned int num_pads;
|
||||||
|
unsigned int num_links;
|
||||||
|
struct media_pad *pads;
|
||||||
|
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
__u16 wObjectiveFocalLengthMin;
|
||||||
|
__u16 wObjectiveFocalLengthMax;
|
||||||
|
__u16 wOcularFocalLength;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 *bmControls;
|
||||||
|
} camera;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 *bmControls;
|
||||||
|
__u8 bTransportModeSize;
|
||||||
|
__u8 *bmTransportModes;
|
||||||
|
} media;
|
||||||
|
#if 0
|
||||||
|
struct {
|
||||||
|
} output;
|
||||||
|
#endif
|
||||||
|
struct {
|
||||||
|
__u16 wMaxMultiplier;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 *bmControls;
|
||||||
|
__u8 bmVideoStandards;
|
||||||
|
} processing;
|
||||||
|
#if 0
|
||||||
|
struct {
|
||||||
|
} selector;
|
||||||
|
#endif
|
||||||
|
struct {
|
||||||
|
__u8 guidExtensionCode[16];
|
||||||
|
__u8 bNumControls;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 *bmControls;
|
||||||
|
__u8 *bmControlsType;
|
||||||
|
} extension;
|
||||||
|
};
|
||||||
|
|
||||||
|
__u8 bNrInPins;
|
||||||
|
__u8 *baSourceID;
|
||||||
|
|
||||||
|
unsigned int ncontrols;
|
||||||
|
struct uvc_control *controls;
|
||||||
|
};
|
||||||
|
|
||||||
|
// total (27)-> 28 Bytes
|
||||||
|
struct uvc_frame {
|
||||||
|
__u8 bFrameIndex;
|
||||||
|
__u8 bmCapabilities;
|
||||||
|
__u16 wWidth;
|
||||||
|
__u16 wHeight;
|
||||||
|
__u32 dwMinBitRate;
|
||||||
|
__u32 dwMaxBitRate;
|
||||||
|
__u32 dwMaxVideoFrameBufferSize;
|
||||||
|
__u8 bFrameIntervalType;
|
||||||
|
__u32 dwDefaultFrameInterval;
|
||||||
|
__u32 *dwFrameInterval;
|
||||||
|
};
|
||||||
|
|
||||||
|
// total 52 Bytes
|
||||||
|
struct uvc_format {
|
||||||
|
__u8 type;
|
||||||
|
__u8 index;
|
||||||
|
__u8 bpp;
|
||||||
|
__u8 colorspace;
|
||||||
|
__u32 fcc;
|
||||||
|
__u32 flags;
|
||||||
|
|
||||||
|
char name[32];
|
||||||
|
|
||||||
|
unsigned int nframes;
|
||||||
|
struct uvc_frame *frame;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_streaming_header {
|
||||||
|
__u8 bNumFormats;
|
||||||
|
__u8 bEndpointAddress;
|
||||||
|
__u8 bTerminalLink;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 *bmaControls;
|
||||||
|
/* The following fields are used by input headers only. */
|
||||||
|
__u8 bmInfo;
|
||||||
|
__u8 bStillCaptureMethod;
|
||||||
|
__u8 bTriggerSupport;
|
||||||
|
__u8 bTriggerUsage;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum uvc_buffer_state {
|
||||||
|
UVC_BUF_STATE_IDLE = 0,
|
||||||
|
UVC_BUF_STATE_QUEUED = 1,
|
||||||
|
UVC_BUF_STATE_ACTIVE = 2,
|
||||||
|
UVC_BUF_STATE_READY = 3,
|
||||||
|
UVC_BUF_STATE_DONE = 4,
|
||||||
|
UVC_BUF_STATE_ERROR = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_buffer {
|
||||||
|
struct vb2_buffer buf;
|
||||||
|
struct list_head queue;
|
||||||
|
_Mutex mutex;
|
||||||
|
enum uvc_buffer_state state;
|
||||||
|
unsigned int error;
|
||||||
|
|
||||||
|
void *mem;
|
||||||
|
unsigned int length;
|
||||||
|
unsigned int bytesused;
|
||||||
|
|
||||||
|
u32 pts;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define UVC_QUEUE_DISCONNECTED (1 << 0)
|
||||||
|
#define UVC_QUEUE_DROP_CORRUPTED (1 << 1)
|
||||||
|
|
||||||
|
struct uvc_video_queue {
|
||||||
|
struct vb2_queue queue;
|
||||||
|
//struct mutex mutex; /* Protects queue */
|
||||||
|
_Mutex mutex;
|
||||||
|
unsigned int flags;
|
||||||
|
unsigned int buf_used;
|
||||||
|
|
||||||
|
//spinlock_t irqlock; /* Protects irqqueue */
|
||||||
|
//_LOCK_T irqlock;
|
||||||
|
_Mutex irqlock;
|
||||||
|
struct list_head irqqueue;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_video_chain {
|
||||||
|
struct uvc_device *dev;
|
||||||
|
struct list_head list;
|
||||||
|
|
||||||
|
struct list_head entities; /* All entities */
|
||||||
|
struct uvc_entity *processing; /* Processing unit */
|
||||||
|
struct uvc_entity *selector; /* Selector unit */
|
||||||
|
|
||||||
|
//struct mutex ctrl_mutex; /* Protects ctrl.info */
|
||||||
|
_Mutex ctrl_mutex;
|
||||||
|
|
||||||
|
struct v4l2_prio_state prio; /* V4L2 priority state */
|
||||||
|
u32 caps; /* V4L2 chain-wide caps */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_stats_frame {
|
||||||
|
unsigned int size; /* Number of bytes captured */
|
||||||
|
unsigned int first_data; /* Index of the first non-empty packet */
|
||||||
|
|
||||||
|
unsigned int nb_packets; /* Number of packets */
|
||||||
|
unsigned int nb_empty; /* Number of empty packets */
|
||||||
|
unsigned int nb_invalid; /* Number of packets with an invalid header */
|
||||||
|
unsigned int nb_errors; /* Number of packets with the error bit set */
|
||||||
|
|
||||||
|
unsigned int nb_pts; /* Number of packets with a PTS timestamp */
|
||||||
|
unsigned int nb_pts_diffs; /* Number of PTS differences inside a frame */
|
||||||
|
unsigned int last_pts_diff; /* Index of the last PTS difference */
|
||||||
|
bool has_initial_pts; /* Whether the first non-empty packet has a PTS */
|
||||||
|
bool has_early_pts; /* Whether a PTS is present before the first non-empty packet */
|
||||||
|
u32 pts; /* PTS of the last packet */
|
||||||
|
|
||||||
|
unsigned int nb_scr; /* Number of packets with a SCR timestamp */
|
||||||
|
unsigned int nb_scr_diffs; /* Number of SCR.STC differences inside a frame */
|
||||||
|
u16 scr_sof; /* SCR.SOF of the last packet */
|
||||||
|
u32 scr_stc; /* SCR.STC of the last packet */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_stats_stream {
|
||||||
|
//struct timespec start_ts; /* Stream start timestamp */
|
||||||
|
//struct timespec stop_ts; /* Stream stop timestamp */
|
||||||
|
u32 start_ts;
|
||||||
|
u32 stop_ts;
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int nb_frames; /* Number of frames */
|
||||||
|
|
||||||
|
unsigned int nb_packets; /* Number of packets */
|
||||||
|
unsigned int nb_empty; /* Number of empty packets */
|
||||||
|
unsigned int nb_invalid; /* Number of packets with an invalid header */
|
||||||
|
unsigned int nb_errors; /* Number of packets with the error bit set */
|
||||||
|
|
||||||
|
unsigned int nb_pts_constant; /* Number of frames with constant PTS */
|
||||||
|
unsigned int nb_pts_early; /* Number of frames with early PTS */
|
||||||
|
unsigned int nb_pts_initial; /* Number of frames with initial PTS */
|
||||||
|
|
||||||
|
unsigned int nb_scr_count_ok; /* Number of frames with at least one SCR per non empty packet */
|
||||||
|
unsigned int nb_scr_diffs_ok; /* Number of frames with varying SCR.STC */
|
||||||
|
unsigned int scr_sof_count; /* STC.SOF counter accumulated since stream start */
|
||||||
|
unsigned int scr_sof; /* STC.SOF of the last packet */
|
||||||
|
unsigned int min_sof; /* Minimum STC.SOF value */
|
||||||
|
unsigned int max_sof; /* Maximum STC.SOF value */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_streaming {
|
||||||
|
struct list_head list;
|
||||||
|
struct uvc_device *dev;
|
||||||
|
struct video_device *vdev;
|
||||||
|
struct uvc_video_chain *chain;
|
||||||
|
atomic_t active;
|
||||||
|
|
||||||
|
struct usb_interface *intf;
|
||||||
|
int intfnum;
|
||||||
|
__u16 maxpsize;
|
||||||
|
|
||||||
|
struct uvc_streaming_header header;
|
||||||
|
enum v4l2_buf_type type;
|
||||||
|
|
||||||
|
unsigned int nformats;
|
||||||
|
struct uvc_format *format;
|
||||||
|
|
||||||
|
struct uvc_streaming_control ctrl;
|
||||||
|
struct uvc_format *def_format;
|
||||||
|
struct uvc_format *cur_format;
|
||||||
|
struct uvc_frame *cur_frame;
|
||||||
|
/* Protect access to ctrl, cur_format, cur_frame and hardware video
|
||||||
|
* probe control.
|
||||||
|
*/
|
||||||
|
//struct mutex mutex;
|
||||||
|
_Mutex mutex;
|
||||||
|
|
||||||
|
/* Buffers queue. */
|
||||||
|
unsigned int frozen : 1;
|
||||||
|
struct uvc_video_queue queue;
|
||||||
|
void (*decode) (struct urb *urb, struct uvc_streaming *video,
|
||||||
|
struct uvc_buffer *buf);
|
||||||
|
|
||||||
|
/* Context data used by the bulk completion handler. */
|
||||||
|
struct {
|
||||||
|
__u8 header[256];
|
||||||
|
unsigned int header_size;
|
||||||
|
int skip_payload;
|
||||||
|
__u32 payload_size;
|
||||||
|
__u32 max_payload_size;
|
||||||
|
} bulk;
|
||||||
|
|
||||||
|
struct urb *urb[UVC_URBS];
|
||||||
|
char *urb_buffer[UVC_URBS];
|
||||||
|
dma_addr_t urb_dma[UVC_URBS];
|
||||||
|
unsigned int urb_size;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
__u32 sequence;
|
||||||
|
__u8 last_fid;
|
||||||
|
|
||||||
|
/* debugfs */
|
||||||
|
//struct dentry *debugfs_dir;
|
||||||
|
struct {
|
||||||
|
struct uvc_stats_frame frame;
|
||||||
|
struct uvc_stats_stream stream;
|
||||||
|
} stats;
|
||||||
|
|
||||||
|
/* Timestamps support. */
|
||||||
|
struct uvc_clock {
|
||||||
|
struct uvc_clock_sample {
|
||||||
|
u32 dev_stc;
|
||||||
|
u16 dev_sof;
|
||||||
|
//struct timespec host_ts;
|
||||||
|
u32 host_ts; //change to tick
|
||||||
|
u16 host_sof;
|
||||||
|
} *samples;
|
||||||
|
|
||||||
|
unsigned int head;
|
||||||
|
unsigned int count;
|
||||||
|
unsigned int size;
|
||||||
|
|
||||||
|
u16 last_sof;
|
||||||
|
u16 sof_offset;
|
||||||
|
|
||||||
|
//spinlock_t lock;
|
||||||
|
_Lock lock;
|
||||||
|
} clock;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum uvc_device_state {
|
||||||
|
UVC_DEV_DISCONNECTED = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uvc_device {
|
||||||
|
struct usb_device *udev;
|
||||||
|
struct usb_interface *intf;
|
||||||
|
unsigned long warnings;
|
||||||
|
__u32 quirks;
|
||||||
|
int intfnum;
|
||||||
|
char name[32];
|
||||||
|
|
||||||
|
enum uvc_device_state state;
|
||||||
|
//struct mutex lock; /* Protects users */
|
||||||
|
_Mutex lock;
|
||||||
|
unsigned int users;
|
||||||
|
atomic_t nmappings;
|
||||||
|
|
||||||
|
/* Video control interface */
|
||||||
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
||||||
|
struct media_device mdev;
|
||||||
|
#endif
|
||||||
|
struct v4l2_device vdev;
|
||||||
|
__u16 uvc_version;
|
||||||
|
__u32 clock_frequency;
|
||||||
|
|
||||||
|
struct list_head entities; // VC_EXTENSION_UNIT ->VC_INPUT_TERMINAL ->VC_PROCESSING_UNIT ->VC_OUTPUT_TERMINAL
|
||||||
|
struct list_head chains;
|
||||||
|
|
||||||
|
/* Video Streaming interfaces */
|
||||||
|
struct list_head streams;
|
||||||
|
atomic_t nstreams;
|
||||||
|
|
||||||
|
/* Status Interrupt Endpoint */
|
||||||
|
struct usb_host_endpoint *int_ep;
|
||||||
|
struct urb *int_urb;
|
||||||
|
__u8 *status;
|
||||||
|
//struct input_dev *input;
|
||||||
|
char input_phys[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
enum uvc_handle_state {
|
||||||
|
UVC_HANDLE_PASSIVE = 0,
|
||||||
|
UVC_HANDLE_ACTIVE = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* uvc file handle */
|
||||||
|
struct uvc_fh {
|
||||||
|
struct v4l2_fh vfh;
|
||||||
|
struct uvc_video_chain *chain;
|
||||||
|
struct uvc_streaming *stream;
|
||||||
|
enum uvc_handle_state state;
|
||||||
|
};
|
||||||
|
#if 0
|
||||||
|
/* uvc_driver = usb_driver for interface
|
||||||
|
* - identifies USB interface driver to usbcore
|
||||||
|
*/
|
||||||
|
struct uvc_driver {
|
||||||
|
struct usb_driver driver;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Debugging, printing and logging
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define UVC_TRACE_PROBE (1 << 0)
|
||||||
|
#define UVC_TRACE_DESCR (1 << 1)
|
||||||
|
#define UVC_TRACE_CONTROL (1 << 2)
|
||||||
|
#define UVC_TRACE_FORMAT (1 << 3)
|
||||||
|
#define UVC_TRACE_CAPTURE (1 << 4)
|
||||||
|
#define UVC_TRACE_CALLS (1 << 5)
|
||||||
|
#define UVC_TRACE_IOCTL (1 << 6)
|
||||||
|
#define UVC_TRACE_FRAME (1 << 7)
|
||||||
|
#define UVC_TRACE_SUSPEND (1 << 8)
|
||||||
|
#define UVC_TRACE_STATUS (1 << 9)
|
||||||
|
#define UVC_TRACE_VIDEO (1 << 10)
|
||||||
|
#define UVC_TRACE_STATS (1 << 11)
|
||||||
|
#define UVC_TRACE_CLOCK (1 << 12)
|
||||||
|
|
||||||
|
#define UVC_WARN_MINMAX 0
|
||||||
|
#define UVC_WARN_PROBE_DEF 1
|
||||||
|
#define UVC_WARN_XU_GET_RES 2
|
||||||
|
|
||||||
|
extern unsigned int uvc_clock_param;
|
||||||
|
extern unsigned int uvc_no_drop_param;
|
||||||
|
extern unsigned int uvc_trace_param;
|
||||||
|
extern unsigned int uvc_timeout_param;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define uvc_trace(flag, msg...) \
|
||||||
|
do { \
|
||||||
|
if (uvc_trace_param & flag) \
|
||||||
|
printk(KERN_DEBUG "uvcvideo: " msg); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define uvc_warn_once(dev, warn, msg...) \
|
||||||
|
do { \
|
||||||
|
if (!test_and_set_bit(warn, &dev->warnings)) \
|
||||||
|
printk(KERN_INFO "uvcvideo: " msg); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define uvc_printk(level, msg...) \
|
||||||
|
printk(level "uvcvideo: " msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------
|
||||||
|
* Internal functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Core driver */
|
||||||
|
extern struct uvc_driver uvc_driver;
|
||||||
|
|
||||||
|
extern struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
|
||||||
|
|
||||||
|
/* Video buffers queue management. */
|
||||||
|
extern int uvc_queue_init(struct uvc_video_queue *queue,
|
||||||
|
enum v4l2_buf_type type, int drop_corrupted);
|
||||||
|
extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
|
||||||
|
struct v4l2_requestbuffers *rb);
|
||||||
|
extern void uvc_free_buffers(struct uvc_video_queue *queue);
|
||||||
|
extern int uvc_query_buffer(struct uvc_video_queue *queue,
|
||||||
|
struct v4l2_buffer *v4l2_buf);
|
||||||
|
extern int uvc_queue_buffer(struct uvc_video_queue *queue,
|
||||||
|
struct v4l2_buffer *v4l2_buf);
|
||||||
|
extern int uvc_dequeue_buffer(struct uvc_video_queue *queue,
|
||||||
|
struct v4l2_buffer *v4l2_buf, int nonblocking);
|
||||||
|
extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable);
|
||||||
|
extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect);
|
||||||
|
extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
|
||||||
|
struct uvc_buffer *buf);
|
||||||
|
extern int uvc_queue_mmap(struct uvc_video_queue *queue);
|
||||||
|
#if 0
|
||||||
|
extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue,
|
||||||
|
struct file *file, poll_table *wait);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_MMU
|
||||||
|
extern unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
|
||||||
|
unsigned long pgoff);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int uvc_queue_allocated(struct uvc_video_queue *queue);
|
||||||
|
static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
|
||||||
|
{
|
||||||
|
return vb2_is_streaming(&queue->queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* V4L2 interface */
|
||||||
|
extern const struct v4l2_file_operations uvc_fops;
|
||||||
|
|
||||||
|
/* Media controller */
|
||||||
|
extern int uvc_mc_register_entities(struct uvc_video_chain *chain);
|
||||||
|
extern void uvc_mc_cleanup_entity(struct uvc_entity *entity);
|
||||||
|
|
||||||
|
/* Video */
|
||||||
|
extern int uvc_video_init(struct uvc_streaming *stream);
|
||||||
|
extern int uvc_video_suspend(struct uvc_streaming *stream);
|
||||||
|
extern int uvc_video_resume(struct uvc_streaming *stream, int reset);
|
||||||
|
extern int uvc_video_enable(struct uvc_streaming *stream, int enable);
|
||||||
|
extern int uvc_probe_video(struct uvc_streaming *stream,
|
||||||
|
struct uvc_streaming_control *probe);
|
||||||
|
/* edit by Ian -- patch for GEO */
|
||||||
|
extern int uvc_commit_video(struct uvc_streaming *stream,
|
||||||
|
struct uvc_streaming_control *probe);
|
||||||
|
|
||||||
|
extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,
|
||||||
|
__u8 intfnum, __u8 cs, void *data, __u16 size);
|
||||||
|
/* edit by Ian -- disable uvc clock api*/
|
||||||
|
#if 0
|
||||||
|
void uvc_video_clock_update(struct uvc_streaming *stream,
|
||||||
|
struct v4l2_buffer *v4l2_buf,
|
||||||
|
struct uvc_buffer *buf);
|
||||||
|
#endif
|
||||||
|
/* Status */
|
||||||
|
//#define UVC_STATUS_EN
|
||||||
|
#ifdef UVC_STATUS_EN
|
||||||
|
extern int uvc_status_init(struct uvc_device *dev);
|
||||||
|
extern void uvc_status_cleanup(struct uvc_device *dev);
|
||||||
|
extern int uvc_status_start(struct uvc_device *dev, gfp_t flags);
|
||||||
|
extern void uvc_status_stop(struct uvc_device *dev);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Controls */
|
||||||
|
extern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
|
||||||
|
|
||||||
|
extern int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
|
||||||
|
struct v4l2_queryctrl *v4l2_ctrl);
|
||||||
|
extern int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
|
||||||
|
struct v4l2_querymenu *query_menu);
|
||||||
|
|
||||||
|
extern int uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
|
||||||
|
const struct uvc_control_mapping *mapping);
|
||||||
|
extern int uvc_ctrl_init_device(struct uvc_device *dev);
|
||||||
|
extern void uvc_ctrl_cleanup_device(struct uvc_device *dev);
|
||||||
|
extern int uvc_ctrl_resume_device(struct uvc_device *dev);
|
||||||
|
extern int uvc_ctrl_begin(struct uvc_video_chain *chain);
|
||||||
|
extern int __uvc_ctrl_commit(struct uvc_fh *handle, int rollback,
|
||||||
|
const struct v4l2_ext_control *xctrls,
|
||||||
|
unsigned int xctrls_count);
|
||||||
|
static inline int uvc_ctrl_commit(struct uvc_fh *handle,
|
||||||
|
const struct v4l2_ext_control *xctrls,
|
||||||
|
unsigned int xctrls_count)
|
||||||
|
{
|
||||||
|
return __uvc_ctrl_commit(handle, 0, xctrls, xctrls_count);
|
||||||
|
}
|
||||||
|
static inline int uvc_ctrl_rollback(struct uvc_fh *handle)
|
||||||
|
{
|
||||||
|
return __uvc_ctrl_commit(handle, 1, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int uvc_ctrl_get(struct uvc_video_chain *chain,
|
||||||
|
struct v4l2_ext_control *xctrl);
|
||||||
|
extern int uvc_ctrl_set(struct uvc_video_chain *chain,
|
||||||
|
struct v4l2_ext_control *xctrl);
|
||||||
|
|
||||||
|
//edit by Ian -- remove uvc_xu_ctrl_query declaration
|
||||||
|
//extern int uvc_xu_ctrl_query(struct uvc_video_chain *chain, struct uvc_xu_control_query *xqry);
|
||||||
|
|
||||||
|
/* Utility functions */
|
||||||
|
extern void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
|
||||||
|
unsigned int n_terms, unsigned int threshold);
|
||||||
|
extern uint32_t uvc_fraction_to_interval(uint32_t numerator,
|
||||||
|
uint32_t denominator);
|
||||||
|
extern struct usb_host_endpoint *uvc_find_endpoint(
|
||||||
|
struct usb_host_interface *alts, __u8 epaddr);
|
||||||
|
|
||||||
|
/* Quirks support */
|
||||||
|
void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream,
|
||||||
|
struct uvc_buffer *buf);
|
||||||
|
|
||||||
|
/* debugfs and statistics */
|
||||||
|
#if 0
|
||||||
|
int uvc_debugfs_init(void);
|
||||||
|
void uvc_debugfs_cleanup(void);
|
||||||
|
int uvc_debugfs_init_stream(struct uvc_streaming *stream);
|
||||||
|
void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream);
|
||||||
|
|
||||||
|
size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
|
||||||
|
size_t size);
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -0,0 +1,726 @@
|
||||||
|
/*
|
||||||
|
* USB Video Class definitions.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be>
|
||||||
|
*
|
||||||
|
* This file holds USB constants and structures defined by the USB Device
|
||||||
|
* Class Definition for Video Devices. Unless otherwise stated, comments
|
||||||
|
* below reference relevant sections of the USB Video Class 1.1 specification
|
||||||
|
* available at
|
||||||
|
*
|
||||||
|
* http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LINUX_USB_VIDEO_H
|
||||||
|
#define __LINUX_USB_VIDEO_H
|
||||||
|
#if 0
|
||||||
|
#include <linux/types.h>
|
||||||
|
#endif
|
||||||
|
#include "uvc_os_wrap_via_osdep_api.h"
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------
|
||||||
|
* UVC constants
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* A.2. Video Interface Subclass Codes */
|
||||||
|
#define UVC_SC_UNDEFINED 0x00
|
||||||
|
#define UVC_SC_VIDEOCONTROL 0x01
|
||||||
|
#define UVC_SC_VIDEOSTREAMING 0x02
|
||||||
|
#define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03
|
||||||
|
|
||||||
|
/* A.3. Video Interface Protocol Codes */
|
||||||
|
#define UVC_PC_PROTOCOL_UNDEFINED 0x00
|
||||||
|
|
||||||
|
/* A.5. Video Class-Specific VC Interface Descriptor Subtypes */
|
||||||
|
#define UVC_VC_DESCRIPTOR_UNDEFINED 0x00
|
||||||
|
#define UVC_VC_HEADER 0x01
|
||||||
|
#define UVC_VC_INPUT_TERMINAL 0x02
|
||||||
|
#define UVC_VC_OUTPUT_TERMINAL 0x03
|
||||||
|
#define UVC_VC_SELECTOR_UNIT 0x04
|
||||||
|
#define UVC_VC_PROCESSING_UNIT 0x05
|
||||||
|
#define UVC_VC_EXTENSION_UNIT 0x06
|
||||||
|
|
||||||
|
/* A.6. Video Class-Specific VS Interface Descriptor Subtypes */
|
||||||
|
#define UVC_VS_UNDEFINED 0x00
|
||||||
|
#define UVC_VS_INPUT_HEADER 0x01
|
||||||
|
#define UVC_VS_OUTPUT_HEADER 0x02
|
||||||
|
#define UVC_VS_STILL_IMAGE_FRAME 0x03
|
||||||
|
#define UVC_VS_FORMAT_UNCOMPRESSED 0x04
|
||||||
|
#define UVC_VS_FRAME_UNCOMPRESSED 0x05
|
||||||
|
#define UVC_VS_FORMAT_MJPEG 0x06
|
||||||
|
#define UVC_VS_FRAME_MJPEG 0x07
|
||||||
|
#define UVC_VS_FORMAT_MPEG2TS 0x0a
|
||||||
|
#define UVC_VS_FORMAT_DV 0x0c
|
||||||
|
#define UVC_VS_COLORFORMAT 0x0d
|
||||||
|
#define UVC_VS_FORMAT_FRAME_BASED 0x10
|
||||||
|
#define UVC_VS_FRAME_FRAME_BASED 0x11
|
||||||
|
#define UVC_VS_FORMAT_STREAM_BASED 0x12
|
||||||
|
|
||||||
|
/* A.7. Video Class-Specific Endpoint Descriptor Subtypes */
|
||||||
|
#define UVC_EP_UNDEFINED 0x00
|
||||||
|
#define UVC_EP_GENERAL 0x01
|
||||||
|
#define UVC_EP_ENDPOINT 0x02
|
||||||
|
#define UVC_EP_INTERRUPT 0x03
|
||||||
|
|
||||||
|
/* A.8. Video Class-Specific Request Codes */
|
||||||
|
#define UVC_RC_UNDEFINED 0x00
|
||||||
|
#define UVC_SET_CUR 0x01
|
||||||
|
#define UVC_GET_CUR 0x81
|
||||||
|
#define UVC_GET_MIN 0x82
|
||||||
|
#define UVC_GET_MAX 0x83
|
||||||
|
#define UVC_GET_RES 0x84
|
||||||
|
#define UVC_GET_LEN 0x85
|
||||||
|
#define UVC_GET_INFO 0x86
|
||||||
|
#define UVC_GET_DEF 0x87
|
||||||
|
|
||||||
|
/* A.9.1. VideoControl Interface Control Selectors */
|
||||||
|
#define UVC_VC_CONTROL_UNDEFINED 0x00
|
||||||
|
#define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01
|
||||||
|
#define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02
|
||||||
|
|
||||||
|
/* A.9.2. Terminal Control Selectors */
|
||||||
|
#define UVC_TE_CONTROL_UNDEFINED 0x00
|
||||||
|
|
||||||
|
/* A.9.3. Selector Unit Control Selectors */
|
||||||
|
#define UVC_SU_CONTROL_UNDEFINED 0x00
|
||||||
|
#define UVC_SU_INPUT_SELECT_CONTROL 0x01
|
||||||
|
|
||||||
|
/* A.9.4. Camera Terminal Control Selectors */
|
||||||
|
#define UVC_CT_CONTROL_UNDEFINED 0x00
|
||||||
|
#define UVC_CT_SCANNING_MODE_CONTROL 0x01
|
||||||
|
#define UVC_CT_AE_MODE_CONTROL 0x02
|
||||||
|
#define UVC_CT_AE_PRIORITY_CONTROL 0x03
|
||||||
|
#define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04
|
||||||
|
#define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05
|
||||||
|
#define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06
|
||||||
|
#define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07
|
||||||
|
#define UVC_CT_FOCUS_AUTO_CONTROL 0x08
|
||||||
|
#define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09
|
||||||
|
#define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a
|
||||||
|
#define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b
|
||||||
|
#define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c
|
||||||
|
#define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d
|
||||||
|
#define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e
|
||||||
|
#define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f
|
||||||
|
#define UVC_CT_ROLL_RELATIVE_CONTROL 0x10
|
||||||
|
#define UVC_CT_PRIVACY_CONTROL 0x11
|
||||||
|
|
||||||
|
/* A.9.5. Processing Unit Control Selectors */
|
||||||
|
#define UVC_PU_CONTROL_UNDEFINED 0x00
|
||||||
|
#define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01
|
||||||
|
#define UVC_PU_BRIGHTNESS_CONTROL 0x02
|
||||||
|
#define UVC_PU_CONTRAST_CONTROL 0x03
|
||||||
|
#define UVC_PU_GAIN_CONTROL 0x04
|
||||||
|
#define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05
|
||||||
|
#define UVC_PU_HUE_CONTROL 0x06
|
||||||
|
#define UVC_PU_SATURATION_CONTROL 0x07
|
||||||
|
#define UVC_PU_SHARPNESS_CONTROL 0x08
|
||||||
|
#define UVC_PU_GAMMA_CONTROL 0x09
|
||||||
|
#define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a
|
||||||
|
#define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b
|
||||||
|
#define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c
|
||||||
|
#define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d
|
||||||
|
#define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e
|
||||||
|
#define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f
|
||||||
|
#define UVC_PU_HUE_AUTO_CONTROL 0x10
|
||||||
|
#define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
|
||||||
|
#define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12
|
||||||
|
|
||||||
|
/* A.9.7. VideoStreaming Interface Control Selectors */
|
||||||
|
#define UVC_VS_CONTROL_UNDEFINED 0x00
|
||||||
|
#define UVC_VS_PROBE_CONTROL 0x01
|
||||||
|
#define UVC_VS_COMMIT_CONTROL 0x02
|
||||||
|
#define UVC_VS_STILL_PROBE_CONTROL 0x03
|
||||||
|
#define UVC_VS_STILL_COMMIT_CONTROL 0x04
|
||||||
|
#define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
|
||||||
|
#define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06
|
||||||
|
#define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07
|
||||||
|
#define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
|
||||||
|
#define UVC_VS_SYNC_DELAY_CONTROL 0x09
|
||||||
|
|
||||||
|
/* B.1. USB Terminal Types */
|
||||||
|
#define UVC_TT_VENDOR_SPECIFIC 0x0100
|
||||||
|
#define UVC_TT_STREAMING 0x0101
|
||||||
|
|
||||||
|
/* B.2. Input Terminal Types */
|
||||||
|
#define UVC_ITT_VENDOR_SPECIFIC 0x0200
|
||||||
|
#define UVC_ITT_CAMERA 0x0201
|
||||||
|
#define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202
|
||||||
|
|
||||||
|
/* B.3. Output Terminal Types */
|
||||||
|
#define UVC_OTT_VENDOR_SPECIFIC 0x0300
|
||||||
|
#define UVC_OTT_DISPLAY 0x0301
|
||||||
|
#define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302
|
||||||
|
|
||||||
|
/* B.4. External Terminal Types */
|
||||||
|
#define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400
|
||||||
|
#define UVC_COMPOSITE_CONNECTOR 0x0401
|
||||||
|
#define UVC_SVIDEO_CONNECTOR 0x0402
|
||||||
|
#define UVC_COMPONENT_CONNECTOR 0x0403
|
||||||
|
|
||||||
|
/* 2.4.2.2. Status Packet Type */
|
||||||
|
#define UVC_STATUS_TYPE_CONTROL 1
|
||||||
|
#define UVC_STATUS_TYPE_STREAMING 2
|
||||||
|
|
||||||
|
/* 2.4.3.3. Payload Header Information */
|
||||||
|
#define UVC_STREAM_EOH (1 << 7)
|
||||||
|
#define UVC_STREAM_ERR (1 << 6)
|
||||||
|
#define UVC_STREAM_STI (1 << 5)
|
||||||
|
#define UVC_STREAM_RES (1 << 4)
|
||||||
|
#define UVC_STREAM_SCR (1 << 3)
|
||||||
|
#define UVC_STREAM_PTS (1 << 2)
|
||||||
|
#define UVC_STREAM_EOF (1 << 1)
|
||||||
|
#define UVC_STREAM_FID (1 << 0)
|
||||||
|
|
||||||
|
/* 4.1.2. Control Capabilities */
|
||||||
|
#define UVC_CONTROL_CAP_GET (1 << 0)
|
||||||
|
#define UVC_CONTROL_CAP_SET (1 << 1)
|
||||||
|
#define UVC_CONTROL_CAP_DISABLED (1 << 2)
|
||||||
|
#define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3)
|
||||||
|
#define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4)
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* UVC structures
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* All UVC descriptors have these 3 fields at the beginning */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_descriptor_header {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
} //__attribute__((packed));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* 3.7.2. Video Control Interface Header Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_header_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u16 bcdUVC;
|
||||||
|
__u16 wTotalLength;
|
||||||
|
__u32 dwClockFrequency;
|
||||||
|
__u8 bInCollection;
|
||||||
|
__u8 baInterfaceNr[];
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_HEADER_SIZE(n) (12+(n))
|
||||||
|
|
||||||
|
#define UVC_HEADER_DESCRIPTOR(n) \
|
||||||
|
uvc_header_descriptor_##n
|
||||||
|
|
||||||
|
#define DECLARE_UVC_HEADER_DESCRIPTOR(n) \
|
||||||
|
struct UVC_HEADER_DESCRIPTOR(n) { \
|
||||||
|
__u8 bLength; \
|
||||||
|
__u8 bDescriptorType; \
|
||||||
|
__u8 bDescriptorSubType; \
|
||||||
|
__u16 bcdUVC; \
|
||||||
|
__u16 wTotalLength; \
|
||||||
|
__u32 dwClockFrequency; \
|
||||||
|
__u8 bInCollection; \
|
||||||
|
__u8 baInterfaceNr[n]; \
|
||||||
|
} __attribute__ ((packed))
|
||||||
|
|
||||||
|
/* 3.7.2.1. Input Terminal Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_input_terminal_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bTerminalID;
|
||||||
|
__u16 wTerminalType;
|
||||||
|
__u8 bAssocTerminal;
|
||||||
|
__u8 iTerminal;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_INPUT_TERMINAL_SIZE 8
|
||||||
|
|
||||||
|
/* 3.7.2.2. Output Terminal Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_output_terminal_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bTerminalID;
|
||||||
|
__u16 wTerminalType;
|
||||||
|
__u8 bAssocTerminal;
|
||||||
|
__u8 bSourceID;
|
||||||
|
__u8 iTerminal;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_OUTPUT_TERMINAL_SIZE 9
|
||||||
|
|
||||||
|
/* 3.7.2.3. Camera Terminal Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_camera_terminal_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bTerminalID;
|
||||||
|
__u16 wTerminalType;
|
||||||
|
__u8 bAssocTerminal;
|
||||||
|
__u8 iTerminal;
|
||||||
|
__u16 wObjectiveFocalLengthMin;
|
||||||
|
__u16 wObjectiveFocalLengthMax;
|
||||||
|
__u16 wOcularFocalLength;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 bmControls[3];
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n))
|
||||||
|
|
||||||
|
/* 3.7.2.4. Selector Unit Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_selector_unit_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bUnitID;
|
||||||
|
__u8 bNrInPins;
|
||||||
|
// __u8 baSourceID[0];
|
||||||
|
__u8 * baSourceID;
|
||||||
|
__u8 iSelector;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n))
|
||||||
|
|
||||||
|
#define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
|
||||||
|
uvc_selector_unit_descriptor_##n
|
||||||
|
|
||||||
|
#define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
|
||||||
|
struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \
|
||||||
|
__u8 bLength; \
|
||||||
|
__u8 bDescriptorType; \
|
||||||
|
__u8 bDescriptorSubType; \
|
||||||
|
__u8 bUnitID; \
|
||||||
|
__u8 bNrInPins; \
|
||||||
|
__u8 baSourceID[n]; \
|
||||||
|
__u8 iSelector; \
|
||||||
|
} __attribute__ ((packed))
|
||||||
|
|
||||||
|
/* 3.7.2.5. Processing Unit Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_processing_unit_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bUnitID;
|
||||||
|
__u8 bSourceID;
|
||||||
|
__u16 wMaxMultiplier;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 bmControls[2];
|
||||||
|
__u8 iProcessing;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n))
|
||||||
|
|
||||||
|
/* 3.7.2.6. Extension Unit Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_extension_unit_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bUnitID;
|
||||||
|
__u8 guidExtensionCode[16];
|
||||||
|
__u8 bNumControls;
|
||||||
|
__u8 bNrInPins;
|
||||||
|
// __u8 baSourceID[0];
|
||||||
|
__u8 * baSourceID;
|
||||||
|
__u8 bControlSize;
|
||||||
|
// __u8 bmControls[0];
|
||||||
|
__u8 * bmControls;
|
||||||
|
__u8 iExtension;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n))
|
||||||
|
|
||||||
|
#define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
|
||||||
|
uvc_extension_unit_descriptor_##p_##n
|
||||||
|
|
||||||
|
#define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
|
||||||
|
struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \
|
||||||
|
__u8 bLength; \
|
||||||
|
__u8 bDescriptorType; \
|
||||||
|
__u8 bDescriptorSubType; \
|
||||||
|
__u8 bUnitID; \
|
||||||
|
__u8 guidExtensionCode[16]; \
|
||||||
|
__u8 bNumControls; \
|
||||||
|
__u8 bNrInPins; \
|
||||||
|
__u8 baSourceID[p]; \
|
||||||
|
__u8 bControlSize; \
|
||||||
|
__u8 bmControls[n]; \
|
||||||
|
__u8 iExtension; \
|
||||||
|
} __attribute__ ((packed))
|
||||||
|
|
||||||
|
/* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_control_endpoint_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u16 wMaxTransferSize;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_CONTROL_ENDPOINT_SIZE 5
|
||||||
|
|
||||||
|
/* 3.9.2.1. Input Header Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_input_header_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bNumFormats;
|
||||||
|
__u16 wTotalLength;
|
||||||
|
__u8 bEndpointAddress;
|
||||||
|
__u8 bmInfo;
|
||||||
|
__u8 bTerminalLink;
|
||||||
|
__u8 bStillCaptureMethod;
|
||||||
|
__u8 bTriggerSupport;
|
||||||
|
__u8 bTriggerUsage;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 bmaControls[];
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p))
|
||||||
|
|
||||||
|
#define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
|
||||||
|
uvc_input_header_descriptor_##n_##p
|
||||||
|
|
||||||
|
#define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
|
||||||
|
struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \
|
||||||
|
__u8 bLength; \
|
||||||
|
__u8 bDescriptorType; \
|
||||||
|
__u8 bDescriptorSubType; \
|
||||||
|
__u8 bNumFormats; \
|
||||||
|
__u16 wTotalLength; \
|
||||||
|
__u8 bEndpointAddress; \
|
||||||
|
__u8 bmInfo; \
|
||||||
|
__u8 bTerminalLink; \
|
||||||
|
__u8 bStillCaptureMethod; \
|
||||||
|
__u8 bTriggerSupport; \
|
||||||
|
__u8 bTriggerUsage; \
|
||||||
|
__u8 bControlSize; \
|
||||||
|
__u8 bmaControls[p][n]; \
|
||||||
|
} __attribute__ ((packed))
|
||||||
|
|
||||||
|
/* 3.9.2.2. Output Header Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_output_header_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bNumFormats;
|
||||||
|
__u16 wTotalLength;
|
||||||
|
__u8 bEndpointAddress;
|
||||||
|
__u8 bTerminalLink;
|
||||||
|
__u8 bControlSize;
|
||||||
|
__u8 bmaControls[];
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p))
|
||||||
|
|
||||||
|
#define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
|
||||||
|
uvc_output_header_descriptor_##n_##p
|
||||||
|
|
||||||
|
#define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
|
||||||
|
struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \
|
||||||
|
__u8 bLength; \
|
||||||
|
__u8 bDescriptorType; \
|
||||||
|
__u8 bDescriptorSubType; \
|
||||||
|
__u8 bNumFormats; \
|
||||||
|
__u16 wTotalLength; \
|
||||||
|
__u8 bEndpointAddress; \
|
||||||
|
__u8 bTerminalLink; \
|
||||||
|
__u8 bControlSize; \
|
||||||
|
__u8 bmaControls[p][n]; \
|
||||||
|
} __attribute__ ((packed))
|
||||||
|
|
||||||
|
/* 3.9.2.6. Color matching descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_color_matching_descriptor {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bColorPrimaries;
|
||||||
|
__u8 bTransferCharacteristics;
|
||||||
|
__u8 bMatrixCoefficients;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_COLOR_MATCHING_SIZE 6
|
||||||
|
|
||||||
|
/* 4.3.1.1. Video Probe and Commit Controls */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_streaming_control {
|
||||||
|
__u16 bmHint;
|
||||||
|
__u8 bFormatIndex;
|
||||||
|
__u8 bFrameIndex;
|
||||||
|
__u32 dwFrameInterval;
|
||||||
|
__u16 wKeyFrameRate;
|
||||||
|
__u16 wPFrameRate;
|
||||||
|
__u16 wCompQuality;
|
||||||
|
__u16 wCompWindowSize;
|
||||||
|
__u16 wDelay;
|
||||||
|
__u32 dwMaxVideoFrameSize;
|
||||||
|
__u32 dwMaxPayloadTransferSize;
|
||||||
|
__u32 dwClockFrequency;
|
||||||
|
__u8 bmFramingInfo;
|
||||||
|
__u8 bPreferedVersion;
|
||||||
|
__u8 bMinVersion;
|
||||||
|
__u8 bMaxVersion;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_format_uncompressed {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bFormatIndex;
|
||||||
|
__u8 bNumFrameDescriptors;
|
||||||
|
__u8 guidFormat[16];
|
||||||
|
__u8 bBitsPerPixel;
|
||||||
|
__u8 bDefaultFrameIndex;
|
||||||
|
__u8 bAspectRatioX;
|
||||||
|
__u8 bAspectRatioY;
|
||||||
|
__u8 bmInterfaceFlags;
|
||||||
|
__u8 bCopyProtect;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27
|
||||||
|
|
||||||
|
/* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_frame_uncompressed {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bFrameIndex;
|
||||||
|
__u8 bmCapabilities;
|
||||||
|
__u16 wWidth;
|
||||||
|
__u16 wHeight;
|
||||||
|
__u32 dwMinBitRate;
|
||||||
|
__u32 dwMaxBitRate;
|
||||||
|
__u32 dwMaxVideoFrameBufferSize;
|
||||||
|
__u32 dwDefaultFrameInterval;
|
||||||
|
__u8 bFrameIntervalType;
|
||||||
|
__u32 dwFrameInterval[];
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n))
|
||||||
|
|
||||||
|
#define UVC_FRAME_UNCOMPRESSED(n) \
|
||||||
|
uvc_frame_uncompressed_##n
|
||||||
|
|
||||||
|
#define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \
|
||||||
|
struct UVC_FRAME_UNCOMPRESSED(n) { \
|
||||||
|
__u8 bLength; \
|
||||||
|
__u8 bDescriptorType; \
|
||||||
|
__u8 bDescriptorSubType; \
|
||||||
|
__u8 bFrameIndex; \
|
||||||
|
__u8 bmCapabilities; \
|
||||||
|
__u16 wWidth; \
|
||||||
|
__u16 wHeight; \
|
||||||
|
__u32 dwMinBitRate; \
|
||||||
|
__u32 dwMaxBitRate; \
|
||||||
|
__u32 dwMaxVideoFrameBufferSize; \
|
||||||
|
__u32 dwDefaultFrameInterval; \
|
||||||
|
__u8 bFrameIntervalType; \
|
||||||
|
__u32 dwFrameInterval[n]; \
|
||||||
|
} __attribute__ ((packed))
|
||||||
|
|
||||||
|
/* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
struct uvc_format_mjpeg {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bFormatIndex;
|
||||||
|
__u8 bNumFrameDescriptors;
|
||||||
|
__u8 bmFlags;
|
||||||
|
__u8 bDefaultFrameIndex;
|
||||||
|
__u8 bAspectRatioX;
|
||||||
|
__u8 bAspectRatioY;
|
||||||
|
__u8 bmInterfaceFlags;
|
||||||
|
__u8 bCopyProtect;
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_FORMAT_MJPEG_SIZE 11
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_begin.h"
|
||||||
|
#endif
|
||||||
|
RTW_PACK_STRUCT_BEGIN
|
||||||
|
/* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
|
||||||
|
|
||||||
|
struct uvc_frame_mjpeg {
|
||||||
|
__u8 bLength;
|
||||||
|
__u8 bDescriptorType;
|
||||||
|
__u8 bDescriptorSubType;
|
||||||
|
__u8 bFrameIndex;
|
||||||
|
__u8 bmCapabilities;
|
||||||
|
__u16 wWidth;
|
||||||
|
__u16 wHeight;
|
||||||
|
__u32 dwMinBitRate;
|
||||||
|
__u32 dwMaxBitRate;
|
||||||
|
__u32 dwMaxVideoFrameBufferSize;
|
||||||
|
__u32 dwDefaultFrameInterval;
|
||||||
|
__u8 bFrameIntervalType;
|
||||||
|
__u32 dwFrameInterval[];
|
||||||
|
} //__attribute__((__packed__));
|
||||||
|
RTW_PACK_STRUCT_STRUCT;
|
||||||
|
RTW_PACK_STRUCT_END
|
||||||
|
#ifdef RTW_PACK_STRUCT_USE_INCLUDES
|
||||||
|
# include "pack_end.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n))
|
||||||
|
|
||||||
|
#define UVC_FRAME_MJPEG(n) \
|
||||||
|
uvc_frame_mjpeg_##n
|
||||||
|
|
||||||
|
#define DECLARE_UVC_FRAME_MJPEG(n) \
|
||||||
|
struct UVC_FRAME_MJPEG(n) { \
|
||||||
|
__u8 bLength; \
|
||||||
|
__u8 bDescriptorType; \
|
||||||
|
__u8 bDescriptorSubType; \
|
||||||
|
__u8 bFrameIndex; \
|
||||||
|
__u8 bmCapabilities; \
|
||||||
|
__u16 wWidth; \
|
||||||
|
__u16 wHeight; \
|
||||||
|
__u32 dwMinBitRate; \
|
||||||
|
__u32 dwMaxBitRate; \
|
||||||
|
__u32 dwMaxVideoFrameBufferSize; \
|
||||||
|
__u32 dwDefaultFrameInterval; \
|
||||||
|
__u8 bFrameIntervalType; \
|
||||||
|
__u32 dwFrameInterval[n]; \
|
||||||
|
} __attribute__ ((packed))
|
||||||
|
|
||||||
|
#endif /* __LINUX_USB_VIDEO_H */
|
||||||
|
|
|
@ -0,0 +1,478 @@
|
||||||
|
#ifndef WLANCONFIG_H
|
||||||
|
#define WLANCONFIG_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Include user defined options first. Anything not defined in these files
|
||||||
|
* will be set to standard values. Override anything you dont like!
|
||||||
|
*/
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B) || defined(CONFIG_HARDWARE_8188F)
|
||||||
|
#include "platform_opts.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_PLATFORM_AMEBA_X
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define PLATFORM_FREERTOS 1
|
||||||
|
#define CONFIG_GSPI_HCI
|
||||||
|
#else
|
||||||
|
#define CONFIG_LX_HCI
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_INIC_EN
|
||||||
|
#define CONFIG_INIC_EN 0//For iNIC project
|
||||||
|
#if CONFIG_INIC_EN
|
||||||
|
#define CONFIG_LWIP_LAYER 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CONFIG_LITTLE_ENDIAN
|
||||||
|
#define CONFIG_80211N_HT
|
||||||
|
//#define CONFIG_RECV_REORDERING_CTRL
|
||||||
|
#define RTW_NOTCH_FILTER 0
|
||||||
|
#define CONFIG_EMBEDDED_FWIMG
|
||||||
|
#define CONFIG_PHY_SETTING_WITH_ODM
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_ODM_REFRESH_RAMASK
|
||||||
|
#define HAL_MAC_ENABLE 1
|
||||||
|
#define HAL_BB_ENABLE 1
|
||||||
|
#define HAL_RF_ENABLE 1
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
/* Patch when dynamic mechanism is not ready */
|
||||||
|
//#define CONFIG_DM_PATCH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#define CONFIG_DEBUG
|
||||||
|
//#define CONFIG_DEBUG_RTL871X
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_MEM_MONITOR MEM_MONITOR_SIMPLE
|
||||||
|
#define WLAN_INTF_DBG 0
|
||||||
|
//#define CONFIG_DEBUG_DYNAMIC
|
||||||
|
//#define DBG_TX 1
|
||||||
|
//#define DBG_XMIT_BUF 1
|
||||||
|
//#define DBG_XMIT_BUF_EXT 1
|
||||||
|
#define DBG_TX_DROP_FRAME
|
||||||
|
#else
|
||||||
|
#define CONFIG_MEM_MONITOR MEM_MONITOR_LEAK
|
||||||
|
//#define CONFIG_TRACE_SKB
|
||||||
|
//#define WLAN_INTF_DBG
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
|
||||||
|
//#define CONFIG_DONT_CARE_TP
|
||||||
|
//#define CONFIG_MEMORY_ACCESS_ALIGNED
|
||||||
|
#define CONFIG_POWER_SAVING
|
||||||
|
#ifdef CONFIG_POWER_SAVING
|
||||||
|
#define CONFIG_IPS
|
||||||
|
#define CONFIG_LPS
|
||||||
|
//#define CONFIG_LPS_LCLK
|
||||||
|
#define CONFIG_LPS_32K
|
||||||
|
#define TDMA_POWER_SAVING
|
||||||
|
#define CONFIG_WAIT_PS_ACK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BAD_MIC_COUNTERMEASURE 1
|
||||||
|
#define DEFRAGMENTATION 1
|
||||||
|
|
||||||
|
#define WIFI_LOGO_CERTIFICATION 0
|
||||||
|
#if WIFI_LOGO_CERTIFICATION
|
||||||
|
#define RX_AGGREGATION 1
|
||||||
|
#define RX_AMSDU 1
|
||||||
|
#else
|
||||||
|
#define RX_AGGREGATION 0
|
||||||
|
#define RX_AMSDU 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_USE_TCM_HEAP 1 /* USE TCM HEAP */
|
||||||
|
#endif
|
||||||
|
#define CONFIG_RECV_TASKLET_THREAD
|
||||||
|
#define CONFIG_XMIT_TASKLET_THREAD
|
||||||
|
#else
|
||||||
|
#define CONFIG_XMIT_THREAD_MODE
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
//#define CONFIG_RECV_THREAD_MODE /* Wlan IRQ Polling Mode*/
|
||||||
|
//#define CONFIG_ISR_THREAD_MODE_POLLING /* Wlan IRQ Polling Mode*/
|
||||||
|
|
||||||
|
//1 Chris
|
||||||
|
#ifndef CONFIG_SDIO_HCI
|
||||||
|
#define CONFIG_ISR_THREAD_MODE_INTERRUPT /* Wlan IRQ Interrupt Mode*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ISR_THREAD_MODE_POLLING) && defined(CONFIG_ISR_THREAD_MODE_INTERRUPT)
|
||||||
|
#error "CONFIG_ISR_THREAD_MODE_POLLING and CONFIG_ISR_THREAD_MODE_INTERRUPT are mutually exclusive. "
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
/* CRC DMEM optimized mode consume 1k less SRM memory consumption */
|
||||||
|
#define CRC_IMPLEMENTATION_MODE CRC_IMPLEMENTATION_DMEM_OPTIMIZED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* AES DMEM optimized mode comsume 10k less memory compare to
|
||||||
|
IMEM optimized mode AES_IMPLEMENTATION_IMEM_OPTIMIZED */
|
||||||
|
#define AES_IMPLEMENTATION_MODE AES_IMPLEMENTATION_DMEM_OPTIMIZED
|
||||||
|
|
||||||
|
#define USE_SKB_AS_XMITBUF 1
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define USE_XMIT_EXTBUFF 1
|
||||||
|
#else
|
||||||
|
#define USE_XMIT_EXTBUFF 0
|
||||||
|
#endif
|
||||||
|
#define USE_MUTEX_FOR_SPINLOCK 1
|
||||||
|
|
||||||
|
// remove function to reduce code
|
||||||
|
#define NOT_SUPPORT_5G
|
||||||
|
#define NOT_SUPPORT_RF_MULTIPATH
|
||||||
|
#define NOT_SUPPORT_VHT
|
||||||
|
#define NOT_SUPPORT_40M
|
||||||
|
#define NOT_SUPPORT_80M
|
||||||
|
#define NOT_SUPPORT_BBSWING
|
||||||
|
#define NOT_SUPPORT_OLD_CHANNEL_PLAN
|
||||||
|
#define NOT_SUPPORT_BT
|
||||||
|
|
||||||
|
#define CONFIG_WIFI_SPEC 0
|
||||||
|
#define CONFIG_FAKE_EFUSE 0
|
||||||
|
#if CONFIG_FAKE_EFUSE
|
||||||
|
#define FAKE_CHIPID CHIPID_8711AN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CONFIG_AUTO_RECONNECT 1
|
||||||
|
#define ENABLE_HWPDN_PIN
|
||||||
|
#define SUPPORT_SCAN_BUF 1
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define BE_I_CUT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For WPA2 */
|
||||||
|
#define CONFIG_INCLUDE_WPA_PSK
|
||||||
|
#ifdef CONFIG_INCLUDE_WPA_PSK
|
||||||
|
#define CONFIG_MULTIPLE_WPA_STA
|
||||||
|
//#define CONFIG_WPA2_PREAUTH
|
||||||
|
#define PSK_SUPPORT_TKIP 1
|
||||||
|
#endif
|
||||||
|
//#define AP_PSK_SUPPORT_TKIP
|
||||||
|
|
||||||
|
/* For promiscuous mode */
|
||||||
|
#define CONFIG_PROMISC
|
||||||
|
#ifdef CONFIG_PROMISC
|
||||||
|
//#define CONFIG_PROMISC_SCAN_CONCURENT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PROMISC_DENY_PAIRWISE 0
|
||||||
|
|
||||||
|
/* For Simple Link */
|
||||||
|
#ifndef CONFIG_INCLUDE_SIMPLE_CONFIG
|
||||||
|
//#define CONFIG_INCLUDE_SIMPLE_CONFIG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// for probe request with custom vendor specific IE
|
||||||
|
#define CONFIG_CUSTOM_IE
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
/* For multicast */
|
||||||
|
#define CONFIG_MULTICAST
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For STA+AP Concurrent MODE */
|
||||||
|
#if !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_CONCURRENT_MODE
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
|
#define CONFIG_RUNTIME_PORT_SWITCH
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_HARDWARE_8188F)
|
||||||
|
#define NET_IF_NUM 2
|
||||||
|
#else
|
||||||
|
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if defined(CONFIG_HARDWARE_8188F)
|
||||||
|
#define NET_IF_NUM 1
|
||||||
|
#else
|
||||||
|
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/****************** For EAP auth configurations *******************/
|
||||||
|
#define CONFIG_TLS 0
|
||||||
|
#define CONFIG_PEAP 0
|
||||||
|
#define CONFIG_TTLS 0
|
||||||
|
|
||||||
|
// DO NOT change the below config of EAP
|
||||||
|
#ifdef PRE_CONFIG_EAP
|
||||||
|
#define CONFIG_TLS 1
|
||||||
|
#define CONFIG_PEAP 1
|
||||||
|
#define CONFIG_TTLS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// enable 1X code in lib_wlan as default (increase 380 bytes)
|
||||||
|
#define CONFIG_EAP
|
||||||
|
|
||||||
|
#if CONFIG_TLS || CONFIG_PEAP || CONFIG_TTLS
|
||||||
|
#define EAP_REMOVE_UNUSED_CODE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EAP_SSL_VERIFY_SERVER
|
||||||
|
|
||||||
|
#if CONFIG_TLS
|
||||||
|
#define EAP_SSL_VERIFY_CLIENT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_TTLS
|
||||||
|
#define EAP_MSCHAPv2
|
||||||
|
#define EAP_TTLS_MSCHAPv2
|
||||||
|
//#define EAP_TTLS_EAP
|
||||||
|
//#define EAP_TTLS_MSCHAP
|
||||||
|
//#define EAP_TTLS_PAP
|
||||||
|
//#define EAP_TTLS_CHAP
|
||||||
|
#endif
|
||||||
|
/****************** End of EAP configurations *******************/
|
||||||
|
|
||||||
|
/* For WPS and P2P */
|
||||||
|
// #define CONFIG_WPS
|
||||||
|
#if 0
|
||||||
|
#define CONFIG_WPS_AP
|
||||||
|
#define CONFIG_P2P_NEW
|
||||||
|
#if (!defined(SUPPORT_SCAN_BUF)||!defined(CONFIG_WPS_AP)) && defined(CONFIG_P2P_NEW)
|
||||||
|
#error "If CONFIG_P2P_NEW, need to SUPPORT_SCAN_BUF"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CONFIG_NEW_SIGNAL_STAT_PROCESS
|
||||||
|
|
||||||
|
/* For AP_MODE */
|
||||||
|
#define CONFIG_AP_MODE
|
||||||
|
extern unsigned char g_user_ap_sta_num;
|
||||||
|
#define USER_AP_STA_NUM g_user_ap_sta_num
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define AP_STA_NUM 3 //2014/10/27 modify to 3
|
||||||
|
#define USE_DEDICATED_BCN_TX 0
|
||||||
|
#if USE_DEDICATED_BCN_TX
|
||||||
|
#error "WLAN driver for Ameba should not enable USE_DEDICATED_BCN_TX"
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
extern unsigned int g_ap_sta_num;
|
||||||
|
#define AP_STA_NUM 3//g_ap_sta_num
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_AP_MODE
|
||||||
|
#define CONFIG_NATIVEAP_MLME
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_INTERRUPT_BASED_TXBCN
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
|
||||||
|
//#define CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
|
||||||
|
#define CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
|
||||||
|
#endif
|
||||||
|
// #define CONFIG_GK_REKEY
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define USE_DEDICATED_BCN_TX 1
|
||||||
|
#endif
|
||||||
|
#if CONFIG_INIC_EN
|
||||||
|
// #define REPORT_STA_EVENT //useless
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define USE_DEDICATED_BCN_TX 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_AP_MODE) && defined(CONFIG_GK_REKEY) && !defined(CONFIG_MULTIPLE_WPA_STA)
|
||||||
|
#error "If CONFIG_GK_REKEY when CONFIG_AP_MODE, need to CONFIG_MULTIPLE_WPA_STA"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if !defined(CONFIG_AP_MODE) && defined(CONFIG_CONCURRENT_MODE)
|
||||||
|
#error "If CONFIG_CONCURRENT_MODEE, need to CONFIG_AP_MODE"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For efuse or flash config */
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_RW_PHYSICAL_EFUSE 0 // Mask efuse user blocks
|
||||||
|
#define CONFIG_HIDE_PROTECT_EFUSE 1
|
||||||
|
#define CONFIG_ADAPTOR_INFO_CACHING_FLASH 1
|
||||||
|
#define CHECK_FLASH_VALID_MASK 1
|
||||||
|
#define CHECK_EFUSE_VALID_MASK 1
|
||||||
|
/* For K-free */
|
||||||
|
// #if !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define CONFIG_RF_GAIN_OFFSET
|
||||||
|
// #endif
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
|
||||||
|
/* For MP_MODE */
|
||||||
|
//#define CONFIG_MP_INCLUDED
|
||||||
|
#ifdef CONFIG_MP_INCLUDED
|
||||||
|
#define MP_DRIVER 1
|
||||||
|
#define CONFIG_MP_IWPRIV_SUPPORT
|
||||||
|
// #define HAL_EFUSE_MEMORY
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define MP_REG_TEST
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define MP_DRIVER 0
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
|
//Control wifi mcu function
|
||||||
|
#define CONFIG_LITTLE_WIFI_MCU_FUNCTION_THREAD
|
||||||
|
#define CONFIG_ODM_REFRESH_RAMASK
|
||||||
|
#define CONFIG_ANTENNA_DIVERSITY
|
||||||
|
#endif
|
||||||
|
#endif // #ifdef CONFIG_MP_INCLUDED
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
|
#ifndef CONFIG_RTL8195A
|
||||||
|
#define CONFIG_RTL8195A
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#ifndef CONFIG_RTL8711B
|
||||||
|
#define CONFIG_RTL8711B
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#elif defined(CONFIG_HARDWARE_8188F)
|
||||||
|
#define CONFIG_RTL8188F
|
||||||
|
#else
|
||||||
|
#define CONFIG_RTL8188E
|
||||||
|
#endif
|
||||||
|
#define RTL8192C_SUPPORT 0
|
||||||
|
#define RTL8192CE_SUPPORT 0
|
||||||
|
#define RTL8192CU_SUPPORT 0
|
||||||
|
#define RTL8192D_SUPPORT 0
|
||||||
|
#define RTL8192DE_SUPPORT 0
|
||||||
|
#define RTL8192DU_SUPPORT 0
|
||||||
|
#define RTL8723A_SUPPORT 0
|
||||||
|
#define RTL8723AU_SUPPORT 0
|
||||||
|
#define RTL8723AS_SUPPORT 0
|
||||||
|
#define RTL8192E_SUPPORT 0
|
||||||
|
#define RTL8812A_SUPPORT 0
|
||||||
|
#define RTL8821A_SUPPORT 0
|
||||||
|
#define RTL8723B_SUPPORT 0
|
||||||
|
#define RTL8195A_SUPPORT 0
|
||||||
|
#define RTL8188E_SUPPORT 0
|
||||||
|
#define RTL8188F_SUPPORT 0
|
||||||
|
#define RTL8711B_SUPPORT 0
|
||||||
|
#if defined(CONFIG_PLATFORM_8195A)
|
||||||
|
#undef RTL8195A_SUPPORT
|
||||||
|
#define RTL8195A_SUPPORT 1
|
||||||
|
#elif defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#undef RTL8711B_SUPPORT
|
||||||
|
#define RTL8711B_SUPPORT 1
|
||||||
|
#elif defined(CONFIG_HARDWARE_8188F)
|
||||||
|
#undef RTL8188F_SUPPORT
|
||||||
|
#define RTL8188F_SUPPORT 1
|
||||||
|
#else
|
||||||
|
#undef RTL8188E_SUPPORT
|
||||||
|
#define RTL8188E_SUPPORT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TEST_CHIP_SUPPORT 0
|
||||||
|
|
||||||
|
#define RTL8188E_FOR_TEST_CHIP 0
|
||||||
|
#define RTL8188E_FPGA_TRUE_PHY_VERIFICATION 0
|
||||||
|
|
||||||
|
// for Debug message
|
||||||
|
#define DBG 0
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#if(DBG == 0)
|
||||||
|
#define ROM_E_RTW_MSG 1
|
||||||
|
/* For DM debug*/
|
||||||
|
// BB
|
||||||
|
#define DBG_RX_INFO 1
|
||||||
|
#define DBG_TX_RATE 1 // DebugComponents: bit9
|
||||||
|
#define DBG_DM_RA 1 // DebugComponents: bit9
|
||||||
|
#define DBG_DM_DIG 1 // DebugComponents: bit0
|
||||||
|
#define DBG_DM_ANT_DIV 1 // DebugComponents: bit6
|
||||||
|
#define DBG_DM_ADAPTIVITY 1 // DebugComponents: bit17
|
||||||
|
// RF
|
||||||
|
#define DBG_PWR_TRACKING 1 // DebugComponents: bit24
|
||||||
|
#define DBG_RF_IQK 1 // DebugComponents: bit26
|
||||||
|
// Common
|
||||||
|
#define DBG_PWR_INDEX 1 // DebugComponents: bit30
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For DM support */
|
||||||
|
#if defined(CONFIG_RTL8188F)
|
||||||
|
#define RATE_ADAPTIVE_SUPPORT 0
|
||||||
|
#else
|
||||||
|
#define RATE_ADAPTIVE_SUPPORT 1
|
||||||
|
#endif
|
||||||
|
// adaptivity
|
||||||
|
#define RTW_ADAPTIVITY_EN_DISABLE 0
|
||||||
|
#define RTW_ADAPTIVITY_EN_ENABLE 1
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_EN RTW_ADAPTIVITY_EN_DISABLE
|
||||||
|
#define RTW_ADAPTIVITY_MODE_NORMAL 0
|
||||||
|
#define RTW_ADAPTIVITY_MODE_CARRIER_SENSE 1
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_MODE RTW_ADAPTIVITY_MODE_CARRIER_SENSE
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_DML 0
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define CONFIG_POWER_TRAINING_WIL 0 // in RA
|
||||||
|
#else
|
||||||
|
#define POWER_BY_RATE_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_PLATFORM_AMEBA_X)
|
||||||
|
#define RTL8195A_FOR_TEST_CHIP 0
|
||||||
|
|
||||||
|
//#define CONFIG_WIFI_TEST 1
|
||||||
|
//#define CONFIG_MAC_LOOPBACK_DRIVER 1
|
||||||
|
//#define CONFIG_WLAN_HAL_TEST 1
|
||||||
|
//#define SKB_PRE_ALLOCATE_TX 1
|
||||||
|
#define SKB_PRE_ALLOCATE_RX 0
|
||||||
|
#define TX_CHECK_DSEC_ALWAYS 1
|
||||||
|
#define CONFIG_DBG_DISABLE_RDU_INTERRUPT
|
||||||
|
//#define CONFIG_WLAN_HAL_RX_TASK
|
||||||
|
#if (SKB_PRE_ALLOCATE_RX == 1)
|
||||||
|
#define EXCHANGE_LXBUS_RX_SKB 0
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_PLATFORM_8711B)
|
||||||
|
//Enable mac loopback for test mode (Ameba)
|
||||||
|
#define CONFIG_TWO_MAC_DRIVER // for test mode
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_MAC_LB_FOR_TEST_MODE
|
||||||
|
#define CONFIG_SUDO_PHY_SETTING
|
||||||
|
#define INT_HANDLE_IN_ISR 1
|
||||||
|
#define CONFIG_LWIP_LAYER 0
|
||||||
|
#define CONFIG_WLAN_HAL_TEST
|
||||||
|
#define CONFIG_WLAN_HAL_RX_TASK
|
||||||
|
#define CONFIG_MAC_LOOPBACK_DRIVER_RTL8711B 1
|
||||||
|
#define HAL_MAC_ENABLE 1
|
||||||
|
#define CONFIG_TWO_MAC_TEST_MODE
|
||||||
|
#define DISABLE_BB_RF 1
|
||||||
|
#else
|
||||||
|
//#define CONFIG_TWO_MAC_DRIVER //for mornal driver; two mac
|
||||||
|
#ifdef CONFIG_TWO_MAC_DRIVER
|
||||||
|
#define CONFIG_SUDO_PHY_SETTING
|
||||||
|
#define HAL_MAC_ENABLE 1
|
||||||
|
#define DISABLE_BB_RF 1
|
||||||
|
#else
|
||||||
|
#define HAL_MAC_ENABLE 1
|
||||||
|
#define HAL_BB_ENABLE 1
|
||||||
|
#define HAL_RF_ENABLE 1
|
||||||
|
#define DISABLE_BB_RF 0
|
||||||
|
#endif
|
||||||
|
//#define INT_HANDLE_IN_ISR 1
|
||||||
|
#endif
|
||||||
|
#endif // CONFIG_PLATFORM_AMEBA_X
|
||||||
|
|
||||||
|
#ifndef CONFIG_LWIP_LAYER
|
||||||
|
#define CONFIG_LWIP_LAYER 1
|
||||||
|
#endif
|
||||||
|
#define CONFIG_MAC_ADDRESS 0
|
||||||
|
//fast reconnection
|
||||||
|
//#define CONFIG_FAST_RECONNECTION 1
|
||||||
|
#if defined(CONFIG_INIC_EN)&&(CONFIG_INIC_EN==1)
|
||||||
|
#define CONFIG_RECV_REORDERING_CTRL //enable reordering for iNIC high throughput
|
||||||
|
#undef RX_AGGREGATION
|
||||||
|
#define RX_AGGREGATION 1
|
||||||
|
#undef NOT_SUPPORT_40M
|
||||||
|
#undef CONFIG_CONCURRENT_MODE
|
||||||
|
#endif
|
||||||
|
#endif //WLANCONFIG_H
|
|
@ -0,0 +1,106 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of version 2 of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* 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, USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef __DRV_CONF_H__
|
||||||
|
#define __DRV_CONF_H__
|
||||||
|
|
||||||
|
#include "autoconf.h"
|
||||||
|
#if ((RTL8195A_SUPPORT==1) || (RTL8711B_SUPPORT==1))
|
||||||
|
#include "platform_autoconf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
|
||||||
|
|
||||||
|
#error "Shall be Linux or Windows, but not both!\n"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//Older Android kernel doesn't has CONFIG_ANDROID defined,
|
||||||
|
//add this to force CONFIG_ANDROID defined
|
||||||
|
#ifdef CONFIG_PLATFORM_ANDROID
|
||||||
|
#define CONFIG_ANDROID
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ANDROID
|
||||||
|
//Some Android build will restart the UI while non-printable ascii is passed
|
||||||
|
//between java and c/c++ layer (JNI). We force CONFIG_VALIDATE_SSID
|
||||||
|
//for Android here. If you are sure there is no risk on your system about this,
|
||||||
|
//mask this macro define to support non-printable ascii ssid.
|
||||||
|
//#define CONFIG_VALIDATE_SSID
|
||||||
|
#ifdef CONFIG_PLATFORM_ARM_SUNxI
|
||||||
|
#ifdef CONFIG_VALIDATE_SSID
|
||||||
|
#undef CONFIG_VALIDATE_SSID
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//Android expect dbm as the rx signal strength unit
|
||||||
|
#define CONFIG_SIGNAL_DISPLAY_DBM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_HAS_EARLYSUSPEND) && defined (CONFIG_RESUME_IN_WORKQUEUE)
|
||||||
|
#warning "You have CONFIG_HAS_EARLYSUSPEND enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
|
||||||
|
#undef CONFIG_RESUME_IN_WORKQUEUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ANDROID_POWER) && defined (CONFIG_RESUME_IN_WORKQUEUE)
|
||||||
|
#warning "You have CONFIG_ANDROID_POWER enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
|
||||||
|
#undef CONFIG_RESUME_IN_WORKQUEUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_RESUME_IN_WORKQUEUE //this can be removed, because there is no case for this...
|
||||||
|
#if !defined( CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER)
|
||||||
|
#error "enable CONFIG_RESUME_IN_WORKQUEUE without CONFIG_WAKELOCK or CONFIG_ANDROID_POWER will suffer from the danger of wifi's unfunctionality..."
|
||||||
|
#error "If you still want to enable CONFIG_RESUME_IN_WORKQUEUE in this case, mask this preprossor checking and GOOD LUCK..."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//About USB VENDOR REQ
|
||||||
|
#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
|
||||||
|
#warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC automatically"
|
||||||
|
#define CONFIG_USB_VENDOR_REQ_MUTEX
|
||||||
|
#endif
|
||||||
|
#if defined(CONFIG_VENDOR_REQ_RETRY) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
|
||||||
|
#warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_VENDOR_REQ_RETRY automatically"
|
||||||
|
#define CONFIG_USB_VENDOR_REQ_MUTEX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_RTW_ADAPTIVITY_EN
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_EN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_RTW_ADAPTIVITY_MODE
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_MODE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_RTW_ADAPTIVITY_DML
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_DML 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_RTW_ADAPTIVITY_DC_BACKOFF
|
||||||
|
#define CONFIG_RTW_ADAPTIVITY_DC_BACKOFF 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_RTW_NHM_EN
|
||||||
|
#define CONFIG_RTW_NHM_EN 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#include <rtl871x_byteorder.h>
|
||||||
|
|
||||||
|
#endif // __DRV_CONF_H__
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright(c) 2007 - 2014 Realtek Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* This is ROM code section.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef ROM_AES_H
|
||||||
|
#define ROM_AES_H
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
u32 erk[64]; /* encryption round keys */
|
||||||
|
u32 drk[64]; /* decryption round keys */
|
||||||
|
int nr; /* number of rounds */
|
||||||
|
}aes_context;
|
||||||
|
|
||||||
|
|
||||||
|
#define AES_BLOCKSIZE8 8
|
||||||
|
#define AES_BLK_SIZE 16 // # octets in an AES block
|
||||||
|
typedef union _aes_block // AES cipher block
|
||||||
|
{
|
||||||
|
unsigned long x[AES_BLK_SIZE/4]; // access as 8-bit octets or 32-bit words
|
||||||
|
unsigned char b[AES_BLK_SIZE];
|
||||||
|
}aes_block;
|
||||||
|
|
||||||
|
|
||||||
|
void AES_WRAP(unsigned char * plain, int plain_len,
|
||||||
|
unsigned char * iv, int iv_len,
|
||||||
|
unsigned char * kek, int kek_len,
|
||||||
|
unsigned char *cipher, unsigned short *cipher_len);
|
||||||
|
|
||||||
|
void AES_UnWRAP(unsigned char * cipher, int cipher_len,
|
||||||
|
unsigned char * kek, int kek_len,
|
||||||
|
unsigned char * plain);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,456 @@
|
||||||
|
/******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of version 2 of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* 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, USA
|
||||||
|
*
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
#ifndef __RTW_DEBUG_H__
|
||||||
|
#define __RTW_DEBUG_H__
|
||||||
|
|
||||||
|
|
||||||
|
#define _drv_always_ 1
|
||||||
|
#define _drv_emerg_ 2
|
||||||
|
#define _drv_alert_ 3
|
||||||
|
#define _drv_crit_ 4
|
||||||
|
#define _drv_err_ 5
|
||||||
|
#define _drv_warning_ 6
|
||||||
|
#define _drv_notice_ 7
|
||||||
|
#define _drv_info_ 8
|
||||||
|
#define _drv_dump_ 9
|
||||||
|
#define _drv_debug_ 10
|
||||||
|
|
||||||
|
|
||||||
|
#define _module_rtl871x_xmit_c_ BIT(0)
|
||||||
|
#define _module_xmit_osdep_c_ BIT(1)
|
||||||
|
#define _module_rtl871x_recv_c_ BIT(2)
|
||||||
|
#define _module_recv_osdep_c_ BIT(3)
|
||||||
|
#define _module_rtl871x_mlme_c_ BIT(4)
|
||||||
|
#define _module_mlme_osdep_c_ BIT(5)
|
||||||
|
#define _module_rtl871x_sta_mgt_c_ BIT(6)
|
||||||
|
#define _module_rtl871x_cmd_c_ BIT(7)
|
||||||
|
#define _module_cmd_osdep_c_ BIT(8)
|
||||||
|
#define _module_rtl871x_io_c_ BIT(9)
|
||||||
|
#define _module_io_osdep_c_ BIT(10)
|
||||||
|
#define _module_os_intfs_c_ BIT(11)
|
||||||
|
#define _module_rtl871x_security_c_ BIT(12)
|
||||||
|
#define _module_rtl871x_eeprom_c_ BIT(13)
|
||||||
|
#define _module_hal_init_c_ BIT(14)
|
||||||
|
#define _module_hci_hal_init_c_ BIT(15)
|
||||||
|
#define _module_rtl871x_ioctl_c_ BIT(16)
|
||||||
|
#define _module_rtl871x_ioctl_set_c_ BIT(17)
|
||||||
|
#define _module_rtl871x_ioctl_query_c_ BIT(18)
|
||||||
|
#define _module_rtl871x_pwrctrl_c_ BIT(19)
|
||||||
|
#define _module_hci_intfs_c_ BIT(20)
|
||||||
|
#define _module_hci_ops_c_ BIT(21)
|
||||||
|
#define _module_osdep_service_c_ BIT(22)
|
||||||
|
#define _module_mp_ BIT(23)
|
||||||
|
#define _module_hci_ops_os_c_ BIT(24)
|
||||||
|
#define _module_rtl871x_ioctl_os_c BIT(25)
|
||||||
|
#define _module_rtl8712_cmd_c_ BIT(26)
|
||||||
|
#define _module_fwcmd_c_ BIT(27)
|
||||||
|
#define _module_rtl8192c_xmit_c_ BIT(28)
|
||||||
|
#define _module_hal_xmit_c_ BIT(28)
|
||||||
|
#define _module_efuse_ BIT(29)
|
||||||
|
#define _module_rtl8712_recv_c_ BIT(30)
|
||||||
|
#define _module_rtl8712_led_c_ BIT(31)
|
||||||
|
|
||||||
|
#undef _MODULE_DEFINE_
|
||||||
|
|
||||||
|
#if defined _RTW_XMIT_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_xmit_c_
|
||||||
|
#elif defined _XMIT_OSDEP_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_xmit_osdep_c_
|
||||||
|
#elif defined _RTW_RECV_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_recv_c_
|
||||||
|
#elif defined _RECV_OSDEP_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_recv_osdep_c_
|
||||||
|
#elif defined _RTW_MLME_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_mlme_c_
|
||||||
|
#elif defined _MLME_OSDEP_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_mlme_osdep_c_
|
||||||
|
#elif defined _RTW_MLME_EXT_C_
|
||||||
|
#define _MODULE_DEFINE_ 1
|
||||||
|
#elif defined _RTW_STA_MGT_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_sta_mgt_c_
|
||||||
|
#elif defined _RTW_CMD_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_cmd_c_
|
||||||
|
#elif defined _CMD_OSDEP_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_cmd_osdep_c_
|
||||||
|
#elif defined _RTW_IO_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_io_c_
|
||||||
|
#elif defined _IO_OSDEP_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_io_osdep_c_
|
||||||
|
#elif defined _OS_INTFS_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_os_intfs_c_
|
||||||
|
#elif defined _RTW_SECURITY_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_security_c_
|
||||||
|
#elif defined _RTW_EEPROM_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_eeprom_c_
|
||||||
|
#elif defined _HAL_INTF_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_hal_init_c_
|
||||||
|
#elif (defined _HCI_HAL_INIT_C_) || (defined _SDIO_HALINIT_C_)
|
||||||
|
#define _MODULE_DEFINE_ _module_hci_hal_init_c_
|
||||||
|
#elif defined _RTL871X_IOCTL_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_c_
|
||||||
|
#elif defined _RTL871X_IOCTL_SET_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_set_c_
|
||||||
|
#elif defined _RTL871X_IOCTL_QUERY_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_query_c_
|
||||||
|
#elif defined _RTL871X_PWRCTRL_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_pwrctrl_c_
|
||||||
|
#elif defined _RTW_PWRCTRL_C_
|
||||||
|
#define _MODULE_DEFINE_ 1
|
||||||
|
#elif defined _HCI_INTF_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_hci_intfs_c_
|
||||||
|
#elif defined _HCI_OPS_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_hci_ops_c_
|
||||||
|
#elif defined _SDIO_OPS_C_
|
||||||
|
#define _MODULE_DEFINE_ 1
|
||||||
|
#elif defined _OSDEP_HCI_INTF_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_hci_intfs_c_
|
||||||
|
#elif defined _OSDEP_SERVICE_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_osdep_service_c_
|
||||||
|
#elif defined _HCI_OPS_OS_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_hci_ops_os_c_
|
||||||
|
#elif defined _RTL871X_IOCTL_LINUX_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_os_c
|
||||||
|
#elif defined _RTL8712_CMD_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl8712_cmd_c_
|
||||||
|
#elif defined _RTL8192C_XMIT_C_
|
||||||
|
#define _MODULE_DEFINE_ 1
|
||||||
|
#elif defined _RTL8723AS_XMIT_C_
|
||||||
|
#define _MODULE_DEFINE_ 1
|
||||||
|
#elif defined _RTL8712_RECV_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl8712_recv_c_
|
||||||
|
#elif defined _RTL8192CU_RECV_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_rtl8712_recv_c_
|
||||||
|
#elif defined _RTL871X_MLME_EXT_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_mlme_osdep_c_
|
||||||
|
#elif defined _RTW_MP_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_mp_
|
||||||
|
#elif defined _RTW_MP_IOCTL_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_mp_
|
||||||
|
#elif defined _RTW_EFUSE_C_
|
||||||
|
#define _MODULE_DEFINE_ _module_efuse_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PLATFORM_OS_CE
|
||||||
|
extern void rtl871x_cedbg(const char *fmt, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define RT_TRACE(_Comp, _Level, Fmt) do{}while(0)
|
||||||
|
#define _func_enter_ do{}while(0)
|
||||||
|
#define _func_exit_ do{}while(0)
|
||||||
|
#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) do{}while(0)
|
||||||
|
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
#define DBG_871X do {} while(0)
|
||||||
|
#define MSG_8192C do {} while(0)
|
||||||
|
#define DBG_8192C do {} while(0)
|
||||||
|
#define DBG_871X_LEVEL do {} while(0)
|
||||||
|
#else
|
||||||
|
#define DBG_871X(x, ...) do {} while(0)
|
||||||
|
#define MSG_8192C(x, ...) do {} while(0)
|
||||||
|
#define DBG_8192C(x,...) do {} while(0)
|
||||||
|
#define DBG_871X_LEVEL(x,...) do {} while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef _dbgdump
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
|
||||||
|
#ifdef PLATFORM_OS_XP
|
||||||
|
#define _dbgdump DbgPrint
|
||||||
|
#elif defined PLATFORM_OS_CE
|
||||||
|
#define _dbgdump rtl871x_cedbg
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined PLATFORM_LINUX
|
||||||
|
#define _dbgdump printk
|
||||||
|
#elif defined PLATFORM_ECOS
|
||||||
|
#define _dbgdump diag_printf
|
||||||
|
#elif defined PLATFORM_FREERTOS
|
||||||
|
#define _dbgdump printf("\n\r"); printf
|
||||||
|
#elif defined PLATFORM_FREEBSD
|
||||||
|
#define _dbgdump printf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define DRIVER_PREFIX "RTL871X: "
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEBUG_LEVEL (_drv_err_)
|
||||||
|
#if defined (_dbgdump)
|
||||||
|
#undef DBG_871X_LEVEL
|
||||||
|
#if defined (__ICCARM__) || defined (__CC_ARM) || defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||||
|
#define DBG_871X_LEVEL(level, ...) \
|
||||||
|
do {\
|
||||||
|
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
#else
|
||||||
|
#define DBG_871X_LEVEL(level, fmt, arg...) \
|
||||||
|
do {\
|
||||||
|
if (level <= DEBUG_LEVEL) {\
|
||||||
|
if (level <= _drv_err_ && level > _drv_always_) {\
|
||||||
|
_dbgdump(DRIVER_PREFIX"ERROR " fmt, ##arg);\
|
||||||
|
} \
|
||||||
|
else {\
|
||||||
|
_dbgdump(DRIVER_PREFIX fmt, ##arg);\
|
||||||
|
} \
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
#endif //#ifdef __CC_ARM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG
|
||||||
|
#if defined (_dbgdump)
|
||||||
|
#undef DBG_871X
|
||||||
|
#define DBG_871X(...) do {\
|
||||||
|
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#undef MSG_8192C
|
||||||
|
#define MSG_8192C(...) do {\
|
||||||
|
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#undef DBG_8192C
|
||||||
|
#define DBG_8192C(...) do {\
|
||||||
|
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
|
||||||
|
}while(0)
|
||||||
|
#endif
|
||||||
|
#endif /* CONFIG_DEBUG */
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_RTL871X
|
||||||
|
#ifndef _RTL871X_DEBUG_C_
|
||||||
|
extern u32 GlobalDebugLevel;
|
||||||
|
extern u64 GlobalDebugComponents;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (_dbgdump) && defined (_MODULE_DEFINE_)
|
||||||
|
|
||||||
|
#undef RT_TRACE
|
||||||
|
#define RT_TRACE(_Comp, _Level, Fmt)\
|
||||||
|
do {\
|
||||||
|
if((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
|
||||||
|
_dbgdump("%s [0x%08x,%d]", DRIVER_PREFIX, (unsigned int)_Comp, _Level);\
|
||||||
|
_dbgdump Fmt;\
|
||||||
|
}\
|
||||||
|
}while(0)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (_dbgdump)
|
||||||
|
|
||||||
|
#undef _func_enter_
|
||||||
|
#define _func_enter_ \
|
||||||
|
do { \
|
||||||
|
if (GlobalDebugLevel >= _drv_debug_) \
|
||||||
|
{ \
|
||||||
|
_dbgdump("\n %s : %s enters at %d\n", DRIVER_PREFIX, __FUNCTION__, __LINE__);\
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#undef _func_exit_
|
||||||
|
#define _func_exit_ \
|
||||||
|
do { \
|
||||||
|
if (GlobalDebugLevel >= _drv_debug_) \
|
||||||
|
{ \
|
||||||
|
_dbgdump("\n %s : %s exits at %d\n", DRIVER_PREFIX, __FUNCTION__, __LINE__); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#undef RT_PRINT_DATA
|
||||||
|
#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
|
||||||
|
if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
|
||||||
|
{ \
|
||||||
|
int __i; \
|
||||||
|
u8 *ptr = (u8 *)_HexData; \
|
||||||
|
printf("\r\n%s", DRIVER_PREFIX); \
|
||||||
|
printf(_TitleString "--------Len=%d\n\r", _HexDataLen); \
|
||||||
|
for( __i=0; __i<(int)_HexDataLen; __i++ ) \
|
||||||
|
{ \
|
||||||
|
printf("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \
|
||||||
|
if (((__i + 1) % 16) == 0) printf("\n\r"); \
|
||||||
|
} \
|
||||||
|
printf("\n\r"); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* CONFIG_DEBUG_RTL871X */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_PROC_DEBUG
|
||||||
|
|
||||||
|
int proc_get_drv_version(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_write_reg(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_set_write_reg(struct file *file, const char *buffer,
|
||||||
|
unsigned long count, void *data);
|
||||||
|
|
||||||
|
int proc_get_read_reg(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_set_read_reg(struct file *file, const char *buffer,
|
||||||
|
unsigned long count, void *data);
|
||||||
|
|
||||||
|
|
||||||
|
int proc_get_fwstate(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_sec_info(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_mlmext_state(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_qos_option(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_ht_option(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_rf_info(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_ap_info(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_adapter_state(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_trx_info(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_mac_reg_dump1(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_mac_reg_dump2(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_mac_reg_dump3(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_bb_reg_dump1(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_bb_reg_dump2(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_bb_reg_dump3(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_rf_reg_dump1(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_rf_reg_dump2(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_rf_reg_dump3(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_rf_reg_dump4(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
#ifdef CONFIG_AP_MODE
|
||||||
|
|
||||||
|
int proc_get_all_sta_info(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DBG_MEMORY_LEAK
|
||||||
|
int proc_get_malloc_cnt(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_FIND_BEST_CHANNEL
|
||||||
|
int proc_get_best_channel(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int proc_get_rx_signal(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_set_rx_signal(struct file *file, const char *buffer,
|
||||||
|
unsigned long count, void *data);
|
||||||
|
#ifdef CONFIG_80211N_HT
|
||||||
|
int proc_get_cbw40_enable(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_set_cbw40_enable(struct file *file, const char *buffer,
|
||||||
|
unsigned long count, void *data);
|
||||||
|
|
||||||
|
int proc_get_ampdu_enable(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_set_ampdu_enable(struct file *file, const char *buffer,
|
||||||
|
unsigned long count, void *data);
|
||||||
|
|
||||||
|
int proc_get_rx_stbc(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_set_rx_stbc(struct file *file, const char *buffer,
|
||||||
|
unsigned long count, void *data);
|
||||||
|
#endif //CONFIG_80211N_HT
|
||||||
|
|
||||||
|
int proc_get_two_path_rssi(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_get_rssi_disp(char *page, char **start,
|
||||||
|
off_t offset, int count,
|
||||||
|
int *eof, void *data);
|
||||||
|
|
||||||
|
int proc_set_rssi_disp(struct file *file, const char *buffer,
|
||||||
|
unsigned long count, void *data);
|
||||||
|
|
||||||
|
|
||||||
|
#endif //CONFIG_PROC_DEBUG
|
||||||
|
|
||||||
|
#endif //__RTW_DEBUG_H__
|
||||||
|
|
|
@ -0,0 +1,456 @@
|
||||||
|
#ifndef _WIFI_CONSTANTS_H
|
||||||
|
#define _WIFI_CONSTANTS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WLAN0_NAME
|
||||||
|
#define WLAN0_NAME "wlan0"
|
||||||
|
#endif
|
||||||
|
#ifndef WLAN1_NAME
|
||||||
|
#define WLAN1_NAME "wlan1"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WEP_ENABLED 0x0001
|
||||||
|
#define TKIP_ENABLED 0x0002
|
||||||
|
#define AES_ENABLED 0x0004
|
||||||
|
#define WSEC_SWFLAG 0x0008
|
||||||
|
|
||||||
|
#define SHARED_ENABLED 0x00008000
|
||||||
|
#define WPA_SECURITY 0x00200000
|
||||||
|
#define WPA2_SECURITY 0x00400000
|
||||||
|
#define WPS_ENABLED 0x10000000
|
||||||
|
|
||||||
|
#define RTW_MAX_PSK_LEN (64)
|
||||||
|
#define RTW_MIN_PSK_LEN (8)
|
||||||
|
|
||||||
|
#define MCSSET_LEN 16
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
RTW_SUCCESS = 0, /**< Success */
|
||||||
|
RTW_PENDING = 1, /**< Pending */
|
||||||
|
RTW_TIMEOUT = 2, /**< Timeout */
|
||||||
|
RTW_PARTIAL_RESULTS = 3, /**< Partial results */
|
||||||
|
RTW_INVALID_KEY = 4, /**< Invalid key */
|
||||||
|
RTW_DOES_NOT_EXIST = 5, /**< Does not exist */
|
||||||
|
RTW_NOT_AUTHENTICATED = 6, /**< Not authenticated */
|
||||||
|
RTW_NOT_KEYED = 7, /**< Not keyed */
|
||||||
|
RTW_IOCTL_FAIL = 8, /**< IOCTL fail */
|
||||||
|
RTW_BUFFER_UNAVAILABLE_TEMPORARY = 9, /**< Buffer unavailable temporarily */
|
||||||
|
RTW_BUFFER_UNAVAILABLE_PERMANENT = 10, /**< Buffer unavailable permanently */
|
||||||
|
RTW_WPS_PBC_OVERLAP = 11, /**< WPS PBC overlap */
|
||||||
|
RTW_CONNECTION_LOST = 12, /**< Connection lost */
|
||||||
|
|
||||||
|
RTW_ERROR = -1, /**< Generic Error */
|
||||||
|
RTW_BADARG = -2, /**< Bad Argument */
|
||||||
|
RTW_BADOPTION = -3, /**< Bad option */
|
||||||
|
RTW_NOTUP = -4, /**< Not up */
|
||||||
|
RTW_NOTDOWN = -5, /**< Not down */
|
||||||
|
RTW_NOTAP = -6, /**< Not AP */
|
||||||
|
RTW_NOTSTA = -7, /**< Not STA */
|
||||||
|
RTW_BADKEYIDX = -8, /**< BAD Key Index */
|
||||||
|
RTW_RADIOOFF = -9, /**< Radio Off */
|
||||||
|
RTW_NOTBANDLOCKED = -10, /**< Not band locked */
|
||||||
|
RTW_NOCLK = -11, /**< No Clock */
|
||||||
|
RTW_BADRATESET = -12, /**< BAD Rate valueset */
|
||||||
|
RTW_BADBAND = -13, /**< BAD Band */
|
||||||
|
RTW_BUFTOOSHORT = -14, /**< Buffer too short */
|
||||||
|
RTW_BUFTOOLONG = -15, /**< Buffer too long */
|
||||||
|
RTW_BUSY = -16, /**< Busy */
|
||||||
|
RTW_NOTASSOCIATED = -17, /**< Not Associated */
|
||||||
|
RTW_BADSSIDLEN = -18, /**< Bad SSID len */
|
||||||
|
RTW_OUTOFRANGECHAN = -19, /**< Out of Range Channel */
|
||||||
|
RTW_BADCHAN = -20, /**< Bad Channel */
|
||||||
|
RTW_BADADDR = -21, /**< Bad Address */
|
||||||
|
RTW_NORESOURCE = -22, /**< Not Enough Resources */
|
||||||
|
RTW_UNSUPPORTED = -23, /**< Unsupported */
|
||||||
|
RTW_BADLEN = -24, /**< Bad length */
|
||||||
|
RTW_NOTREADY = -25, /**< Not Ready */
|
||||||
|
RTW_EPERM = -26, /**< Not Permitted */
|
||||||
|
RTW_NOMEM = -27, /**< No Memory */
|
||||||
|
RTW_ASSOCIATED = -28, /**< Associated */
|
||||||
|
RTW_RANGE = -29, /**< Not In Range */
|
||||||
|
RTW_NOTFOUND = -30, /**< Not Found */
|
||||||
|
RTW_WME_NOT_ENABLED = -31, /**< WME Not Enabled */
|
||||||
|
RTW_TSPEC_NOTFOUND = -32, /**< TSPEC Not Found */
|
||||||
|
RTW_ACM_NOTSUPPORTED = -33, /**< ACM Not Supported */
|
||||||
|
RTW_NOT_WME_ASSOCIATION = -34, /**< Not WME Association */
|
||||||
|
RTW_SDIO_ERROR = -35, /**< SDIO Bus Error */
|
||||||
|
RTW_WLAN_DOWN = -36, /**< WLAN Not Accessible */
|
||||||
|
RTW_BAD_VERSION = -37, /**< Incorrect version */
|
||||||
|
RTW_TXFAIL = -38, /**< TX failure */
|
||||||
|
RTW_RXFAIL = -39, /**< RX failure */
|
||||||
|
RTW_NODEVICE = -40, /**< Device not present */
|
||||||
|
RTW_UNFINISHED = -41, /**< To be finished */
|
||||||
|
RTW_NONRESIDENT = -42, /**< access to nonresident overlay */
|
||||||
|
RTW_DISABLED = -43 /**< Disabled in this build */
|
||||||
|
} rtw_result_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SECURITY_OPEN = 0, /**< Open security */
|
||||||
|
RTW_SECURITY_WEP_PSK = WEP_ENABLED, /**< WEP Security with open authentication */
|
||||||
|
RTW_SECURITY_WEP_SHARED = ( WEP_ENABLED | SHARED_ENABLED ), /**< WEP Security with shared authentication */
|
||||||
|
RTW_SECURITY_WPA_TKIP_PSK = ( WPA_SECURITY | TKIP_ENABLED ), /**< WPA Security with TKIP */
|
||||||
|
RTW_SECURITY_WPA_AES_PSK = ( WPA_SECURITY | AES_ENABLED ), /**< WPA Security with AES */
|
||||||
|
RTW_SECURITY_WPA2_AES_PSK = ( WPA2_SECURITY | AES_ENABLED ), /**< WPA2 Security with AES */
|
||||||
|
RTW_SECURITY_WPA2_TKIP_PSK = ( WPA2_SECURITY | TKIP_ENABLED ), /**< WPA2 Security with TKIP */
|
||||||
|
RTW_SECURITY_WPA2_MIXED_PSK = ( WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED ), /**< WPA2 Security with AES & TKIP */
|
||||||
|
RTW_SECURITY_WPA_WPA2_MIXED = ( WPA_SECURITY | WPA2_SECURITY ), /**< WPA/WPA2 Security */
|
||||||
|
|
||||||
|
RTW_SECURITY_WPS_OPEN = WPS_ENABLED, /**< WPS with open security */
|
||||||
|
RTW_SECURITY_WPS_SECURE = (WPS_ENABLED | AES_ENABLED), /**< WPS with AES security */
|
||||||
|
|
||||||
|
RTW_SECURITY_UNKNOWN = -1, /**< May be returned by scan function if security is unknown. Do not pass this to the join function! */
|
||||||
|
|
||||||
|
RTW_SECURITY_FORCE_32_BIT = 0x7fffffff /**< Exists only to force rtw_security_t type to 32 bits */
|
||||||
|
} rtw_security_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_ENCRYPTION_UNKNOWN = 0,
|
||||||
|
RTW_ENCRYPTION_OPEN = 1,
|
||||||
|
RTW_ENCRYPTION_WEP40 = 2,
|
||||||
|
RTW_ENCRYPTION_WPA_TKIP = 3,
|
||||||
|
RTW_ENCRYPTION_WPA_AES = 4,
|
||||||
|
RTW_ENCRYPTION_WPA2_TKIP = 5,
|
||||||
|
RTW_ENCRYPTION_WPA2_AES = 6,
|
||||||
|
RTW_ENCRYPTION_WPA2_MIXED = 7,
|
||||||
|
RTW_ENCRYPTION_WEP104 = 9,
|
||||||
|
RTW_ENCRYPTION_UNDEF = 0xFF,
|
||||||
|
} rtw_encryption_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_FALSE = 0,
|
||||||
|
RTW_TRUE = 1
|
||||||
|
} rtw_bool_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_802_11_BAND_5GHZ = 0, /**< Denotes 5GHz radio band */
|
||||||
|
RTW_802_11_BAND_2_4GHZ = 1 /**< Denotes 2.4GHz radio band */
|
||||||
|
} rtw_802_11_band_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/* CHANNEL PLAN */
|
||||||
|
RTW_COUNTRY_WORLD1, // 0x20
|
||||||
|
RTW_COUNTRY_ETSI1, // 0x21
|
||||||
|
RTW_COUNTRY_FCC1, // 0x22
|
||||||
|
RTW_COUNTRY_MKK1, // 0x23
|
||||||
|
RTW_COUNTRY_ETSI2, // 0x24
|
||||||
|
RTW_COUNTRY_FCC2, // 0x2A
|
||||||
|
RTW_COUNTRY_WORLD2, // 0x47
|
||||||
|
RTW_COUNTRY_MKK2, // 0x58
|
||||||
|
|
||||||
|
/* SPECIAL */
|
||||||
|
RTW_COUNTRY_WORLD, // WORLD1
|
||||||
|
RTW_COUNTRY_EU, // ETSI1
|
||||||
|
|
||||||
|
/* JAPANESE */
|
||||||
|
RTW_COUNTRY_JP, // MKK1
|
||||||
|
|
||||||
|
/* FCC , 19 countries*/
|
||||||
|
RTW_COUNTRY_AS, // FCC2
|
||||||
|
RTW_COUNTRY_BM,
|
||||||
|
RTW_COUNTRY_CA,
|
||||||
|
RTW_COUNTRY_DM,
|
||||||
|
RTW_COUNTRY_DO,
|
||||||
|
RTW_COUNTRY_FM,
|
||||||
|
RTW_COUNTRY_GD,
|
||||||
|
RTW_COUNTRY_GT,
|
||||||
|
RTW_COUNTRY_GU,
|
||||||
|
RTW_COUNTRY_HT,
|
||||||
|
RTW_COUNTRY_MH,
|
||||||
|
RTW_COUNTRY_MP,
|
||||||
|
RTW_COUNTRY_NI,
|
||||||
|
RTW_COUNTRY_PA,
|
||||||
|
RTW_COUNTRY_PR,
|
||||||
|
RTW_COUNTRY_PW,
|
||||||
|
RTW_COUNTRY_TW,
|
||||||
|
RTW_COUNTRY_US,
|
||||||
|
RTW_COUNTRY_VI,
|
||||||
|
|
||||||
|
/* others, ETSI */
|
||||||
|
RTW_COUNTRY_AD, // ETSI1
|
||||||
|
RTW_COUNTRY_AE,
|
||||||
|
RTW_COUNTRY_AF,
|
||||||
|
RTW_COUNTRY_AI,
|
||||||
|
RTW_COUNTRY_AL,
|
||||||
|
RTW_COUNTRY_AM,
|
||||||
|
RTW_COUNTRY_AN,
|
||||||
|
RTW_COUNTRY_AR,
|
||||||
|
RTW_COUNTRY_AT,
|
||||||
|
RTW_COUNTRY_AU,
|
||||||
|
RTW_COUNTRY_AW,
|
||||||
|
RTW_COUNTRY_AZ,
|
||||||
|
RTW_COUNTRY_BA,
|
||||||
|
RTW_COUNTRY_BB,
|
||||||
|
RTW_COUNTRY_BD,
|
||||||
|
RTW_COUNTRY_BE,
|
||||||
|
RTW_COUNTRY_BF,
|
||||||
|
RTW_COUNTRY_BG,
|
||||||
|
RTW_COUNTRY_BH,
|
||||||
|
RTW_COUNTRY_BL,
|
||||||
|
RTW_COUNTRY_BN,
|
||||||
|
RTW_COUNTRY_BO,
|
||||||
|
RTW_COUNTRY_BR,
|
||||||
|
RTW_COUNTRY_BS,
|
||||||
|
RTW_COUNTRY_BT,
|
||||||
|
RTW_COUNTRY_BY,
|
||||||
|
RTW_COUNTRY_BZ,
|
||||||
|
RTW_COUNTRY_CF,
|
||||||
|
RTW_COUNTRY_CH,
|
||||||
|
RTW_COUNTRY_CI,
|
||||||
|
RTW_COUNTRY_CL,
|
||||||
|
RTW_COUNTRY_CN,
|
||||||
|
RTW_COUNTRY_CO,
|
||||||
|
RTW_COUNTRY_CR,
|
||||||
|
RTW_COUNTRY_CX,
|
||||||
|
RTW_COUNTRY_CY,
|
||||||
|
RTW_COUNTRY_CZ,
|
||||||
|
RTW_COUNTRY_DE,
|
||||||
|
RTW_COUNTRY_DK,
|
||||||
|
RTW_COUNTRY_DZ,
|
||||||
|
RTW_COUNTRY_EC,
|
||||||
|
RTW_COUNTRY_EE,
|
||||||
|
RTW_COUNTRY_EG,
|
||||||
|
RTW_COUNTRY_ES,
|
||||||
|
RTW_COUNTRY_ET,
|
||||||
|
RTW_COUNTRY_FI,
|
||||||
|
RTW_COUNTRY_FR,
|
||||||
|
RTW_COUNTRY_GB,
|
||||||
|
RTW_COUNTRY_GE,
|
||||||
|
RTW_COUNTRY_GF,
|
||||||
|
RTW_COUNTRY_GH,
|
||||||
|
RTW_COUNTRY_GL,
|
||||||
|
RTW_COUNTRY_GP,
|
||||||
|
RTW_COUNTRY_GR,
|
||||||
|
RTW_COUNTRY_GY,
|
||||||
|
RTW_COUNTRY_HK,
|
||||||
|
RTW_COUNTRY_HN,
|
||||||
|
RTW_COUNTRY_HR,
|
||||||
|
RTW_COUNTRY_HU,
|
||||||
|
RTW_COUNTRY_ID,
|
||||||
|
RTW_COUNTRY_IE,
|
||||||
|
RTW_COUNTRY_IL,
|
||||||
|
RTW_COUNTRY_IN,
|
||||||
|
RTW_COUNTRY_IQ,
|
||||||
|
RTW_COUNTRY_IR,
|
||||||
|
RTW_COUNTRY_IS,
|
||||||
|
RTW_COUNTRY_IT,
|
||||||
|
RTW_COUNTRY_JM,
|
||||||
|
RTW_COUNTRY_JO,
|
||||||
|
RTW_COUNTRY_KE,
|
||||||
|
RTW_COUNTRY_KH,
|
||||||
|
RTW_COUNTRY_KN,
|
||||||
|
RTW_COUNTRY_KP,
|
||||||
|
RTW_COUNTRY_KR,
|
||||||
|
RTW_COUNTRY_KW,
|
||||||
|
RTW_COUNTRY_KY,
|
||||||
|
RTW_COUNTRY_KZ,
|
||||||
|
RTW_COUNTRY_LA,
|
||||||
|
RTW_COUNTRY_LB,
|
||||||
|
RTW_COUNTRY_LC,
|
||||||
|
RTW_COUNTRY_LI,
|
||||||
|
RTW_COUNTRY_LK,
|
||||||
|
RTW_COUNTRY_LR,
|
||||||
|
RTW_COUNTRY_LS,
|
||||||
|
RTW_COUNTRY_LT,
|
||||||
|
RTW_COUNTRY_LU,
|
||||||
|
RTW_COUNTRY_LV,
|
||||||
|
RTW_COUNTRY_MA,
|
||||||
|
RTW_COUNTRY_MC,
|
||||||
|
RTW_COUNTRY_MD,
|
||||||
|
RTW_COUNTRY_ME,
|
||||||
|
RTW_COUNTRY_MF,
|
||||||
|
RTW_COUNTRY_MK,
|
||||||
|
RTW_COUNTRY_MN,
|
||||||
|
RTW_COUNTRY_MO,
|
||||||
|
RTW_COUNTRY_MQ,
|
||||||
|
RTW_COUNTRY_MR,
|
||||||
|
RTW_COUNTRY_MT,
|
||||||
|
RTW_COUNTRY_MU,
|
||||||
|
RTW_COUNTRY_MV,
|
||||||
|
RTW_COUNTRY_MW,
|
||||||
|
RTW_COUNTRY_MX,
|
||||||
|
RTW_COUNTRY_MY,
|
||||||
|
RTW_COUNTRY_NG,
|
||||||
|
RTW_COUNTRY_NL,
|
||||||
|
RTW_COUNTRY_NO,
|
||||||
|
RTW_COUNTRY_NP,
|
||||||
|
RTW_COUNTRY_NZ,
|
||||||
|
RTW_COUNTRY_OM,
|
||||||
|
RTW_COUNTRY_PE,
|
||||||
|
RTW_COUNTRY_PF,
|
||||||
|
RTW_COUNTRY_PG,
|
||||||
|
RTW_COUNTRY_PH,
|
||||||
|
RTW_COUNTRY_PK,
|
||||||
|
RTW_COUNTRY_PL,
|
||||||
|
RTW_COUNTRY_PM,
|
||||||
|
RTW_COUNTRY_PT,
|
||||||
|
RTW_COUNTRY_PY,
|
||||||
|
RTW_COUNTRY_QA,
|
||||||
|
RTW_COUNTRY_RS,
|
||||||
|
RTW_COUNTRY_RU,
|
||||||
|
RTW_COUNTRY_RW,
|
||||||
|
RTW_COUNTRY_SA,
|
||||||
|
RTW_COUNTRY_SE,
|
||||||
|
RTW_COUNTRY_SG,
|
||||||
|
RTW_COUNTRY_SI,
|
||||||
|
RTW_COUNTRY_SK,
|
||||||
|
RTW_COUNTRY_SN,
|
||||||
|
RTW_COUNTRY_SR,
|
||||||
|
RTW_COUNTRY_SV,
|
||||||
|
RTW_COUNTRY_SY,
|
||||||
|
RTW_COUNTRY_TC,
|
||||||
|
RTW_COUNTRY_TD,
|
||||||
|
RTW_COUNTRY_TG,
|
||||||
|
RTW_COUNTRY_TH,
|
||||||
|
RTW_COUNTRY_TN,
|
||||||
|
RTW_COUNTRY_TR,
|
||||||
|
RTW_COUNTRY_TT,
|
||||||
|
RTW_COUNTRY_TZ,
|
||||||
|
RTW_COUNTRY_UA,
|
||||||
|
RTW_COUNTRY_UG,
|
||||||
|
RTW_COUNTRY_UY,
|
||||||
|
RTW_COUNTRY_UZ,
|
||||||
|
RTW_COUNTRY_VC,
|
||||||
|
RTW_COUNTRY_VE,
|
||||||
|
RTW_COUNTRY_VN,
|
||||||
|
RTW_COUNTRY_VU,
|
||||||
|
RTW_COUNTRY_WF,
|
||||||
|
RTW_COUNTRY_WS,
|
||||||
|
RTW_COUNTRY_YE,
|
||||||
|
RTW_COUNTRY_YT,
|
||||||
|
RTW_COUNTRY_ZA,
|
||||||
|
RTW_COUNTRY_ZW,
|
||||||
|
|
||||||
|
RTW_COUNTRY_MAX
|
||||||
|
|
||||||
|
}rtw_country_code_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_ADAPTIVITY_DISABLE = 0,
|
||||||
|
RTW_ADAPTIVITY_NORMAL, // CE
|
||||||
|
RTW_ADAPTIVITY_CARRIER_SENSE // MKK
|
||||||
|
} rtw_adaptivity_mode_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_MODE_NONE = 0,
|
||||||
|
RTW_MODE_STA,
|
||||||
|
RTW_MODE_AP,
|
||||||
|
RTW_MODE_STA_AP,
|
||||||
|
RTW_MODE_PROMISC,
|
||||||
|
RTW_MODE_P2P
|
||||||
|
}rtw_mode_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SCAN_FULL = 0,
|
||||||
|
RTW_SCAN_SOCIAL,
|
||||||
|
RTW_SCAN_ONE
|
||||||
|
}rtw_scan_mode_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_LINK_DISCONNECTED = 0,
|
||||||
|
RTW_LINK_CONNECTED
|
||||||
|
} rtw_link_status_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SCAN_TYPE_ACTIVE = 0x00, /**< Actively scan a network by sending 802.11 probe(s) */
|
||||||
|
RTW_SCAN_TYPE_PASSIVE = 0x01, /**< Passively scan a network by listening for beacons from APs */
|
||||||
|
RTW_SCAN_TYPE_PROHIBITED_CHANNELS = 0x04 /**< Passively scan on channels not enabled by the country code */
|
||||||
|
} rtw_scan_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_BSS_TYPE_INFRASTRUCTURE = 0, /**< Denotes infrastructure network */
|
||||||
|
RTW_BSS_TYPE_ADHOC = 1, /**< Denotes an 802.11 ad-hoc IBSS network */
|
||||||
|
RTW_BSS_TYPE_ANY = 2, /**< Denotes either infrastructure or ad-hoc network */
|
||||||
|
|
||||||
|
RTW_BSS_TYPE_UNKNOWN = -1 /**< May be returned by scan function if BSS type is unknown. Do not pass this to the Join function */
|
||||||
|
} rtw_bss_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_SCAN_COMMAMD = 0x01
|
||||||
|
} rtw_scan_command_t;
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
COMMAND1 = 0x01
|
||||||
|
}rtw_command_type;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_WPS_TYPE_DEFAULT = 0x0000,
|
||||||
|
RTW_WPS_TYPE_USER_SPECIFIED = 0x0001,
|
||||||
|
RTW_WPS_TYPE_MACHINE_SPECIFIED = 0x0002,
|
||||||
|
RTW_WPS_TYPE_REKEY = 0x0003,
|
||||||
|
RTW_WPS_TYPE_PUSHBUTTON = 0x0004,
|
||||||
|
RTW_WPS_TYPE_REGISTRAR_SPECIFIED = 0x0005,
|
||||||
|
RTW_WPS_TYPE_NONE = 0x0006
|
||||||
|
} rtw_wps_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_NETWORK_B = 1,
|
||||||
|
RTW_NETWORK_BG = 3,
|
||||||
|
RTW_NETWORK_BGN = 11
|
||||||
|
} rtw_network_mode_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_STA_INTERFACE = 0, /**< STA or Client Interface */
|
||||||
|
RTW_AP_INTERFACE = 1, /**< softAP Interface */
|
||||||
|
} rtw_interface_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumeration of packet filter rules
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
RTW_POSITIVE_MATCHING = 0, /**< Specifies that a filter should match a given pattern */
|
||||||
|
RTW_NEGATIVE_MATCHING = 1 /**< Specifies that a filter should NOT match a given pattern */
|
||||||
|
} rtw_packet_filter_rule_e;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_PROMISC_DISABLE = 0, /**< disable the promisc */
|
||||||
|
RTW_PROMISC_ENABLE = 1, /**< fetch all ethernet packets */
|
||||||
|
RTW_PROMISC_ENABLE_1 = 2, /**< fetch only B/M packets */
|
||||||
|
RTW_PROMISC_ENABLE_2 = 3, /**< fetch all 802.11 packets*/
|
||||||
|
RTW_PROMISC_ENABLE_3 = 4, /**< fetch only B/M 802.11 packets*/
|
||||||
|
} rtw_rcr_level_t;
|
||||||
|
|
||||||
|
typedef enum{
|
||||||
|
RTW_NO_ERROR = 0,
|
||||||
|
RTW_NONE_NETWORK = 1,
|
||||||
|
RTW_CONNECT_FAIL = 2,
|
||||||
|
RTW_WRONG_PASSWORD = 3 ,
|
||||||
|
RTW_DHCP_FAIL = 4,
|
||||||
|
RTW_UNKNOWN,
|
||||||
|
}rtw_connect_error_flag_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RTW_TX_PWR_PERCENTAGE_100 = 0, /* 100%, default target output power. */
|
||||||
|
RTW_TX_PWR_PERCENTAGE_75 = 1, /* 75% */
|
||||||
|
RTW_TX_PWR_PERCENTAGE_50 = 2, /* 50% */
|
||||||
|
RTW_TX_PWR_PERCENTAGE_25 = 3, /* 25% */
|
||||||
|
RTW_TX_PWR_PERCENTAGE_12_5 = 4, /* 12.5% */
|
||||||
|
}rtw_tx_pwr_percentage_t;
|
||||||
|
|
||||||
|
typedef enum _WIFI_EVENT_INDICATE{
|
||||||
|
WIFI_EVENT_CONNECT = 0,
|
||||||
|
WIFI_EVENT_DISCONNECT = 1,
|
||||||
|
WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
|
||||||
|
WIFI_EVENT_SCAN_RESULT_REPORT = 3,
|
||||||
|
WIFI_EVENT_SCAN_DONE = 4,
|
||||||
|
WIFI_EVENT_RECONNECTION_FAIL = 5,
|
||||||
|
WIFI_EVENT_SEND_ACTION_DONE = 6,
|
||||||
|
WIFI_EVENT_RX_MGNT = 7,
|
||||||
|
WIFI_EVENT_STA_ASSOC = 8,
|
||||||
|
WIFI_EVENT_STA_DISASSOC = 9,
|
||||||
|
WIFI_EVENT_STA_WPS_START = 10,
|
||||||
|
WIFI_EVENT_WPS_FINISH = 11,
|
||||||
|
WIFI_EVENT_EAPOL_START = 12,
|
||||||
|
WIFI_EVENT_EAPOL_RECVD = 13,
|
||||||
|
WIFI_EVENT_NO_NETWORK = 14,
|
||||||
|
WIFI_EVENT_BEACON_AFTER_DHCP = 15,
|
||||||
|
WIFI_EVENT_MAX,
|
||||||
|
}WIFI_EVENT_INDICATE;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* _WIFI_CONSTANTS_H */
|
|
@ -0,0 +1,167 @@
|
||||||
|
#ifndef _WIFI_STRUCTURES_H
|
||||||
|
#define _WIFI_STRUCTURES_H
|
||||||
|
|
||||||
|
//#include <freertos/freertos_service.h>
|
||||||
|
#include "wifi_constants.h"
|
||||||
|
#include "dlist.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_ssid {
|
||||||
|
unsigned char len; /**< SSID length */
|
||||||
|
unsigned char val[33]; /**< SSID name (AP name) */
|
||||||
|
} rtw_ssid_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_mac {
|
||||||
|
unsigned char octet[6]; /**< Unique 6-byte MAC address */
|
||||||
|
} rtw_mac_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct rtw_ap_info {
|
||||||
|
rtw_ssid_t ssid;
|
||||||
|
rtw_security_t security_type;
|
||||||
|
unsigned char *password;
|
||||||
|
int password_len;
|
||||||
|
int channel;
|
||||||
|
}rtw_ap_info_t;
|
||||||
|
|
||||||
|
typedef struct rtw_network_info {
|
||||||
|
rtw_ssid_t ssid;
|
||||||
|
rtw_mac_t bssid;
|
||||||
|
rtw_security_t security_type;
|
||||||
|
unsigned char *password;
|
||||||
|
int password_len;
|
||||||
|
int key_id;
|
||||||
|
}rtw_network_info_t;
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_scan_result {
|
||||||
|
rtw_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */
|
||||||
|
rtw_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */
|
||||||
|
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
|
||||||
|
rtw_bss_type_t bss_type; /**< Network type */
|
||||||
|
rtw_security_t security; /**< Security type */
|
||||||
|
rtw_wps_type_t wps_type; /**< WPS type */
|
||||||
|
unsigned int channel; /**< Radio channel that the AP beacon was received on */
|
||||||
|
rtw_802_11_band_t band; /**< Radio band */
|
||||||
|
} rtw_scan_result_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct rtw_scan_handler_result {
|
||||||
|
rtw_scan_result_t ap_details;
|
||||||
|
rtw_bool_t scan_complete;
|
||||||
|
void* user_data;
|
||||||
|
|
||||||
|
} rtw_scan_handler_result_t;
|
||||||
|
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
typedef struct rtw_wifi_setting {
|
||||||
|
rtw_mode_t mode;
|
||||||
|
unsigned char ssid[33];
|
||||||
|
unsigned char channel;
|
||||||
|
rtw_security_t security_type;
|
||||||
|
unsigned char password[65];
|
||||||
|
unsigned char key_idx;
|
||||||
|
}rtw_wifi_setting_t;
|
||||||
|
#if defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct rtw_wifi_config {
|
||||||
|
unsigned int boot_mode;
|
||||||
|
unsigned char ssid[32];
|
||||||
|
unsigned char ssid_len;
|
||||||
|
unsigned char security_type;
|
||||||
|
unsigned char password[65];
|
||||||
|
unsigned char password_len;
|
||||||
|
unsigned char channel;
|
||||||
|
} rtw_wifi_config_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned int count; /**< Number of MAC addresses in the list */
|
||||||
|
rtw_mac_t mac_list[1]; /**< Variable length array of MAC addresses */
|
||||||
|
} rtw_maclist_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int version; /* version field */
|
||||||
|
unsigned int length; /* byte length of data in this record, */
|
||||||
|
/* starting at version and including IEs */
|
||||||
|
rtw_mac_t BSSID;
|
||||||
|
unsigned short beacon_period; /* units are Kusec */
|
||||||
|
unsigned short capability; /* Capability information */
|
||||||
|
unsigned char SSID_len;
|
||||||
|
unsigned char SSID[32];
|
||||||
|
unsigned char channel;
|
||||||
|
// struct {
|
||||||
|
// uint32_t count; /* # rates in this set */
|
||||||
|
// uint8_t rates[16]; /* rates in 500kbps units w/hi bit set if basic */
|
||||||
|
// } rateset; /* supported rates */
|
||||||
|
// rtw_chanspec_t chanspec; /* chanspec for bss */
|
||||||
|
unsigned short atim_window; /* units are Kusec */
|
||||||
|
unsigned char dtim_period; /* DTIM period */
|
||||||
|
signed short RSSI; /* receive signal strength (in dBm) */
|
||||||
|
|
||||||
|
unsigned char n_cap; /* BSS is 802.11N Capable */
|
||||||
|
unsigned int nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
|
||||||
|
unsigned char basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
|
||||||
|
|
||||||
|
unsigned short ie_offset; /* offset at which IEs start, from beginning */
|
||||||
|
unsigned int ie_length; /* byte length of Information Elements */
|
||||||
|
} rtw_bss_info_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned short offset; /**< Offset in bytes to start filtering (referenced to the start of the ethernet packet) */
|
||||||
|
unsigned short mask_size; /**< Size of the mask in bytes */
|
||||||
|
unsigned char* mask; /**< Pattern mask bytes to be ANDed with the pattern eg. "\xff00" (must be in network byte order) */
|
||||||
|
unsigned char* pattern; /**< Pattern bytes used to filter eg. "\x0800" (must be in network byte order) */
|
||||||
|
} rtw_packet_filter_pattern_t;
|
||||||
|
|
||||||
|
typedef struct ieee80211_frame_info{
|
||||||
|
unsigned short i_fc;
|
||||||
|
unsigned short i_dur;
|
||||||
|
unsigned char i_addr1[6];
|
||||||
|
unsigned char i_addr2[6];
|
||||||
|
unsigned char i_addr3[6];
|
||||||
|
unsigned short i_seq;
|
||||||
|
unsigned char bssid[6];
|
||||||
|
unsigned char encrypt;
|
||||||
|
signed char rssi;
|
||||||
|
}ieee80211_frame_info_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char filter_id;
|
||||||
|
rtw_packet_filter_pattern_t patt;
|
||||||
|
rtw_packet_filter_rule_e rule;
|
||||||
|
unsigned char enable;
|
||||||
|
}rtw_packet_filter_info_t;
|
||||||
|
|
||||||
|
typedef struct rtw_mac_filter_list{
|
||||||
|
struct list_head node;
|
||||||
|
unsigned char mac_addr[6];
|
||||||
|
}rtw_mac_filter_list_t;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _WIFI_STRUCTURES_H */
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,32 @@
|
||||||
|
#include <section_config.h>
|
||||||
|
#include <osdep_service.h>
|
||||||
|
#include <skbuff.h>
|
||||||
|
|
||||||
|
#define MAX_SKB_BUF_SIZE 1650 // should >= the size in wlan driver
|
||||||
|
#define MAX_SKB_BUF_NUM 8
|
||||||
|
#define MAX_LOCAL_SKB_NUM (MAX_SKB_BUF_NUM + 2)
|
||||||
|
|
||||||
|
/* DO NOT modify skb_buf and skb_data structure */
|
||||||
|
struct skb_buf {
|
||||||
|
struct list_head list;
|
||||||
|
struct sk_buff skb;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct skb_data {
|
||||||
|
struct list_head list;
|
||||||
|
unsigned char buf[MAX_SKB_BUF_SIZE];
|
||||||
|
atomic_t ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int nr_xmitframe = MAX_SKB_BUF_NUM;
|
||||||
|
unsigned int nr_xmitbuff = MAX_SKB_BUF_NUM;
|
||||||
|
int max_local_skb_num = MAX_LOCAL_SKB_NUM;
|
||||||
|
int max_skb_buf_num = MAX_SKB_BUF_NUM;
|
||||||
|
|
||||||
|
/* DO NOT access skb_pool and skb_data_pool out of wlan driver */
|
||||||
|
struct skb_buf skb_pool[MAX_LOCAL_SKB_NUM];
|
||||||
|
|
||||||
|
// SRAM_BD_DATA_SECTION default in SRAM. Can modify image2.icf to link to the end of SDRAM
|
||||||
|
SRAM_BD_DATA_SECTION
|
||||||
|
struct skb_data skb_data_pool[MAX_SKB_BUF_NUM];
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue