diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.cproject b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.cproject new file mode 100644 index 0000000000..c41e8ee746 --- /dev/null +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.cproject @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.project b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.project new file mode 100644 index 0000000000..b2d4cf5ac4 --- /dev/null +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.project @@ -0,0 +1,82 @@ + + + eventOS + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/event_loop/Debug} + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.settings/org.eclipse.cdt.codan.core.prefs b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.settings/org.eclipse.cdt.codan.core.prefs new file mode 100644 index 0000000000..77386c23cb --- /dev/null +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.settings/org.eclipse.cdt.codan.core.prefs @@ -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}} diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.settings/org.eclipse.cdt.core.prefs b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 0000000000..2eaccaf10b --- /dev/null +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,65 @@ +eclipse.preferences.version=1 +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/CC/delimiter=; +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/CC/operation=append +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/CC/value=gcc +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/V/delimiter=; +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/V/operation=append +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/V/value=1 +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/append=true +environment/project/0.2056004298.141662914.1517984773.801758434.1788862897/appendContributed=true +environment/project/0.2056004298.141662914.2121498000.642060230/CPU/delimiter=; +environment/project/0.2056004298.141662914.2121498000.642060230/CPU/operation=replace +environment/project/0.2056004298.141662914.2121498000.642060230/CPU/value=Cortex-M0 +environment/project/0.2056004298.141662914.2121498000.642060230/DEBUG/delimiter=; +environment/project/0.2056004298.141662914.2121498000.642060230/DEBUG/operation=replace +environment/project/0.2056004298.141662914.2121498000.642060230/DEBUG/value=1 +environment/project/0.2056004298.141662914.2121498000.642060230/PLATFORM/delimiter=; +environment/project/0.2056004298.141662914.2121498000.642060230/PLATFORM/operation=append +environment/project/0.2056004298.141662914.2121498000.642060230/PLATFORM/value=arm-unknown-linux-uclibcgnueabi- +environment/project/0.2056004298.141662914.2121498000.642060230/V/delimiter=; +environment/project/0.2056004298.141662914.2121498000.642060230/V/operation=append +environment/project/0.2056004298.141662914.2121498000.642060230/V/value=1 +environment/project/0.2056004298.141662914.2121498000.642060230/append=true +environment/project/0.2056004298.141662914.2121498000.642060230/appendContributed=true +environment/project/0.2056004298.141662914.2121498000/CPU/delimiter=; +environment/project/0.2056004298.141662914.2121498000/CPU/operation=append +environment/project/0.2056004298.141662914.2121498000/CPU/value=Cortex-M3 +environment/project/0.2056004298.141662914.2121498000/PLATFORM/delimiter=; +environment/project/0.2056004298.141662914.2121498000/PLATFORM/operation=append +environment/project/0.2056004298.141662914.2121498000/PLATFORM/value=arm-unknown-linux-uclibcgnueabi- +environment/project/0.2056004298.141662914.2121498000/V/delimiter=; +environment/project/0.2056004298.141662914.2121498000/V/operation=append +environment/project/0.2056004298.141662914.2121498000/V/value=1 +environment/project/0.2056004298.141662914.2121498000/append=true +environment/project/0.2056004298.141662914.2121498000/appendContributed=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CC/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CC/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CC/value=armcc +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CONFIG/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CONFIG/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CONFIG/value=generic +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CPU/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CPU/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/CPU/value=Cortex-M0 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/DEBUG/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/DEBUG/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/DEBUG/value=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/V/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/V/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/V/value=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/append=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176.535362087/appendContributed=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/CC/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/CC/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/CC/value=armcc +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/CPU/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/CPU/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/CPU/value=Cortex-M3 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/DEBUG/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/DEBUG/operation=replace +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/DEBUG/value=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/V/delimiter=; +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/V/operation=append +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/V/value=1 +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/append=true +environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1189539176/appendContributed=true diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/CHANGELOG.md b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/CHANGELOG.md deleted file mode 100644 index db54052a9e..0000000000 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/CHANGELOG.md +++ /dev/null @@ -1,32 +0,0 @@ -# Change Log - -## [mbed-os.5.2-rc1](https://github.com/ARMmbed/sal-stack-nanostack-eventloop/releases/tag/mbed-os.5.2-rc1) (24-Sep-2016) -[Full Changelog](https://github.com/ARMmbed/sal-stack-nanostack-eventloop/compare/mbed-os-5.0-rc1...mbed-os.5.2-rc1) - -**New features** - -- Move configuration parameter resolution to separate header and allow user definable configuration header to be used. -- Port eventloop system timer to use new tick timer functions platform_tick_timer_register, platform_tick_timer_start and platform_tick_timer_stop. - -**Merged pull requests:** - -commit 283299dbd744c91cb30810ad263798842905c054 (HEAD, tag: mbed-os.5.2-rc1, origin/master, origin/HEAD, master) -Author: Jaakko Kukkohovi -Date: Fri Sep 23 10:05:55 2016 +0300 - - Change configuration method (#23) - - Move configuration parameter resolution to separate header and allow - user definable configuration header to be used. - -commit 269b00fba6a637c363f7d1690db0889118bca010 -Author: Jaakko Kukkohovi -Date: Wed Sep 21 11:27:40 2016 +0300 - - Systimer using platform tick timer (#22) - - * Port eventloop system timer to use new tick timer functions platform_tick_timer_register, platform_tick_timer_start and platform_tick_timer_stop.Existing functionality is preserved by implementing these functions by default using the high resolution timer as before - * New configuration parameter use_platform_tick_timer disables the high resolution timer based tick timer implementation and allows platform to implement the tick timer functions. - * New configuration parameter exclude_highres_timer removes the high resolution timer from the build thus providing only eventloop. - * Minar support now implemented by providing platform tick timer using minar timers and implicitly using platform tick timers for eventloop when using minar - diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/Makefile b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/Makefile new file mode 100644 index 0000000000..ee2a9020b4 --- /dev/null +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/Makefile @@ -0,0 +1,34 @@ +# Define compiler toolchain with CC or PLATFORM variables +# Example (GCC toolchains) +# make PLATFORM=arm-linux-gnueabi- +# OR +# make CC=armcc AR=ArmAR +# OR +# make CC=iccarm + +LIB = libeventOS.a +SRCS += \ + source/event.c \ + source/ns_timer.c \ + source/system_timer.c\ + source/ns_timeout.c + +include ../libService/toolchain_rules.mk + +override CFLAGS += -I nanostack-event-loop + +# +# External sources from libService +# +SERVLIB_DIR := ../libService +override CFLAGS += -I$(SERVLIB_DIR)/libService + +$(eval $(call generate_rules,$(LIB),$(SRCS))) + +.PHONY: release +release: + 7z a edtls-lib_$(VERSION).zip *.a *.lib include + +.PHONY: deploy_to +deploy_to: all + tar --transform 's,^,event-loop/,' --append -f $(TO) *.a diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event.h b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event.h index 0345e10a1b..fdade47838 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event.h +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event.h @@ -20,6 +20,8 @@ extern "C" { #endif #include "ns_types.h" +#include "ns_list.h" + /** * \enum arm_library_event_priority_e * \brief Event Priority level. @@ -31,7 +33,7 @@ typedef enum arm_library_event_priority_e { } arm_library_event_priority_e; /** - * \enum arm_event_s + * \struct arm_event_s * \brief Event structure. */ typedef struct arm_event_s { @@ -42,18 +44,90 @@ typedef struct arm_event_s { void *data_ptr; /**< Application could share data pointer tasklet to tasklet */ arm_library_event_priority_e priority; uint32_t event_data; -} arm_event_s; +} arm_event_t; + +/* Backwards compatibility */ +typedef arm_event_t arm_event_s; /** - * \brief Send event to event scheduler. + * \struct arm_event_storage + * \brief Event structure storage, including list link. + +@startuml + +partition "Event loop" { +(*) -->[event created] "UNQUEUED" +"UNQUEUED" -->[event_core_write()] "QUEUED" +"QUEUED" -->[event_core_read()] "RUNNING" +"RUNNING" ->[event_core_free_push()] "UNQUEUED" +} + +partition "system_timer.c" { + "UNQUEUED:timer" -->[eventOS_event_send_timer_allocated()] "QUEUED" +} +@enduml + + */ +typedef struct arm_event_storage { + arm_event_s data; + enum { + ARM_LIB_EVENT_STARTUP_POOL, + ARM_LIB_EVENT_DYNAMIC, + ARM_LIB_EVENT_USER, + ARM_LIB_EVENT_TIMER, + } allocator; + enum { + ARM_LIB_EVENT_UNQUEUED, + ARM_LIB_EVENT_QUEUED, + ARM_LIB_EVENT_RUNNING, + } state; + ns_list_link_t link; +} arm_event_storage_t; + +/** + * \brief Send event to event scheduler. * * \param event pointer to pushed event. * + * Event data is copied by the call, and this copy persists until the + * recipient's callback function returns. The callback function is passed + * a pointer to a copy of the data, not the original pointer. + * * \return 0 Event push OK * \return -1 Memory allocation Fail - * */ -extern int8_t eventOS_event_send(arm_event_s *event); +extern int8_t eventOS_event_send(const arm_event_t *event); + +/* Alternate names for timer function from eventOS_event_timer.h; + * implementations may one day merge */ +#define eventOS_event_send_at(event, at) eventOS_event_timer_request_at(event, at) +#define eventOS_event_send_in(event, in) eventOS_event_timer_request_in(event, in) +#define eventOS_event_send_after(event, after) eventOS_event_timer_request_after(event, after) +#define eventOS_event_send_every(event, every) eventOS_event_timer_request_every(event, every) + +/** + * \brief Send user-allocated event to event scheduler. + * + * \param event pointer to pushed event storage. + * + * The event structure is not copied by the call, the event system takes + * ownership and it is threaded directly into the event queue. This avoids the + * possibility of event sending failing due to memory exhaustion. + * + * event->data must be filled in on entry - the rest of the structure (link and + * allocator) need not be. + * + * The structure must remain valid until the recipient is called - the + * event system passes ownership to the receiving event handler, who may then + * invalidate it, or send it again. + * + * The recipient receives a pointer to the arm_event_t data member of the + * event - it can use NS_CONTAINER_OF() to get a pointer to the original + * event passed to this call, or to its outer container. + * + * It is a program error to send a user-allocated event to a non-existent task. + */ +extern void eventOS_event_send_user_allocated(arm_event_storage_t *event); /** * \brief Event handler callback register @@ -61,13 +135,34 @@ extern int8_t eventOS_event_send(arm_event_s *event); * Function will register and allocate unique event id handler * * \param handler_func_ptr function pointer for event handler - * \param init_event_type generated evevnt type for init purpose + * \param init_event_type generated event type for init purpose * * \return >= 0 Unique event ID for this handler * \return < 0 Register fail * * */ -extern int8_t eventOS_event_handler_create(void (*handler_func_ptr)(arm_event_s *), uint8_t init_event_type); +extern int8_t eventOS_event_handler_create(void (*handler_func_ptr)(arm_event_t *), uint8_t init_event_type); + +/** + * Cancel an event. + * + * Queued events are removed from the event-loop queue and/or the timer queue. + * + * Passing a NULL pointer is allowed, and does nothing. + * + * Event pointers are valid from the time they are queued until the event + * has finished running or is cancelled. + * + * Cancelling a currently-running event is only useful to stop scheduling + * it if it is on a periodic timer; it has no other effect. + * + * Cancelling an already-cancelled or already-run single-shot event + * is undefined behaviour. + * + * \param event Pointer to event handle or NULL. + */ +extern void eventOS_cancel(arm_event_storage_t *event); + #ifdef __cplusplus } #endif diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event_timer.h b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event_timer.h index 1c96c5ad83..dec8efd9fb 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event_timer.h +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/eventOS_event_timer.h @@ -19,26 +19,191 @@ extern "C" { #endif #include "ns_types.h" +#include "eventOS_event.h" + +struct arm_event_s; +typedef struct sys_timer_struct_s sys_timer_struct_t; + +/* 100 Hz ticker, so 10 milliseconds per tick */ +#define EVENTOS_EVENT_TIMER_HZ 100 + +static inline uint32_t eventOS_event_timer_ticks_to_ms(uint32_t ticks) +{ + NS_STATIC_ASSERT(1000 % EVENTOS_EVENT_TIMER_HZ == 0, "Assuming whole number of ms per tick") + return ticks * (1000 / EVENTOS_EVENT_TIMER_HZ); +} + +/* Convert ms to ticks, rounding up (so 9ms = 1 tick, 10ms = 1 tick, 11ms = 2 ticks) */ +static inline uint32_t eventOS_event_timer_ms_to_ticks(uint32_t ms) +{ + NS_STATIC_ASSERT(1000 % EVENTOS_EVENT_TIMER_HZ == 0, "Assuming whole number of ms per tick") + return (ms + (1000 / EVENTOS_EVENT_TIMER_HZ) - 1) / (1000 / EVENTOS_EVENT_TIMER_HZ); +} + +/** + * Read current timer tick count. + * + * Can be used as a monotonic time source, and to schedule events with + * eventOS_event_timer_send. + * + * Note that the value will wrap, so take care on comparisons. + * + * \return tick count. + */ +extern uint32_t eventOS_event_timer_ticks(void); + +/* Comparison macros handling wrap efficiently (assuming a conventional compiler + * which converts 0x80000000 to 0xFFFFFFFF to negative when casting to int32_t). + */ +#define TICKS_AFTER(a, b) ((int32_t) ((a)-(b)) > 0) +#define TICKS_BEFORE(a, b) ((int32_t) ((a)-(b)) < 0) +#define TICKS_AFTER_OR_AT(a, b) ((int32_t) ((a)-(b)) >= 0) +#define TICKS_BEFORE_OR_AT(a, b) ((int32_t) ((a)-(b)) <= 0) /** * Send an event after time expired (in milliseconds) * - * \param snmessage event to send + * Note that the current implementation has the "feature" that rounding + * varies depending on the precise timing requested: + * 0-20 ms => 2 x 10ms tick + * 21-29 ms => 3 x 10ms tick + * 30-39 ms => 4 x 10ms tick + * 40-49 ms => 5 x 10ms tick + * ... etc + * + * For improved flexibility on the event, and for more control of time, + * you should use eventOS_event_timer_request_at(). + * + * \param event_id event_id for event + * \param event_type event_type for event + * \param tasklet_id receiver for event * \param time time to sleep in milliseconds * - * \return none + * \return 0 on success + * \return -1 on error (invalid tasklet_id or allocation failure) * * */ -extern int8_t eventOS_event_timer_request(uint8_t snmessage, uint8_t event_type, int8_t tasklet_id, uint32_t time); +extern int8_t eventOS_event_timer_request(uint8_t event_id, uint8_t event_type, int8_t tasklet_id, uint32_t time); + /** - * Cancel an event + * Send an event at specified time * - * \param event event to cancel + * The event will be sent when eventOS_event_timer_ticks() reaches the + * specified value. * - * \return none + * If the specified time is in the past (ie "at" is before or at the current + * tick value), the event will be sent immediately. + * + * Can also be invoked using the eventOS_event_send_at() macro in eventOS_event.h + * + * \param event event to send + * \param at absolute tick time to run event at + * + * \return pointer to timer structure on success + * \return NULL on error (invalid tasklet_id or allocation failure) + * + */ +extern arm_event_storage_t *eventOS_event_timer_request_at(const struct arm_event_s *event, uint32_t at); + +/** + * Send an event in a specified time + * + * The event will be sent in the specified number of ticks - to + * be precise, it is equivalent to requesting an event at + * + * eventOS_event_timer_ticks() + ticks + * + * Because of timer granularity, the elapsed time between issuing the request + * and it running may be up to 1 tick less than the specified time. + * + * eg requesting 2 ticks will cause the event to be sent on the second tick from + * now. If requested just after a tick, the delay will be nearly 2 ticks, but if + * requested just before a tick, the delay will be just over 1 tick. + * + * If `in` is <= 0, the event will be sent immediately. + * + * Can also be invoked using the eventOS_event_send_in() macro in eventOS_event.h + * + * \param event event to send + * \param in tick delay for event + * + * \return pointer to timer structure on success + * \return NULL on error (invalid tasklet_id or allocation failure) + * + */ +extern arm_event_storage_t *eventOS_event_timer_request_in(const struct arm_event_s *event, int32_t in); + +/** + * Send an event after a specified time + * + * The event will be sent after the specified number of ticks - to + * be precise, it is equivalent to requesting an event at + * + * eventOS_event_timer_ticks() + ticks + 1 + * + * Because of timer granularity, the elapsed time between issuing the request + * and it running may be up to 1 tick more than the specified time. + * + * eg requesting 2 ticks will cause the event to be sent on the third tick from + * now. If requested just after a tick, the delay will be nearly 3 ticks, but if + * requested just before a tick, the delay will be just over 2 ticks. + * + * If `after` is < 0, the event will be sent immediately. If it is 0, the event + * is sent on the next tick. + * + * Can also be invoked using the eventOS_event_send_after() macro in eventOS_event.h + * + * \param event event to send + * \param after tick delay for event + * + * \return pointer to timer structure on success + * \return NULL on error (invalid tasklet_id or allocation failure) + * + */ +#define eventOS_event_timer_request_after(event, after) \ + eventOS_event_timer_request_in(event, (after) + 1) + +/** + * Send an event periodically + * + * The event will be sent repeatedly using the specified ticks period. + * + * The first call is sent at + * + * eventOS_event_timer_ticks() + ticks + * + * Subsequent events will be sent at N*ticks from the initial time. + * + * Period will be maintained while the device is awake, regardless of delays to + * event scheduling. If an event has not been delivered and completed by the + * next scheduled time, the next event will be sent immediately when it + * finishes. This could cause a continuous stream of events if unable to keep + * up with the period. + * + * Can also be invoked using the eventOS_event_send_every() macro in eventOS_event.h + * + * \param event event to send + * \param period period for event + * + * \return pointer to timer structure on success + * \return NULL on error (invalid tasklet_id or allocation failure) + * + */ +extern arm_event_storage_t *eventOS_event_timer_request_every(const struct arm_event_s *event, int32_t period); + +/** + * Cancel an event timer + * + * This cancels a pending timed event, matched by event_id and tasklet_id. + * + * \param event_id event_id for event + * \param tasklet_id receiver for event + * + * \return 0 on success + * \return -1 on error (event not found) * * */ -extern int8_t eventOS_event_timer_cancel(uint8_t snmessage, int8_t tasklet_id); +extern int8_t eventOS_event_timer_cancel(uint8_t event_id, int8_t tasklet_id); /** * System Timer shortest time in milli seconds @@ -56,8 +221,8 @@ typedef struct timeout_entry_t timeout_t; /** Request timeout callback. * - * Create timeout request for specific callback. Maximum 255 timeouts can be requested. - * Not thread safe. Should not be called from interrupt context. + * Create timeout request for specific callback. + * * \param ms timeout in milliseconds. Maximum range is same as for eventOS_event_timer_request(). * \param callback function to call after timeout * \param arg arquement to pass to callback @@ -65,8 +230,19 @@ typedef struct timeout_entry_t timeout_t; */ timeout_t *eventOS_timeout_ms(void (*callback)(void *), uint32_t ms, void *arg); +/** Request periodic callback. + * + * Create timeout request for specific callback. Called periodically until eventOS_timeout_cancel() is called. + * + * \param every period in milliseconds. Maximum range is same as for eventOS_event_timer_request(). + * \param callback function to call after timeout + * \param arg arquement to pass to callback + * \return pointer to timeout structure or NULL on errors + */ +timeout_t *eventOS_timeout_every_ms(void (*callback)(void *), uint32_t every, void *arg); + /** Cancell timeout request. - * Not thread safe. Should not be called from interrupt context. + * * \param t timeout request id. */ void eventOS_timeout_cancel(timeout_t *t); diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/arm_hal_timer.h b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/arm_hal_timer.h index b29e25125a..0a661abfa0 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/arm_hal_timer.h +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/arm_hal_timer.h @@ -21,6 +21,8 @@ #ifdef __cplusplus extern "C" { #endif + +#ifndef NS_EXCLUDE_HIGHRES_TIMER /** * \brief This function perform timer init. */ @@ -56,6 +58,8 @@ extern void platform_timer_disable(void); */ extern uint16_t platform_timer_get_remaining_slots(void); +#endif // NS_EXCLUDE_HIGHRES_TIMER + #ifdef NS_EVENTLOOP_USE_TICK_TIMER /** * \brief This function is API for registering low resolution tick timer callback. Also does diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/eventloop_config.h b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/eventloop_config.h index 158c6ee5aa..904eb24242 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/eventloop_config.h +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/nanostack-event-loop/platform/eventloop_config.h @@ -17,9 +17,15 @@ #define EVENTLOOP_CONFIG_H_ /* - * Undefine all internal flags before evaluating the configuration + * Options can be picked up from mbed-cli JSON configuration, or from + * Yotta JSON configuration, or from a user configuration file - see below. + * + * Undefine all internal flags before evaluating the configuration. */ + +/* Use platform-provided low-resolution tick timer for eventloop (requires "platform_tick_timer" API) */ #undef NS_EVENTLOOP_USE_TICK_TIMER +/* Exclude high resolution timer from build (removes need for "platform_timer" API) */ #undef NS_EXCLUDE_HIGHRES_TIMER /* diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/event.c b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/event.c index 5ef5a3a72e..77dec693c9 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/event.c +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/event.c @@ -21,37 +21,36 @@ #include "timer_sys.h" #include "nsdynmemLIB.h" #include "ns_timer.h" - +#include "event.h" #include "platform/arm_hal_interrupt.h" -typedef struct arm_core_tasklet_list_s { +typedef struct arm_core_tasklet { int8_t id; /**< Event handler Tasklet ID */ void (*func_ptr)(arm_event_s *); ns_list_link_t link; -} arm_core_tasklet_list_s; +} arm_core_tasklet_t; -typedef struct arm_core_event_s { - arm_event_s data; - ns_list_link_t link; -} arm_core_event_s; +static NS_LIST_DEFINE(arm_core_tasklet_list, arm_core_tasklet_t, link); +static NS_LIST_DEFINE(event_queue_active, arm_event_storage_t, link); +static NS_LIST_DEFINE(free_event_entry, arm_event_storage_t, link); -static NS_LIST_DEFINE(arm_core_tasklet_list, arm_core_tasklet_list_s, link); -static NS_LIST_DEFINE(event_queue_active, arm_core_event_s, link); -static NS_LIST_DEFINE(free_event_entry, arm_core_event_s, link); +// Statically allocate initial pool of events. +#define STARTUP_EVENT_POOL_SIZE 10 +static arm_event_storage_t startup_event_pool[STARTUP_EVENT_POOL_SIZE]; /** Curr_tasklet tell to core and platform which task_let is active, Core Update this automatic when switch Tasklet. */ int8_t curr_tasklet = 0; -static arm_core_tasklet_list_s *tasklet_dynamically_allocate(void); -static arm_core_event_s *event_dynamically_allocate(void); -static arm_core_event_s *event_core_get(void); -static void event_core_write(arm_core_event_s *event); +static arm_core_tasklet_t *tasklet_dynamically_allocate(void); +static arm_event_storage_t *event_dynamically_allocate(void); +static arm_event_storage_t *event_core_get(void); +static void event_core_write(arm_event_storage_t *event); -static arm_core_tasklet_list_s *event_tasklet_handler_get(uint8_t tasklet_id) +static arm_core_tasklet_t *event_tasklet_handler_get(uint8_t tasklet_id) { - ns_list_foreach(arm_core_tasklet_list_s, cur, &arm_core_tasklet_list) { + ns_list_foreach(arm_core_tasklet_t, cur, &arm_core_tasklet_list) { if (cur->id == tasklet_id) { return cur; } @@ -59,6 +58,11 @@ static arm_core_tasklet_list_s *event_tasklet_handler_get(uint8_t tasklet_id) return NULL; } +bool event_tasklet_handler_id_valid(uint8_t tasklet_id) +{ + return event_tasklet_handler_get(tasklet_id); +} + // XXX this can return 0, but 0 seems to mean "none" elsewhere? Or at least // curr_tasklet is reset to 0 in various places. static int8_t tasklet_get_free_id(void) @@ -75,17 +79,17 @@ static int8_t tasklet_get_free_id(void) int8_t eventOS_event_handler_create(void (*handler_func_ptr)(arm_event_s *), uint8_t init_event_type) { - arm_core_event_s *event_tmp; + arm_event_storage_t *event_tmp; // XXX Do we really want to prevent multiple tasklets with same function? - ns_list_foreach(arm_core_tasklet_list_s, cur, &arm_core_tasklet_list) { + ns_list_foreach(arm_core_tasklet_t, cur, &arm_core_tasklet_list) { if (cur->func_ptr == handler_func_ptr) { return -1; } } //Allocate new - arm_core_tasklet_list_s *new = tasklet_dynamically_allocate(); + arm_core_tasklet_t *new = tasklet_dynamically_allocate(); if (!new) { return -2; } @@ -111,44 +115,53 @@ int8_t eventOS_event_handler_create(void (*handler_func_ptr)(arm_event_s *), uin return new->id; } -/** -* \brief Send event to event scheduler. -* -* \param event pointer to pushed event. -* -* \return 0 Event push OK -* \return -1 Memory allocation Fail -* -*/ -int8_t eventOS_event_send(arm_event_s *event) +int8_t eventOS_event_send(const arm_event_t *event) { - int8_t retval = -1; if (event_tasklet_handler_get(event->receiver)) { - arm_core_event_s *event_tmp = event_core_get(); + arm_event_storage_t *event_tmp = event_core_get(); if (event_tmp) { event_tmp->data = *event; event_core_write(event_tmp); - retval = 0; + return 0; } } - return retval; + return -1; } - -static arm_core_event_s *event_dynamically_allocate(void) +void eventOS_event_send_user_allocated(arm_event_storage_t *event) { - return ns_dyn_mem_alloc(sizeof(arm_core_event_s)); + event->allocator = ARM_LIB_EVENT_USER; + event_core_write(event); } -static arm_core_tasklet_list_s *tasklet_dynamically_allocate(void) +void eventOS_event_send_timer_allocated(arm_event_storage_t *event) { - return ns_dyn_mem_alloc(sizeof(arm_core_tasklet_list_s)); + event->allocator = ARM_LIB_EVENT_TIMER; + event_core_write(event); } - -arm_core_event_s *event_core_get(void) +void eventOS_event_cancel_critical(arm_event_storage_t *event) { - arm_core_event_s *event; + ns_list_remove(&event_queue_active, event); +} + +static arm_event_storage_t *event_dynamically_allocate(void) +{ + arm_event_storage_t *event = ns_dyn_mem_temporary_alloc(sizeof(arm_event_storage_t)); + if (event) { + event->allocator = ARM_LIB_EVENT_DYNAMIC; + } + return event; +} + +static arm_core_tasklet_t *tasklet_dynamically_allocate(void) +{ + return ns_dyn_mem_alloc(sizeof(arm_core_tasklet_t)); +} + +arm_event_storage_t *event_core_get(void) +{ + arm_event_storage_t *event; platform_enter_critical(); event = ns_list_get_first(&free_event_entry); if (event) { @@ -164,31 +177,48 @@ arm_core_event_s *event_core_get(void) return event; } -static void event_core_free_push(arm_core_event_s *free) +void event_core_free_push(arm_event_storage_t *free) { - platform_enter_critical(); - ns_list_add_to_start(&free_event_entry, free); - platform_exit_critical(); + free->state = ARM_LIB_EVENT_UNQUEUED; + + switch (free->allocator) { + case ARM_LIB_EVENT_STARTUP_POOL: + platform_enter_critical(); + ns_list_add_to_start(&free_event_entry, free); + platform_exit_critical(); + break; + case ARM_LIB_EVENT_DYNAMIC: + // Free all dynamically allocated events. + ns_dyn_mem_free(free); + break; + case ARM_LIB_EVENT_TIMER: + // Hand it back to the timer system + timer_sys_event_free(free); + break; + case ARM_LIB_EVENT_USER: + default: + break; + } } -static arm_core_event_s *event_core_read(void) +static arm_event_storage_t *event_core_read(void) { - arm_core_event_s *event; platform_enter_critical(); - event = ns_list_get_first(&event_queue_active); + arm_event_storage_t *event = ns_list_get_first(&event_queue_active); if (event) { + event->state = ARM_LIB_EVENT_RUNNING; ns_list_remove(&event_queue_active, event); } platform_exit_critical(); return event; } -void event_core_write(arm_core_event_s *event) +void event_core_write(arm_event_storage_t *event) { platform_enter_critical(); bool added = false; - ns_list_foreach(arm_core_event_s, event_tmp, &event_queue_active) { + ns_list_foreach(arm_event_storage_t, event_tmp, &event_queue_active) { // note enum ordering means we're checking if event_tmp is LOWER priority than event if (event_tmp->data.priority > event->data.priority) { ns_list_add_before(&event_queue_active, event_tmp, event); @@ -199,12 +229,25 @@ void event_core_write(arm_core_event_s *event) if (!added) { ns_list_add_to_end(&event_queue_active, event); } + event->state = ARM_LIB_EVENT_QUEUED; /* Wake From Idle */ platform_exit_critical(); eventOS_scheduler_signal(); } +// Requires lock to be held +arm_event_storage_t *eventOS_event_find_by_id_critical(uint8_t tasklet_id, uint8_t event_id) +{ + ns_list_foreach(arm_event_storage_t, cur, &event_queue_active) { + if (cur->data.receiver == tasklet_id && cur->data.event_id == event_id) { + return cur; + } + } + + return NULL; +} + /** * * \brief Initialize Nanostack Core. @@ -219,12 +262,10 @@ void eventOS_scheduler_init(void) ns_list_init(&event_queue_active); ns_list_init(&arm_core_tasklet_list); - //Allocate 10 entry - for (uint8_t i = 0; i < 10; i++) { - arm_core_event_s *event = event_dynamically_allocate(); - if (event) { - ns_list_add_to_start(&free_event_entry, event); - } + //Add first 10 entries to "free" list + for (unsigned i = 0; i < (sizeof(startup_event_pool) / sizeof(startup_event_pool[0])); i++) { + startup_event_pool[i].allocator = ARM_LIB_EVENT_STARTUP_POOL; + ns_list_add_to_start(&free_event_entry, &startup_event_pool[i]); } /* Init Generic timer module */ @@ -234,10 +275,9 @@ void eventOS_scheduler_init(void) } - int8_t eventOS_scheduler_get_active_tasklet(void) { - return curr_tasklet; + return curr_tasklet; } void eventOS_scheduler_set_active_tasklet(int8_t tasklet) @@ -275,28 +315,34 @@ int eventOS_scheduler_timer_synch_after_sleep(uint32_t sleep_ticks) */ bool eventOS_scheduler_dispatch_event(void) { - arm_core_tasklet_list_s *tasklet; - arm_core_event_s *cur_event; - arm_event_s event; - curr_tasklet = 0; - cur_event = event_core_read(); - if (cur_event) { - event = cur_event->data; - event_core_free_push(cur_event); - tasklet = event_tasklet_handler_get(event.receiver); - if (tasklet) { - curr_tasklet = event.receiver; - /* Tasklet Scheduler Call */ - tasklet->func_ptr(&event); - /* Set Current Tasklet to Idle state */ - curr_tasklet = 0; - } - return true; - } else { + arm_event_storage_t *cur_event = event_core_read(); + if (!cur_event) { return false; } + + curr_tasklet = cur_event->data.receiver; + + arm_core_tasklet_t *tasklet = event_tasklet_handler_get(curr_tasklet); + /* Do not bother with check for NULL - tasklets cannot be deleted, + * and user-facing API eventOS_event_send() has already checked the tasklet + * exists, so there is no possible issue there. + * + * For eventOS_event_send_user_allocated(), it would be a non-recoverable + * error to not deliver the message - we have to have a receiver to pass + * ownership to. If the lookup fails, let it crash. We want the send call + * itself to return void to simplify logic. + */ + + /* Tasklet Scheduler Call */ + tasklet->func_ptr(&cur_event->data); + event_core_free_push(cur_event); + + /* Set Current Tasklet to Idle state */ + curr_tasklet = 0; + + return true; } void eventOS_scheduler_run_until_idle(void) @@ -319,3 +365,37 @@ NS_NORETURN void eventOS_scheduler_run(void) } } } + +void eventOS_cancel(arm_event_storage_t *event) +{ + if (!event) { + return; + } + + platform_enter_critical(); + + /* + * Notify timer of cancellation. + */ + if (event->allocator == ARM_LIB_EVENT_TIMER) { + timer_sys_event_cancel_critical(event); + } + + /* + * Remove event from the list, + * Only queued can be removed, unqued are either timers or stale pointers + * RUNNING cannot be removed, we are currenly "in" that event. + */ + if (event->state == ARM_LIB_EVENT_QUEUED) { + eventOS_event_cancel_critical(event); + } + + /* + * Push back to "free" state + */ + if (event->state != ARM_LIB_EVENT_RUNNING) { + event_core_free_push(event); + } + + platform_exit_critical(); +} diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/event.h b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/event.h new file mode 100644 index 0000000000..9efb685857 --- /dev/null +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/event.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2017 ARM Limited. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef NS_EVENT_H_ +#define NS_EVENT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + + +bool event_tasklet_handler_id_valid(uint8_t tasklet_id); +void eventOS_event_send_timer_allocated(arm_event_storage_t *event); + +// This requires lock to be held +arm_event_storage_t *eventOS_event_find_by_id_critical(uint8_t tasklet_id, uint8_t event_id); + +#ifdef __cplusplus +} +#endif + +#endif /*NS_EVENT_H_*/ diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timeout.c b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timeout.c index fa01764c30..62f131bd9d 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timeout.c +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timeout.c @@ -17,6 +17,7 @@ #include "eventOS_event_timer.h" #include "nsdynmemLIB.h" #include "ns_list.h" +#include "timer_sys.h" #define STARTUP_EVENT 0 #define TIMER_EVENT 1 @@ -25,11 +26,9 @@ struct timeout_entry_t { void (*callback)(void *); void *arg; - uint8_t event_id; - ns_list_link_t link; + arm_event_storage_t *event; }; -static NS_LIST_HEAD(timeout_t, link) timeout_list = NS_LIST_INIT(timeout_list); static int8_t timeout_tasklet_id = -1; static void timeout_tasklet(arm_event_s *event) @@ -38,31 +37,29 @@ static void timeout_tasklet(arm_event_s *event) return; } - timeout_t *found = NULL; - ns_list_foreach_safe(timeout_t, cur, &timeout_list) { - if (cur->event_id == event->event_id) { - found = cur; - ns_list_remove(&timeout_list, cur); - break; - } - } + timeout_t *t = event->data_ptr; + arm_event_storage_t *storage = t->event; + sys_timer_struct_s *timer = NS_CONTAINER_OF(storage, sys_timer_struct_s, event); - if (found) { - found->callback(found->arg); - ns_dyn_mem_free(found); + t->callback(t->arg); + + + // Check if this was periodic timer + if (timer->period == 0) { + ns_dyn_mem_free(event->data_ptr); } } -timeout_t *eventOS_timeout_ms(void (*callback)(void *), uint32_t ms, void *arg) +static timeout_t *eventOS_timeout_at_(void (*callback)(void *), void *arg, uint32_t at, uint32_t period) { - uint16_t count; - uint8_t index; - timeout_t *e = ns_dyn_mem_alloc(sizeof(timeout_t)); - if (!e) { + arm_event_storage_t *storage; + + timeout_t *timeout = ns_dyn_mem_alloc(sizeof(timeout_t)); + if (!timeout) { return NULL; } - e->callback = callback; - e->arg = arg; + timeout->callback = callback; + timeout->arg = arg; // Start timeout taskled if it is not running if (-1 == timeout_tasklet_id) { @@ -73,37 +70,46 @@ timeout_t *eventOS_timeout_ms(void (*callback)(void *), uint32_t ms, void *arg) } } - // Check that we still have indexes left. We have only 8bit timer id. - count = ns_list_count(&timeout_list); - if (count >= UINT8_MAX) { // Too big list, timer_id is uint8_t - goto FAIL; - } + arm_event_t event = { + .receiver = timeout_tasklet_id, + .sender = timeout_tasklet_id, + .event_type = TIMER_EVENT, + .event_id = TIMER_EVENT, + .data_ptr = timeout + }; - // Find next free index - index = 0; -AGAIN: - ns_list_foreach(timeout_t, cur, &timeout_list) { - if (cur->event_id == index) { // This index was used - index++; // Check next one. - goto AGAIN; // Start checking from begining of the list, indexes are not in order - } - } - e->event_id = index; - ns_list_add_to_end(&timeout_list, e); - eventOS_event_timer_request(index, TIMER_EVENT, timeout_tasklet_id, ms); - return e; + if (period) + storage = eventOS_event_timer_request_every(&event, period); + else + storage = eventOS_event_timer_request_at(&event, at); + + timeout->event = storage; + if (storage) + return timeout; FAIL: - ns_dyn_mem_free(e); + ns_dyn_mem_free(timeout); return NULL; } +timeout_t *eventOS_timeout_ms(void (*callback)(void *), uint32_t ms, void *arg) +{ + return eventOS_timeout_at_(callback, arg, eventOS_event_timer_ms_to_ticks(ms)+eventOS_event_timer_ticks(), 0); +} + +timeout_t *eventOS_timeout_every_ms(void (*callback)(void *), uint32_t every, void *arg) +{ + return eventOS_timeout_at_(callback, arg, 0, eventOS_event_timer_ms_to_ticks(every)); +} + void eventOS_timeout_cancel(timeout_t *t) { - ns_list_foreach_safe(timeout_t, cur, &timeout_list) { - if (t == cur) { - ns_list_remove(&timeout_list, cur); - eventOS_event_timer_cancel(cur->event_id, timeout_tasklet_id); - ns_dyn_mem_free(cur); - } + if (!t) + return; + + eventOS_cancel(t->event); + + // Defer the freeing until returning from the callback + if (t->event->state != ARM_LIB_EVENT_RUNNING) { + ns_dyn_mem_free(t); } } diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.c b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.c index 4689b0451d..f3affbdd24 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.c +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.c @@ -41,7 +41,6 @@ typedef struct ns_timer_struct { static NS_LIST_DEFINE(ns_timer_list, ns_timer_struct, link); - #define NS_TIMER_RUNNING 1 static uint8_t ns_timer_state = 0; @@ -347,8 +346,8 @@ int8_t eventOS_callback_timer_stop(int8_t ns_timer_id) current_timer->remaining_slots = 0; /*Check if some timer is already active*/ - ns_list_foreach(ns_timer_struct, current_timer, &ns_timer_list) { - if (current_timer->timer_state == NS_TIMER_ACTIVE) { + ns_list_foreach(ns_timer_struct, curr_timer, &ns_timer_list) { + if (curr_timer->timer_state == NS_TIMER_ACTIVE) { active_timer_found = true; break; } @@ -357,12 +356,12 @@ int8_t eventOS_callback_timer_stop(int8_t ns_timer_id) if (!active_timer_found) { pl_timer_remaining_slots = platform_timer_get_remaining_slots(); /*Find hold-labelled timer with the least remaining slots*/ - ns_list_foreach(ns_timer_struct, current_timer, &ns_timer_list) { - if (current_timer->timer_state == NS_TIMER_HOLD) { - current_timer->remaining_slots += pl_timer_remaining_slots; + ns_list_foreach(ns_timer_struct, cur_timer, &ns_timer_list) { + if (cur_timer->timer_state == NS_TIMER_HOLD) { + cur_timer->remaining_slots += pl_timer_remaining_slots; - if (!first_timer || current_timer->remaining_slots < first_timer->remaining_slots) { - first_timer = current_timer; + if (!first_timer || cur_timer->remaining_slots < first_timer->remaining_slots) { + first_timer = cur_timer; } } } @@ -372,12 +371,12 @@ int8_t eventOS_callback_timer_stop(int8_t ns_timer_id) /*Start HAL timer*/ ns_timer_start_pl_timer(first_timer->remaining_slots); /*If some of the other hold-labelled timers have the same remaining slots as the timer_tmp, mark them active*/ - ns_list_foreach(ns_timer_struct, current_timer, &ns_timer_list) { - if (current_timer->timer_state == NS_TIMER_HOLD) { - if (current_timer->remaining_slots == first_timer->remaining_slots) { - current_timer->timer_state = NS_TIMER_ACTIVE; + ns_list_foreach(ns_timer_struct, cur_timer, &ns_timer_list) { + if (cur_timer->timer_state == NS_TIMER_HOLD) { + if (cur_timer->remaining_slots == first_timer->remaining_slots) { + cur_timer->timer_state = NS_TIMER_ACTIVE; } else { - current_timer->remaining_slots -= first_timer->remaining_slots; + cur_timer->remaining_slots -= first_timer->remaining_slots; } } } diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.h b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.h index 0bb7d8c99d..eac2f9d48b 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.h +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/ns_timer.h @@ -16,11 +16,17 @@ #ifndef NS_TIMER_H_ #define NS_TIMER_H_ +#include "platform/eventloop_config.h" + #ifdef __cplusplus extern "C" { #endif +#ifndef NS_EXCLUDE_HIGHRES_TIMER extern int8_t ns_timer_sleep(void); +#else +#define ns_timer_sleep() ((int8_t) 0) +#endif #ifdef __cplusplus } diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/system_timer.c b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/system_timer.c index e47eab3289..7535a4c597 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/system_timer.c +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/system_timer.c @@ -18,34 +18,35 @@ #include "timer_sys.h" #include "platform/arm_hal_interrupt.h" #include "platform/arm_hal_timer.h" -#include "ns_timer.h" #include "nsdynmemLIB.h" #include "eventOS_event.h" +#include "eventOS_event_timer.h" +#include "event.h" #include "eventOS_callback_timer.h" +#include "ns_timer.h" + #ifndef ST_MAX #define ST_MAX 6 #endif -typedef struct sys_timer_struct_s { - uint32_t timer_sys_launch_time; - int8_t timer_sys_launch_receiver; - uint8_t timer_sys_launch_message; - uint8_t timer_event_type; - - ns_list_link_t link; -} sys_timer_struct_s; +static sys_timer_struct_s startup_sys_timer_pool[ST_MAX]; #define TIMER_SLOTS_PER_MS 20 -#define TIMER_SYS_TICK_PERIOD 10 // milliseconds +NS_STATIC_ASSERT(1000 % EVENTOS_EVENT_TIMER_HZ == 0, "Need whole number of ms per tick") +#define TIMER_SYS_TICK_PERIOD (1000 / EVENTOS_EVENT_TIMER_HZ) // milliseconds -static uint32_t run_time_tick_ticks = 0; -static NS_LIST_DEFINE(system_timer_free, sys_timer_struct_s, link); -static NS_LIST_DEFINE(system_timer_list, sys_timer_struct_s, link); +// timer_sys_ticks must be read in critical section to guarantee +// atomicity on 16-bit platforms +static volatile uint32_t timer_sys_ticks; + +static NS_LIST_DEFINE(system_timer_free, sys_timer_struct_s, event.link); +static NS_LIST_DEFINE(system_timer_list, sys_timer_struct_s, event.link); static sys_timer_struct_s *sys_timer_dynamically_allocate(void); static void timer_sys_interrupt(void); +static void timer_sys_add(sys_timer_struct_s *timer); #ifndef NS_EVENTLOOP_USE_TICK_TIMER static int8_t platform_tick_timer_start(uint32_t period_ms); @@ -89,24 +90,8 @@ static int8_t platform_tick_timer_stop(void) */ void timer_sys_init(void) { - run_time_tick_ticks = 0; - - // Clear old timers - ns_list_foreach_safe(sys_timer_struct_s, temp, &system_timer_list) { - ns_list_remove(&system_timer_list, temp); - ns_dyn_mem_free(temp); - } - // Clear old free timer entrys - ns_list_foreach_safe(sys_timer_struct_s, temp, &system_timer_free) { - ns_list_remove(&system_timer_free, temp); - ns_dyn_mem_free(temp); - } - for (uint8_t i = 0; i < ST_MAX; i++) { - sys_timer_struct_s *temp = sys_timer_dynamically_allocate(); - if (temp) { - ns_list_add_to_start(&system_timer_free, temp); - } + ns_list_add_to_start(&system_timer_free, &startup_sys_timer_pool[i]); } platform_tick_timer_register(timer_sys_interrupt); @@ -141,7 +126,7 @@ static void timer_sys_interrupt(void) static sys_timer_struct_s *sys_timer_dynamically_allocate(void) { - return (sys_timer_struct_s*)ns_dyn_mem_alloc(sizeof(sys_timer_struct_s)); + return ns_dyn_mem_alloc(sizeof(sys_timer_struct_s)); } static sys_timer_struct_s *timer_struct_get(void) @@ -158,23 +143,149 @@ static sys_timer_struct_s *timer_struct_get(void) return timer; } -uint32_t timer_get_runtime_ticks(void) // only used in dev_stats_internal.c +void timer_sys_event_free(arm_event_storage_t *event) +{ + platform_enter_critical(); + sys_timer_struct_s *timer = NS_CONTAINER_OF(event, sys_timer_struct_s, event); + if (timer->period == 0) { + // Non-periodic - return to free list + ns_list_add_to_start(&system_timer_free, timer); + } else { + // Periodic - check due time of next launch + timer->launch_time += timer->period; + if (TICKS_BEFORE_OR_AT(timer->launch_time, timer_sys_ticks)) { + // next event is overdue - queue event now + eventOS_event_send_timer_allocated(&timer->event); + } else { + // add back to timer queue for the future + timer_sys_add(timer); + } + } + platform_exit_critical(); +} + +void timer_sys_event_cancel_critical(struct arm_event_storage *event) +{ + sys_timer_struct_s *timer = NS_CONTAINER_OF(event, sys_timer_struct_s, event); + timer->period = 0; + // If its unqueued it is on my timer list, otherwise it is in event-loop. + if (event->state == ARM_LIB_EVENT_UNQUEUED) { + ns_list_remove(&system_timer_list, timer); + } +} + +uint32_t eventOS_event_timer_ticks(void) { uint32_t ret_val; + // Enter/exit critical is a bit clunky, but necessary on 16-bit platforms, + // which won't be able to do an atomic 32-bit read. platform_enter_critical(); - ret_val = run_time_tick_ticks; + ret_val = timer_sys_ticks; platform_exit_critical(); return ret_val; } - - -int8_t eventOS_event_timer_request(uint8_t snmessage, uint8_t event_type, int8_t tasklet_id, uint32_t time) +/* Called internally with lock held */ +static void timer_sys_add(sys_timer_struct_s *timer) { - int8_t res = -1; - sys_timer_struct_s *timer = NULL; + uint32_t at = timer->launch_time; + + // Find first timer scheduled to run after us, and insert before it. + // (This means timers scheduled for same time run in order of request) + ns_list_foreach(sys_timer_struct_s, t, &system_timer_list) { + if (TICKS_BEFORE(at, t->launch_time)) { + ns_list_add_before(&system_timer_list, t, timer); + return; + } + } + + // Didn't insert before another timer, so must be last. + ns_list_add_to_end(&system_timer_list, timer); +} + +/* Called internally with lock held */ +static arm_event_storage_t *eventOS_event_timer_request_at_(const arm_event_t *event, uint32_t at, uint32_t period) +{ + // Because we use user-allocated events, they must get delivered to avoid + // a leak. Previously this call queued timers for invalid tasks, then they + // would go undelivered. Now it returns an error. + if (!event_tasklet_handler_id_valid(event->receiver)) { + return NULL; + } + + sys_timer_struct_s *timer = timer_struct_get(); + if (!timer) { + return NULL; + } + + timer->event.data = *event; + timer->event.allocator = ARM_LIB_EVENT_TIMER; + timer->event.state = ARM_LIB_EVENT_UNQUEUED; + timer->launch_time = at; + timer->period = period; + + if (TICKS_BEFORE_OR_AT(at, timer_sys_ticks)) { + eventOS_event_send_timer_allocated(&timer->event); + } else { + timer_sys_add(timer); + } + + return &timer->event; +} + +arm_event_storage_t *eventOS_event_timer_request_at(const arm_event_t *event, uint32_t at) +{ + platform_enter_critical(); + + arm_event_storage_t *ret = eventOS_event_timer_request_at_(event, at, 0); + + platform_exit_critical(); + + return ret; +} + +arm_event_storage_t *eventOS_event_timer_request_in(const arm_event_t *event, int32_t in) +{ + platform_enter_critical(); + + arm_event_storage_t *ret = eventOS_event_timer_request_at_(event, timer_sys_ticks + in, 0); + + platform_exit_critical(); + + return ret; + +} + +arm_event_storage_t *eventOS_event_timer_request_every(const arm_event_t *event, int32_t period) +{ + if (period <= 0) { + return NULL; + } platform_enter_critical(); + + arm_event_storage_t *ret = eventOS_event_timer_request_at_(event, timer_sys_ticks + period, period); + + platform_exit_critical(); + + return ret; + +} + +int8_t eventOS_event_timer_request(uint8_t event_id, uint8_t event_type, int8_t tasklet_id, uint32_t time) +{ + const arm_event_t event = { + .event_id = event_id, + .event_type = event_type, + .receiver = tasklet_id, + .sender = 0, + .data_ptr = NULL, + .event_data = 0, + .priority = ARM_LIB_MED_PRIORITY_EVENT, + }; + + // Legacy time behaviour preserved + // Note that someone wanting 20ms gets 2 ticks, thanks to this test. 30ms would be 4 ticks. // And why shouldn't they be able to get a 1-tick callback? if (time > 2 * TIMER_SYS_TICK_PERIOD) { @@ -184,75 +295,76 @@ int8_t eventOS_event_timer_request(uint8_t snmessage, uint8_t event_type, int8_t } else { time = 2; } - timer = timer_struct_get(); - if (timer) { - timer->timer_sys_launch_message = snmessage; - timer->timer_sys_launch_receiver = tasklet_id; - timer->timer_event_type = event_type; - timer->timer_sys_launch_time = time; - ns_list_add_to_start(&system_timer_list, timer); - res = 0; - } + + platform_enter_critical(); + arm_event_storage_t *ret = eventOS_event_timer_request_at_(&event, timer_sys_ticks + time, 0); platform_exit_critical(); - return res; + return ret?0:-1; } -int8_t eventOS_event_timer_cancel(uint8_t snmessage, int8_t tasklet_id) +int8_t eventOS_event_timer_cancel(uint8_t event_id, int8_t tasklet_id) { - int8_t res = -1; platform_enter_critical(); + + /* First check pending timers */ ns_list_foreach(sys_timer_struct_s, cur, &system_timer_list) { - if (cur->timer_sys_launch_receiver == tasklet_id && cur->timer_sys_launch_message == snmessage) { - ns_list_remove(&system_timer_list, cur); - ns_list_add_to_start(&system_timer_free, cur); - res = 0; - break; + if (cur->event.data.receiver == tasklet_id && cur->event.data.event_id == event_id) { + eventOS_cancel(&cur->event); + goto done; } } - platform_exit_critical(); - return res; -} + /* No pending timer, so check for already-pending event */ + arm_event_storage_t *event = eventOS_event_find_by_id_critical(tasklet_id, event_id); + if (event && event->allocator == ARM_LIB_EVENT_TIMER) { + eventOS_cancel(event); + goto done; + } + /* No match found */ + platform_exit_critical(); + return -1; + +done: + platform_exit_critical(); + return 0; +} uint32_t eventOS_event_timer_shortest_active_timer(void) { uint32_t ret_val = 0; platform_enter_critical(); - ns_list_foreach(sys_timer_struct_s, cur, &system_timer_list) { - if (ret_val == 0 || cur->timer_sys_launch_time < ret_val) { - ret_val = cur->timer_sys_launch_time; - } + sys_timer_struct_s *first = ns_list_get_first(&system_timer_list); + if (first == NULL) { + // Weird API has 0 for "no events" + ret_val = 0; + } else if (TICKS_BEFORE_OR_AT(first->launch_time, timer_sys_ticks)) { + // Which means an immediate/overdue event has to be 1 + ret_val = 1; + } else { + ret_val = first->launch_time - timer_sys_ticks; } platform_exit_critical(); - //Convert ticks to ms - ret_val *= TIMER_SYS_TICK_PERIOD; - return ret_val; + return eventOS_event_timer_ticks_to_ms(ret_val); } void system_timer_tick_update(uint32_t ticks) { platform_enter_critical(); //Keep runtime time - run_time_tick_ticks += ticks; + timer_sys_ticks += ticks; ns_list_foreach_safe(sys_timer_struct_s, cur, &system_timer_list) { - if (cur->timer_sys_launch_time <= ticks) { - arm_event_s event = { - .receiver = cur->timer_sys_launch_receiver, - .sender = 0, /**< Event sender Tasklet ID */ - .data_ptr = NULL, - .event_type = cur->timer_event_type, - .event_id = cur->timer_sys_launch_message, - .event_data = 0, - .priority = ARM_LIB_MED_PRIORITY_EVENT, - }; - eventOS_event_send(&event); + if (TICKS_BEFORE_OR_AT(cur->launch_time, timer_sys_ticks)) { + // Unthread from our list ns_list_remove(&system_timer_list, cur); - ns_list_add_to_start(&system_timer_free, cur); + // Make it an event (can't fail - no allocation) + // event system will call our timer_sys_event_free on event delivery. + eventOS_event_send_timer_allocated(&cur->event); } else { - cur->timer_sys_launch_time -= ticks; + // List is ordered, so as soon as we see a later event, we're done. + break; } } diff --git a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/timer_sys.h b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/timer_sys.h index cbb829efab..a29aec937a 100644 --- a/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/timer_sys.h +++ b/features/FEATURE_COMMON_PAL/sal-stack-nanostack-eventloop/source/timer_sys.h @@ -20,6 +20,16 @@ extern "C" { #endif +#include "eventOS_event.h" + +/* We borrow base event storage, including its list link, and add a time field */ +typedef struct sys_timer_struct_s { + arm_event_storage_t event; + uint32_t launch_time; // tick value + uint32_t period; +} sys_timer_struct_s; + + /** * Initialize system timer * */ @@ -28,6 +38,10 @@ extern void timer_sys_init(void); extern uint32_t timer_get_runtime_ticks(void); int8_t timer_sys_wakeup(void); void timer_sys_disable(void); +void timer_sys_event_free(struct arm_event_storage *event); + +// This require lock to be held +void timer_sys_event_cancel_critical(struct arm_event_storage *event); /** * System Timer update and synch after sleep diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..058b2c5e03 Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_ethernet_host.ar b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_ethernet_host.ar deleted file mode 100644 index 11fcaae29b..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_ethernet_host.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..508276a954 Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_ethernet_host.ar b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_ethernet_host.ar deleted file mode 100644 index 6c2b9de10e..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_ethernet_host.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..508276a954 Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_ethernet_host.ar b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_ethernet_host.ar deleted file mode 100644 index 6c2b9de10e..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_ethernet_host.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..c305e4fe0b Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_ethernet_host.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_ethernet_host.a deleted file mode 100644 index 8728622992..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_ethernet_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..47e70521ff Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_ethernet_host.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_ethernet_host.a deleted file mode 100644 index 0dc7129377..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_ethernet_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..47e70521ff Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_ethernet_host.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_ethernet_host.a deleted file mode 100644 index 0dc7129377..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_ethernet_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..52e3110590 Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_ethernet_host.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_ethernet_host.a deleted file mode 100644 index 8a77a92af7..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_ethernet_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..c90a419d47 Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_ethernet_host.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_ethernet_host.a deleted file mode 100644 index f365c568c6..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_ethernet_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..c90a419d47 Binary files /dev/null and b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_ethernet_host.a b/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_ethernet_host.a deleted file mode 100644 index f365c568c6..0000000000 Binary files a/features/nanostack/FEATURE_ETHERNET_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_ethernet_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..6819905cbe Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_border_router.ar b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_border_router.ar deleted file mode 100644 index 868ad25fcc..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_border_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..2445009f89 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_border_router.ar b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_border_router.ar deleted file mode 100644 index 50026ea69c..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_border_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..2445009f89 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_border_router.ar b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_border_router.ar deleted file mode 100644 index 50026ea69c..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_border_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..0d46b6d20f Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_border_router.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_border_router.a deleted file mode 100644 index e06ba6c839..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..6e30996970 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a deleted file mode 100644 index bba9eaef4d..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..6e30996970 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a deleted file mode 100644 index bba9eaef4d..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..9d7399ba4a Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_border_router.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_border_router.a deleted file mode 100644 index 999329f66e..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..a766c34195 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_border_router.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_border_router.a deleted file mode 100644 index 72c38c42fc..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..a766c34195 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_border_router.a b/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_border_router.a deleted file mode 100644 index 72c38c42fc..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..5e32c69ac8 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_host.ar b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_host.ar deleted file mode 100644 index 73930b8d9e..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_host.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..dcae8ea5fd Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_host.ar b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_host.ar deleted file mode 100644 index a1a5b5d2c1..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_host.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..dcae8ea5fd Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_host.ar b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_host.ar deleted file mode 100644 index a1a5b5d2c1..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_host.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..8add0410da Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_host.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_host.a deleted file mode 100644 index da5ab7d0c0..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..7cc6c293ee Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_host.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_host.a deleted file mode 100644 index effa4503d3..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..7cc6c293ee Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_host.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_host.a deleted file mode 100644 index effa4503d3..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..f61a56ff76 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_host.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_host.a deleted file mode 100644 index 9a179d0671..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..f37c5471ca Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_host.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_host.a deleted file mode 100644 index 3ca8e32cc3..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..f37c5471ca Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_host.a b/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_host.a deleted file mode 100644 index 3ca8e32cc3..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_HOST/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_host.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..af3627d32d Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_router.ar b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_router.ar deleted file mode 100644 index 60ba464234..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_lowpan_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..f5f11098d1 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_router.ar b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_router.ar deleted file mode 100644 index b5ae02ba96..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_lowpan_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..f5f11098d1 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_router.ar b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_router.ar deleted file mode 100644 index b5ae02ba96..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_lowpan_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..6f6a3a9f4b Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_router.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_router.a deleted file mode 100644 index dacc9b074e..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_lowpan_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..fa8480f029 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_router.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_router.a deleted file mode 100644 index b13d56b71d..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..fa8480f029 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_router.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_router.a deleted file mode 100644 index b13d56b71d..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_lowpan_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..0845037d8d Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_router.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_router.a deleted file mode 100644 index f3fee65f35..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_lowpan_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..aca5249818 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_router.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_router.a deleted file mode 100644 index 04af103f7c..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_lowpan_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..aca5249818 Binary files /dev/null and b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_router.a b/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_router.a deleted file mode 100644 index 04af103f7c..0000000000 Binary files a/features/nanostack/FEATURE_LOWPAN_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_lowpan_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/Doxyfile b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/Doxyfile index eca55dfe36..71d397e99a 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/Doxyfile +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/Doxyfile @@ -1954,7 +1954,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = +PREDEFINED = DOXYGEN # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/README.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/README.md index d99676d341..c57957983a 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/README.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/README.md @@ -1,31 +1,14 @@ ARM IPV6/6LoWPAN stack. ======================= -This repository contains the ARM IPv6/6LoWPAN Stack for mbed OS. +This repository contains the ARM IPv6/6LoWPAN/Thread Stack for mbed OS. + +![](docs/img/thread_certified.png) + +mbed OS is now a Thread Certified Component. Using IPv6 with 6LoWPAN as the foundation, Thread technology provides a low-power, self-healing mesh network designed for the home. The documentation is hosted in http://docs.mbed.com/projects/arm-ipv66lowpan-stack/ -On mbed OS, the preferred usage is through [mbed Mesh API](https://github.com/ARMmbed/mbed-mesh-api) that provides the required wrappers between the socket abstraction layer and this stack. - -To see, how the 6LoWPAN Stack works, check the example application [mbed-client-example-6lowpan](https://github.com/ARMmbed/mbed-client-example-6lowpan). - -You can find he known limitations here: [sal-iface-6lowpan](https://github.com/ARMmbed/sal-iface-6lowpan). - -## Changes in Nanostack 4.0: - -### New APIs: - -- MLE router and host lifetime configuration API -- MLE neighbor limits configuration API -- MLE token bucket configuration API -- API for adding/deleting routes -- FHSS API - -### Other changes: - -- Function `arm_nwk_6lowpan_link_scan_paramameter_set()` renamed to `arm_nwk_6lowpan_link_scan_parameter_set()` (due to misspelling) -- Channel mask settings API changed -- The parameters of function `cca_start()` changed - -For instructions on updating your modules, see https://docs.mbed.com/docs/arm-ipv66lowpan-stack/en/latest/api_changes_to_v4_0_0/index.html. +On mbed OS, usage is through [mbed Mesh API](https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/communication/mesh/) and [Socket API](https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/communication/network_sockets/). +To see, how the 6LoWPAN Stack works, check the example application [mbed-os-example-mesh-minimal](https://github.com/ARMmbed/mbed-os-example-mesh-minimal). diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/05_reference.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/05_reference.md index 21fc9eba86..40e5e035d2 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/05_reference.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/05_reference.md @@ -43,4 +43,6 @@ The reference manual contains several chapters; you can read them in sequence, b 13. [**Thread Related APIs**](thread_APIs.md):Read this to familiarize yourself with the Thread protocol related APIs. +14. [**Load balancing API**](17_API_load_balancer.md):Read this to familiarize yourself with the Load balancing API + diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/08_API_events.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/08_API_events.md index 37cbb22f67..a067fb98cf 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/08_API_events.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/08_API_events.md @@ -29,12 +29,12 @@ An application should register at least one event handler. The tasklets are then The following is a prototype of a tasklet: ``` -void tasklet (arm_event_s *) +void tasklet (arm_event_t *) ``` Parameter|Description ---------|----------- -`arm_event_s`|A pointer to the event structure that contains the event information. +`arm_event_t`|A pointer to the event structure that contains the event information. The most important event information is the event type. There are four main types of events that a tasklet may receive. _Table 3-2_ lists the event types. @@ -43,7 +43,7 @@ The most important event information is the event type. There are four main type Event type|Description ----------|----------- -`ARM_LIB_TASKLET_INIT_EVENT`|Can be used as an initialization event to a tasklet, when it is created. Initialization event will be called only once. +`ARM_LIB_TASKLET_INIT_EVENT`|Can be used as an initialization event to a tasklet, when it is created. The initialization event is called only once. `ARM_LIB_NWK_INTERFACE_EVENT`|These event types give information about networking bootstrap to the application layer. `ARM_LIB_SYSTEM_TIMER_EVENT`|These events are user-launched timer events. They are used for timing events on an application. `APPLICATION_EVENT`|These events are sent from another tasklet and they do not originate from the stack. These are used for communicating between tasklets. @@ -54,7 +54,7 @@ The rest of the information is stored in the event structure received by the tas The following example shows the basic structure of an empty tasklet: ``` -void tasklet(arm_event_s *event) +void tasklet(arm_event_t *event) { switch(event->event_type) { case ARM_LIB_TASKLET_INIT_EVENT: @@ -84,7 +84,7 @@ To register a tasklet handler: ``` int8_t eventOS_event_handler_create ( - void (*tasklet_func_ptr)(arm_event_s*), + void (*tasklet_func_ptr)(arm_event_t*), uint8_t init_event_type ) ``` @@ -114,7 +114,7 @@ typedef struct arm_event_s void *data_ptr; arm_library_event_priority_e priority; uint32_t event_data; -} arm_event_s; +} arm_event_t; ``` Member|Description @@ -124,7 +124,7 @@ Member|Description `event_type`|Represents the `typecast arm_library_event_type_e`. `event_id`|Timer ID, NWK interface ID or an application-specific ID. `data_ptr`|Application's ability to share a data pointer tasklet with a tasklet. -`priority`|Task priority. +`priority`|Event priority. `event_data`|Extra event data. Used in network events. ### Reference events @@ -228,6 +228,7 @@ Name|Value ----|----- `receiver`|Tasklet ID for the selected tasklet. `sender`|Tasklet ID for the sender. +`priority`|Relative delivery priority (low, medium or high) `event_type`|Developer-defined event type. `event_data`|Developer can give a 32-bit data value, if required. `event_id`|Developer-defined ID. @@ -240,7 +241,7 @@ To send an event: ``` int8_t eventOS_event_send ( - arm_event_s *event + const arm_event_t *event ) ``` @@ -259,14 +260,48 @@ An example of sending an event from interrupt: ``` void xx_button_interrupt_handler(void) { - arm_event_s event = {0}; + arm_event_t event = {0}; /*Example of sending event to the application. event.event is user-defined event. In this application S1_BUTTON event is sent when IRQD interrupt occurs */ event.receiver = main_tasklet_id event.sender = main_tasklet_id; + event.priority = ARM_LIB_MED_PRIORITY_EVENT; event.event_type = APPLICATION_EVENT; event.event_id = S1_BUTTON; eventOS_event_send(&event); } ``` + +To end a user-allocated event, avoiding the possibility of memory +allocation failure: + +``` +void eventOS_event_send_user_allocated +( + arm_event_storage_t *event +) +``` + +This sends an event, but without taking a copy of the event data. The event +structure must remain valid until the event is delivered. See the +documentation comments on the declaration for more details. + +To send periodic events or events after a timeout, refer to [Library Timer API](10_API_timer.md). + +### Cancelling an event + +To cancel and event or timer before it is executed, call `eventOS_cancel()` + +``` +void eventOS_cancel(arm_event_storage_t *event); +``` + +Queued events are removed from the event-loop queue and/or the timer queue. +Passing a NULL pointer is allowed, and it does nothing. + +Event pointers are valid from the time they are queued until the event has stopped running or is cancelled. +Cancelling a currently running event is only useful when you want to stop scheduling it, provided that it is on a periodic timer; +it has no other effect. + +Cancelling an already cancelled or already run single-shot event is undefined behaviour. diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/09_API_network_def.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/09_API_network_def.md index 70ef6b765f..50a9e179ce 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/09_API_network_def.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/09_API_network_def.md @@ -1,4 +1,4 @@ -Network Definition APIs +Network Definition APIs ====================== This chapter describes the Network API that includes functionalities, such as network tasks, network authentication, and security. It contains the following sections: @@ -231,14 +231,16 @@ To set a callback for storing PANA key material, use the following function. Bef ``` int8_t pana_client_nvm_callback_set ( - void (*passed_fptr)(pana_client_nvm_update_process_t), + pana_client_session_update_cb *nvm_update, + pana_client_session_get_cb *nvm_get, uint8_t * nvm_static_buffer ); ``` Parameter|Description ---------|----------- -`passed_fptr`|A pointer to the callback function. +`nvm_update`|A pointer to the callback function for session udate and removal. +`nvm_get`|A pointer to the callback function for read session from NVM. `nvm_static_buffer`|A pointer to the allocated buffer. The required size is 86 bytes.
@@ -253,14 +255,14 @@ The callback function is called whenever the stack acquires new keys. The parame typedef enum pana_client_nvm_update_process_t { PANA_CLIENT_SESSION_UPDATE, - PANA_CLIENT_SESSION_SEQ_UPDATE, + PANA_CLIENT_SESSION_REMOVE, }pana_client_nvm_update_process_t; ``` Parameter|Description ---------|----------- `PANA_CLIENT_SESSION_UPDATE`|Full update of PANA session information. -`PANA_CLIENT_SESSION_SEQ_UPDATE`|An update of the REQ and RES sequence number of a PANA key pull or push operation. +`PANA_CLIENT_SESSION_REMOVE`|Current session for the given PAN ID can be removed. When a callback takes place with the parameter `PANA_CLIENT_SESSION_UPDATE`, the first 16 bytes in the data buffer are PANA session address and the following 70 bytes PANA session keys. The session address is associated with the node's parent address, so that is most probably required only on star topology networks. On the mesh network, the parent address can change, so storing the session address is unnecessary. @@ -271,41 +273,31 @@ An example of a session saving functionality when the session address is not sto ``` #define PANA_SESSION_ADDRESS_SIZE 16 #define PANA_SESSION_KEY_SIZE 70 -void pana_resume_callback(pana_client_nvm_update_process_t event) +void pana_resume_callback(uint16_t pan_id, pana_client_nvm_update_process_t event) { if (PANA_CLIENT_SESSION_UPDATE == event) { // store now the Session keys, skip the session address + //Discover by given pan-id write_to_storage(nvm_static_buffer+PANA_SESSION_ADDRESS_SIZE, PANA_SESSION_KEY_SIZE); + } else if (PANA_CLIENT_SESSION_UPDATE == event) { + //Discover by given pan-id and remove from NVM } } ``` -To resume the PANA session: +An example for session get callback: ``` -int8_t net_pana_client_session_nvm_data_load -( - uint8_t *data_buffer, - uint8_t *session_address, - int8_t interface_id -); -``` - -Parameter|Description ----------|----------- -`data_buffer`|A pointer to the PANA session keys. -`session_address`|A pointer to the PANA session address, or NULL if no session address information is stored. -`interface_id`|The interface ID for a 6LoWPAN interface. - -When you give a `NULL` pointer to `session_address`, the function only restores the PANA keys and can then associate with any parent from the same network. This functionality is required on the mesh topology. - -A client can keep track of a single PANA session or multiple PANA sessions using the enumeration below. Single session mode is set by default. - -``` -typedef enum { - NET_PANA_SINGLE_SESSION, - NET_PANA_MULTI_SESSION, -} net_pana_session_mode_e; +bool pana_nvm_read_callback(uint16_t pan_id) +{ + //Discover by given pan-id and remove from NVM + if (discover_session_from_nvm_by_pan_id(pan_id)) { + + //Write session to static memory buffer + return true; + } + return false; +} ``` #### Server side API @@ -319,15 +311,19 @@ The next step is to set a PANA key update callback that receives the key materia ``` int8_t pana_server_nvm_callback_set ( - uint16_t (*passed_fptr)(pana_nvm_update_process_t), + pana_server_update_cb *update_cb, + pana_server_session_get_cb *nvm_get, + pana_server_session_get_by_id_cb *nvm_session_get, uint8_t * nvm_static_buffer ); ``` Parameter|Description ---------|----------- -`passed_fptr`|A pointer to the callback function. -`nvm_static_buffer`|A pointer to the buffer used to store the PANA keys. +`update_cb`|A pointer to the callback function. +`nvm_get`|A pointer to the callback function to read the client session by session address. +`nvm_session_get`|A pointer to the callback function to read the client session by PANA session ID. +`nvm_static_buffer`|A pointer to the buffer used for storing the PANA keys.
Return value:
@@ -342,7 +338,6 @@ typedef enum pana_nvm_update_process_t { PANA_SERVER_MATERIAL_UPDATE, PANA_SERVER_CLIENT_SESSION_UPDATE, - PANA_SERVER_CLIENT_SESSION_SEQ_UPDATE, PANA_SERVER_CLIENT_SESSION_REMOVE_UPDATE, }pana_nvm_update_process_t; ``` @@ -351,19 +346,19 @@ Parameter|Description ---------|----------- `PANA_SERVER_MATERIAL_UPDATE`|An update of the PANA server security material. `PANA_SERVER_CLIENT_SESSION_UPDATE`|An update of the PANA client session. -`PANA_SERVER_CLIENT_SESSION_SEQ_UPDATE`|A sequence number update of the PANA client session. `PANA_SERVER_CLIENT_SESSION_REMOVE_UPDATE`|Removes the PANA client session. The buffer that is used to transfer data from the PANA process to the storage can contain server keys or client session data. When the server keys are stored, the buffer size is 90 bytes. On the client sessions, it depends on the event that the buffer contains. When client session data is stored, the buffer is divided into the following parts: -1. Session addresses, 20 bytes, containing the following parts: - 1. 16 bytes offset, 2 bytes. +1. Session addresses, 24 bytes, containing the following parts: + 1. 16-bit offset, 2 bytes. 2. Client session IPv6 address, 16 bytes. 3. Client port number, 2 bytes. + 4. Pana session Id, 4-bytes 2. PANA client session data, 33 bytes. -3. PANA client session private keys, 63 bytes. +3. PANA client session private keys, 59 bytes. Not all segments are valid by each call. The parameter that is passed to the callback function defines the parts that are valid. _Table 3-12_ defines the segments. @@ -376,7 +371,7 @@ Not all segments are valid by each call. The parameter that is passed to the cal |`PANA_SERVER_CLIENT_SESSION_SEQ_UPDATE`|Update only the client session data. The first two segments are stored in the buffer.
The callback should use the offset field to determine which session data this is.| |`PANA_SERVER_CLIENT_SESSION_REMOVE_UPDATE`|Remove the previously stored session. Only the first segment is stored in the buffer.
The callback should use the offset field to determine which session data this is.| -The following example shows the basic functionality of the PANA server callback: +The following example shows the basic functionality of the PANA server callbacks: ``` uint16_t app_nvm_pana_update(pana_nvm_update_process_t update_type ) @@ -405,6 +400,26 @@ uint16_t app_nvm_pana_update(pana_nvm_update_process_t update_type ) return remove_session(offset); } } + +bool app_nvm_pana_read_session_by_session_id(uint32_t session_id) +{ + //Discover session by address. Session id offset is 20 bytes from storaged data + if (session_read_by_id(session_id) ) { + //Write session data behind nvm_static_buffer + return true; + } + return false; +} + +bool app_nvm_pana_read_session_by_address(uint8_t *linklocal_address) +{ + //Discover session by address session. Address offset is 2 bytes from storaged data + if (session_read_by_address(linklocal_address) ) { + //Write session data behind nvm_static_buffer + return true; + } + return false; +} ``` **Note:** The previous example assumes that the user provides the functions `store_server_key()`, `store_new_session()`, `update_session()`, `update_session_data()` and `remove_session()`. @@ -447,289 +462,3 @@ Parameter|Description
0 Success.
-1 Failure.
- -## General security type definitions - -This section introduces general security type definitions. - -### Certificate structure - -The certificate structure comprises the following members: - -``` -typedef struct arm_certificate_chain_entry_s -{ - uint8_t chain_length; - const uint8_t *cert_chain[4]; - uint16_t cert_len[4]; - const uint8_t *key_chain[4]; -} arm_certificate_chain_entry_t; -``` - -Member|Description -------|----------- -`chain_length`|Defines the length of the certificate chain. -`cert_chain`|Defines the pointers to the certificates in chain. -`cert_len`|Defines the certificate lengths. -`key_chain`|Defines the private keys. - -### TLS cipher mode structure - -This enumeration defines the TLS cipher modes: - -``` -typedef enum net_tls_cipher_e -{ - NET_TLS_PSK_CIPHER, - NET_TLS_ECC_CIPHER, - NET_TLS_PSK_AND_ECC_CIPHER, -} net_tls_cipher_e; -``` - -Parameter|Description ----------|----------- -`NET_TLS_PSK_CIPHER`|Means that network authentication only supports PSK. -`NET_TLS_ECC_CIPHER`|Means that network authentication only supports ECC. -`NET_TLS_PSK_AND_ECC_CIPHER`|Means that network authentication supports both PSK and ECC. - -### TLS PSK info structure - -The TLS PSK info structure comprises the following members: - -``` -typedef struct net_tls_psk_info_s -{ - uint32_t key_id; - uint8_t key[16]; -} net_tls_psk_info_s; -``` - -Member|Description -------|----------- -`key_id`|Means that a PSK key ID can be `0x01-0xFFFF`. The storage size is intentionally 32 bits. -`key`|Defines a 128-bit PSK key. - -The 6LoWPAN stack supports two different chain certificate users: - -- Transport Layer Security (TLS). -- Network authentication (PANA, EAP or TLS). - -## Ethernet interface bootstrap definition - -This section defines the Ethernet interface bootstrap. - -### IPv6 - -This enumeration defines the IPv6 bootstrap: - -``` -typedef enum net_ipv6_mode_e -{ - NET_IPV6_BOOTSTRAP_STATIC, - NET_IPV6_BOOTSTRAP_AUTONOMOUS - -} net_ipv6_mode_e; -``` - -Parameter|Description ----------|----------- -`NET_IPV6_BOOTSTRAP_STATIC`|Means that the application defines the IPv6 prefix. -`NET_IPV6_BOOTSTRAP_AUTONOMOUS`|Means that the network defines the IPv6 prefix. - -## RF 6LoWPAN interface configure definition - -This section defines the RF 6LoWPAN interface configuration. - -### typedef enum net_6lowpan_mode_e - -This enumeration defines the different 6LoWPAN bootstrap or device modes: - -``` -typedef enum net_6lowpan_mode_e -{ - NET_6LOWPAN_BORDER_ROUTER, - NET_6LOWPAN_ROUTER, - NET_6LOWPAN_HOST, - NET_6LOWPAN_SLEEPY_HOST - NET_6LOWPAN_NETWORK_DRIVER, - NET_6LOWPAN_SNIFFER - -} net_6lowpan_mode_e; -``` - -Parameter|Description ----------|----------- -`NET_6LOWPAN_BORDER_ROUTER`|Is a root device for 6LoWPAN ND. -`NET_6LOWPAN_ROUTER`|Is a router device. -`NET_6LOWPAN_HOST`|Is a host device. This is the default setting. -`NET_6LOWPAN_SLEEPY_HOST`|Is a sleepy host device. -`NET_6LOWPAN_NETWORK_DRIVER`|6LoWPAN radio host device only, no bootstrap. -`NET_6LOWPAN_SNIFFER`|Radio sniffer only, no bootstrap. - -The `NET_6LOWPAN_SLEEPY_HOST` mode support requires MLE protocol support. - -### typedef enum net_6lowpan_mode_extension_e - -This enumeration defines the different 6LoWPAN bootstrap extension modes: - -``` -typedef enum { - NET_6LOWPAN_ND_WITHOUT_MLE, - NET_6LOWPAN_ND_WITH_MLE, - NET_6LOWPAN_THREAD, - NET_6LOWPAN_ZIGBEE_IP -} net_6lowpan_mode_extension_e; -``` - -Parameter|Description ----------|----------- -`NET_6LOWPAN_ND_WITHOUT_MLE`|Starts the 6LoWPAN-ND bootstrap without MLE (Mesh link establishment protocol). -`NET_6LOWPAN_ND_WITH_MLE`|Starts 6LoWPAN-ND with MLE support. -`NET_6LOWPAN_THREAD`|Starts Thread with MLE. -`NET_6LOWPAN_ZIGBEE_IP`|Starts 6LoWPAN ZigBee-IP. - -### typedef struct network_driver_setup_s - -This structure defines the different 6LoWPAN radio interface setups: - -``` -typedef struct { - uint16_t mac_panid; - uint16_t mac_short_adr; - uint8_t beacon_protocol_id; - uint8_t network_id[16]; - uint8_t beacon_payload_tlv_length; - uint8_t *beacon_payload_tlv_ptr; /**< Optional Steering parameters */ -} network_driver_setup_s; -``` - -Member|Description -------|----------- -`mac_panid`|Link layer PAN ID. Accepted values are `<0xFFFE`. -`mac_short_adr`|Defines the IEEE 802.15.4 Short MAC address. If the value is `<0xFFFE`, it indicates that GP16 addresses are active. -`beacon_protocol_id`|Beacon protocol ID. ZigBee reserves the value 2. 6LoWPAN does not define any value for this, you can use any non-reserved value. -`network_id`|A 16-byte long network ID. Used in the beacon payload. -`beacon_payload_tlv_length`|The length of optional steering parameters. -`beacon_payload_tlv_ptr`|A pointer to the optional steering parameters. - -### typedef enum net_6lowpan_gp_address_mode_e - -This enumeration defines the different addressing modes for a network interface. This setting is specific to each interface and is only applicable to a 6LoWPAN interface. - -``` -typedef enum net_6lowpan_gp_address_mode_e -{ - NET_6LOWPAN_GP64_ADDRESS, - NET_6LOWPAN_GP16_ADDRESS, - NET_6LOWPAN_MULTI_GP_ADDRESS, -} net_6lowpan_gp_address_mode_e; -``` - -Parameter|Description ----------|----------- -`NET_6LOWPAN_GP64_ADDRESS`|Means that the interface will only register a GP64 address. This is the default setting. -`NET_6LOWPAN_GP16_ADDRESS`|Means that the interface will only register a GP16 address. -`NET_6LOWPAN_MULTI_GP_ADDRESS`|Means that the interface will register both GP16 and GP64 addresses. - -The default address mode is `NET_6LOWPAN_GP64_ADDRESS`. - -### typedef enum net_6lowpan_link_layer_sec_mode_e - -This enumeration defines the security mode for an interface. This setting is specific to each interface and is only applicable to 6LoWPAN interfaces. - -``` -typedef enum net_6lowpan_link_layer_sec_mode_e -{ - NET_SEC_MODE_NO_LINK_SECURITY, - NET_SEC_MODE_PSK_LINK_SECURITY, - NET_SEC_MODE_PANA_LINK_SECURITY, -} net_6lowpan_link_layer_sec_mode_e; -``` - -Parameter|Description ----------|----------- -`NET_SEC_MODE_NO_LINK_SECURITY`|Means that the security is disabled at a link layer. This is the default setting. -`NET_SEC_MODE_PSK_LINK_SECURITY`|Means that a PSK key defines the link security. -`NET_SEC_MODE_PANA_LINK_SECURITY`|Means that PANA network authentication defines the link key. The client must call `arm_pana_client_library_init()` and the border router application `arm_pana_server_library_init()` to initialize the PANA protocol. The PANA Network API could be disabled by some of the stack packets and it is also possible that it only supports client mode. - -The default setting is `NET_SEC_MODE_NO_SECURITY`. - -### typedef struct net_link_layer_psk_security_info_s - -This structure defines the PSK security information and comprises the following members: - -``` -typedef struct net_link_layer_psk_security_info_s -{ - uint8_t key_id; - uint8_t security_key[16]; -} net_link_layer_psk_security_info_s; -``` - -Member|Description -------|----------- -`key_id`|PSK key ID of a link layer. Can be `0x01-0xFF`. -`security_key`|Defines the 128-bit PSK key of a link layer. - -### typedef struct border_router_setup_s - -This structure defines the information required to set up a 6LoWPAN border router and comprises the following members: - -``` -typedef struct border_router_setup_s -{ - uint8_t channel; - uint16_t mac_panid; - uint16_t mac_short_adr; - uint8_t beacon_protocol_id; - uint8_t network_id[16]; - uint8_t lowpan_nd_prefix[8]; - uint16_t ra_life_time; - uint32_t abro_version_num; -} border_router_setup_t; -``` - -Member|Description -------|----------- -`channel`|Defines the channel used in 802.15.4 radio. Supported values are from 1 to 26. -`mac_panid`|Link layer PAN ID. Accepted values are `<0xFFFE`. -`mac_short_adr`|Defines IEEE 802.15.4 Short MAC address. If value is `<0xFFFE`, it indicates that GP16 addresses are active. -`beacon_protocol_id`|Beacon protocol ID. ZigBee reserves the values from `0` to `2`. 6LoWPAN does not define any value for this, you can use any non-reserved value. -`network_id`|A 16-byte long network ID. Used in the beacon payload. -`lowpan_nd_prefix`|Defines the ND default prefix, ABRO, DODAG ID, and GP address. -`ra_life_time`|Defines the ND router lifetime in seconds. ARM recommends value 180+. -`abro_version_num`|Defines the ND ABRO version number (0 when starting a new ND setup). - -## General network type definitions - -This section defines general network layer types defined by the Network API. - -### typedef enum net_security_t - -This enumeration defines the information required to set up an id that represents a network interface and comprises the following parameters: - -``` -typedef enum net_security_t { - NW_NO_SECURITY = 0, - NW_SECURITY_LEVEL_MIC32 = 1, - NW_SECURITY_LEVEL_MIC64 = 2, - NW_SECURITY_LEVEL_MIC128 = 3, - NW_SECURITY_LEVEL_ENC = 4, - NW_SECURITY_LEVEL_ENC_MIC32 = 5, - NW_SECURITY_LEVEL_ENC_MIC64 = 6, - NW_SECURITY_LEVEL_ENC_MIC128 = 7 -} net_security_t; - -``` - -Parameter|Description ----------|----------- -`NW_NO_SECURITY`|Disables network level security. -`NW_SECURITY_LEVEL_MIC32`|Enables 32-bit Message Integrity Code (MIC) verification without encoding. -`NW_SECURITY_LEVEL_MIC64`|Enables 64-bit MIC verification without encoding. -`NW_SECURITY_LEVEL_MIC128`|Enables 128-bit Message Integrity Code (MIC) verification without encoding. -`NW_SECURITY_LEVEL_ENC`|Enables AES encoding without MIC. -`NW_SECURITY_LEVEL_ENC_MIC32`|Enables AES encoding with 32-bit MIC. -`NW_SECURITY_LEVEL_ENC_MIC64`|Enables AES encoding with 64-bit MIC. -`NW_SECURITY_LEVEL_ENC_MIC128`|Enables AES encoding with 128-bit MIC. - diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/10_API_timer.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/10_API_timer.md index fa61fcf72a..146d7ec109 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/10_API_timer.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/10_API_timer.md @@ -2,7 +2,11 @@ Library Timer API ================= This chapter describes the timer functionality. -If an application requires a timer, it can allocate one with the `eventOS_event_timer_request( )` function. Further to a successful allocation, the system timer event occurs. +If an application requires a timer, it can allocate one with the `eventOS_event_timer_request_in( )` family of functions. Further to a successful allocation, the system timer event occurs. + +Times are specified in ticks, which are currently 10ms, but use macros and converter functions in the header to avoid depending on this. + +See the [Eventing API](08_API_events.md) chapter for more detail on events. **Note**: The library supports dynamic timer count at the application layer. The stack can multiplex a single timer for multiple purposes. @@ -12,57 +16,167 @@ To use Library Timer API, include the following header in your application: ``` #include eventOS_event_timer.h -``` +``` + +## Read the current time + +To read the current time: + +``` +uint32_t eventOS_event_timer_ticks(void) +``` + +
+
Return value
+
Current time in ticks.
+
## Allocate timer To allocate timer events: ``` -int8_t eventOS_event_timer_request +arm_event_storage_t *eventOS_event_timer_request_at ( - uint8_t snmessage, - uint8_t event_type, - int8_t tasklet_id, - uint32_t time + const arm_event_t *event + unt32_t at ) ``` Parameter|Description ---------|----------- -`snmessage`|The timer ID defined by the application. -`event_type`|The event type to be sent to a tasklet when the timer expires. Usually `ARM_LIB_SYSTEM_TIMER_EVENT`. -`tasklet_id`|The tasklet ID of the event receiver. -`time`|The requested period in milliseconds. Resolution is 10ms. +`event`|A pointer to an event to be sent. +`at`|The time to send the event.
Return value
-
0 If timer allocation was successful.
-
-1 If timer allocation failed.
+
A pointer to event structure, if the timer allocation was successful.
+
NULL if the timer allocation failed.
-Further to the allocated time period, the event OS library will transmit an event of which the sender, event type `(event->event_type)` and `event->event_id`, is indicating allocated timer identification. +At the specified time, the event OS library will transmit the specified event. -## Release timer +``` +arm_event_storage_t *eventOS_event_timer_request_in +( + const arm_event_t *event + int32_t in +) +``` -To cancel allocated timer events: +Parameter|Description +---------|----------- +`event`|A pointer to an event to be sent. +`in`|The requested period in ticks. + +
+
Return value
+
A pointer to event structure, if the timer allocation was successful.
+
NULL if the timer allocation failed.
+
+ +Within the chosen time period, the event OS library will transmit the specified event. Requesting two ticks means that +the event will trigger on the second tick from now. The elapsed time between requesting and sending is 1-2 ticks. + +``` +arm_event_storage_t *eventOS_event_timer_request_after +( + const arm_event_t *event + int32_t after +) +``` + +Parameter|Description +---------|----------- +`event`|A pointer to an event to be sent. +`after`|The requested period in ticks. + +
+
Return value
+
A pointer to event structure, if the timer allocation was successful.
+
NULL if the timer allocation failed.
+
+ +Within the chosen time period, the event OS library will transmit the specified event. Requesting two ticks means +the event will trigger on the second tick from now. The elapsed time between requesting and sending is 1-2 ticks. + +``` +arm_event_storage_t *eventOS_event_timer_request_every +( + const arm_event_t *event + int32_t every +) +``` + +Parameter|Description +---------|----------- +`event`|A pointer to an event to be sent. +`every`|The requested period in ticks. + +
+
Return value
+
A pointer to event structure, if the timer allocation was successful.
+
NULL if the timer allocation failed.
+
+ +Every chosen time period, the event OS library will transmit the specified event. + +## Cancel timer + +To cancel allocated timer id: ``` int8_t eventOS_event_timer_cancel ( - uint8_t snmessage, + uint8_t event_id, int8_t tasklet_id ) ``` Parameter|Description ---------|----------- -`snmessage`|The timer ID of the event to be cancelled. +`event_id`|The event ID of the event to be cancelled. `tasklet_id`|The tasklet ID of the event receiver.
Return value
-
0 If timer release was successful.
-
-1 If timer release failed, timer ID is invalid or the timer is already released.
+
0 If the timer cancellation was successful.
+
-1 If the timer cancellation failed, timer ID is invalid or the timer is already released.
+To cancel an periodic event or event by its `arm_event_storage_t *` reference, use `eventOS_cancel()` API. Refer to [Eventing API](08_API_events.md). + +## Millisecond timeout API + +Timeout API provides simpler API for calling functions periodically or after a timeout. + +Two forms of timeouts are provided, periodic one and single-shot. +``` +timeout_t *eventOS_timeout_ms(void (*callback)(void *), uint32_t ms, void *arg); +timeout_t *eventOS_timeout_every_ms(void (*callback)(void *), uint32_t every, void *arg); +``` + +Parameter|Description +---------|----------- +`callback`|A pointer to the function to be called. +`ms` or `every`|The timeout or period in milliseconds. +`arg`|An argument to be used in the function call. + +
+
Return value
+
Reference to timeout structure.
+
NULL on failure.
+
+ +The `timeout_t` reference can be used to cancel an event before it has happened, or to cancel an periodically called event. + +After a single shot event, or after cancelling the periodic one, the reference to `timeout_t` is invalid and should not be used. + +To cancel the event, use: + +``` +void eventOS_timeout_cancel(timeout_t *t); +``` +Where `timeout_t *t` is the reference returned to you by `eventOS_timeout_ms()` or `eventOS_timeout_every_ms()`. + +After cancelling the event, the handle is internally freed and becomes invalid and should not be used. diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/12_API_network.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/12_API_network.md index 553a005912..864fca2b2b 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/12_API_network.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/12_API_network.md @@ -233,143 +233,111 @@ Two hopping modes: By default, the 6LoWPAN stack uses the single channel mode. -To enable the FHSS mode: +To enable the FHSS mode, FHSS instance must be created, configured and registered to software MAC instance. + +Create FHSS instance and set basic configuration using: ``` -int8_t arm_fhss_enable +fhss_api_t *ns_fhss_create ( - int8_t interface_id, - fhss_platform_functions_s *fhss_platform_functions, - const fhss_configuration_s *fhss_configuration + const fhss_configuration_t *fhss_configuration, + const fhss_timer_t *fhss_timer, + fhss_statistics_t *fhss_statistics ) ``` -Parameter|Descripion ----------|---------- -`interface_id`|The network interface ID. -`fhss_platform_functions`|A pointer to the platform functions structure. -`fhss_configuration`|A pointer to the FHSS configuration structure. - -
-
Return value
-
0 on success.
-
-1 in case of invalid input parameters.
-
-2 if no channels are available in the channel list.
-
-3 if broadcast channels or tx slots are 0 in the bootstrap mode Border Router or RF access point.
-
-4 if number of super frames does not work with TX slots in the bootstrap mode Border Router or RF access point.
-
-5 if the FHSS tasklet creation fails.
-
-6 if the PHY driver mode cannot be changed.
-
-7 if the used bootstrap mode is not supported.
-
-8 if FHSS is already enabled.
-
-9 if memory allocation failed.
-
- -To implement and define the FHSS platform functions, use the `fhss_platform_functions_s` structure: - -``` -typedef struct -{ - int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(int8_t, uint16_t), int8_t); - int (*fhss_timer_stop)(void); - uint32_t (*fhss_get_remaining_slots)(void); - int (*fhss_time_measure_start)(void); - uint32_t (*fhss_time_measure_read)(void); - int (*fhss_time_measure_stop)(void); - uint8_t fhss_resolution_divider; -} fhss_platform_functions_s; -``` +Application developer must implement FHSS platform timer functions as described below. FHSS timer uses 1us resolution if not reduced by resolution divider. Member|Description ------|----------- -`fhss_timer_start`|FHSS timer start platform function. -`fhss_timer_stop`|FHSS timer stop platform function. -`fhss_get_remaining_slots`|FHSS timer get remaining slots platform function. -`fhss_time_measure_start`|FHSS time measure start platform function. -`fhss_time_measure_read`|FHSS time measure read platform function. -`fhss_time_measure_stop`|FHSS time measure stop platform function. -`fhss_resolution_divider`|FHSS timer resolution divider. +`fhss_timer_start` | FHSS timer start platform function. +`fhss_timer_stop` | FHSS timer stop platform function. +`fhss_get_remaining_slots` | FHSS timer get remaining slots platform function. +`fhss_get_timestamp` | FHSS timer timestamp (since initialization of driver). +`fhss_resolution_divider` | FHSS timer resolution divider. -FHSS configuration is always given from the border router using the `fhss_configuration_s` structure. The endpoint learns the configuration from the received synchronization message. In the initialization phase, the endpoint sets the FHSS configuration as NULL: - -``` -typedef struct fhss_configuration_s -{ - uint8_t fhss_number_of_bc_channels; - uint8_t fhss_number_of_tx_slots; - uint16_t fhss_superframe_length; - uint8_t fhss_number_of_superframes; - uint32_t fhss_beacon_send_interval; -} fhss_configuration_s; -``` +FHSS basic configuration is described below. Member|Description ------|----------- -`fhss_number_of_bc_channels`|Number of broadcast channels. -`fhss_number_of_tx_slots`|Number of TX slots per channel. -`fhss_superframe_length`|Superframe dwell time (us). -`fhss_number_of_superframes`|Number of superframes per channel. -`fhss_beacon_send_interval`|Interval of sending synchronization messages. This configuration is currently disabled. +`fhss_tuning_parameters` | Tuning parameters to enhance synchronization accuracy. +`fhss_max_synch_interval` | Maximum used interval for requesting synchronization info from FHSS parent device. +`fhss_number_of_channel_retries` | Number of channel retries. +`channel_mask` | Channel mask. -To disable the FHSS mode: - -``` -int8_t arm_fhss_disable -( - int8_t interface_id, -) -``` +Some platform-specific tuning parameters can be provided: Parameter|Description ---------|----------- -`interface_id`|The network interface ID. +`tx_processing_delay` | Delay between data pushed to PHY TX function and TX started (Contains CSMA-CA maximum random period). +`rx_processing_delay` | Delay between TX done (by transmitter) and received data pushed to MAC (by receiver). +`ack_processing_delay` | Delay between TX done (by transmitter) and Ack transmission started (by receiver). -
-
Return value
-
0 on success.
-
-1 on fail.
-
- -### FHSS tuning parameters - -When you have enabled FHSS, you can provide some platform-specific tuning parameters using the `arm_fhss_set_tuning_params` function: +FHSS synchronization configuration is always given from the border router using the `ns_fhss_configuration_set` function. The endpoint learns the configuration from the received synchronization message. ``` -int8_t arm_fhss_set_tuning_params +int ns_fhss_configuration_set ( - int8_t interface_id, - const fhss_platform_tuning_params_s *fhss_tuning_params + fhss_api_t *fhss_api, + const fhss_synch_configuration_t *fhss_synch_configuration ) ``` - -Parameter|Description ----------|----------- -`interface_id`|The network interface ID. -`fhss_tuning_params`|A pointer to the FHSS tuning parameters. - -
-
Return value
-
0 on success.
-
-1 on fail.
-
- -The FHSS device provides the tuning parameters using the `fhss_platform_tuning_params_s` structure: - -``` -typedef struct -{ - uint32_t synch_tx_processing_time; - uint32_t synch_rx_processing_time; - uint32_t data_tx_processing_time; - uint32_t data_rx_processing_time; -} fhss_platform_tuning_params_s; -``` +Synchronization configuration is described below: Member|Description ------|----------- -`synch_tx_processing_time`|Processing delay between synch info written and TX start (us). -`synch_rx_processing_time`|Processing delay between TX done and synch info read (us). -`data_tx_processing_time`|Processing delay between data pushed to driver and transmission started (us). -`data_rx_processing_time`|Processing delay between TX done and Ack TX start (us). +`fhss_number_of_bc_channels` | Number of broadcast channels. +`fhss_number_of_tx_slots` | Number of TX slots per channel. +`fhss_superframe_length` | Superframe dwell time (us). +`fhss_number_of_superframes` | Number of superframes per channel. + +Register created FHSS instance to software MAC instance using `ns_sw_mac_fhss_register` function: +``` +int ns_sw_mac_fhss_register +( + struct mac_api_s *mac_api, + struct fhss_api *fhss_api +) +``` + +FHSS implements following API which is used by higher layer (software MAC): + +Member|Description +------|----------- +`fhss_is_broadcast_channel` | Checks if current channel is broadcast channel. +`fhss_use_broadcast_queue` | Checks if broadcast queue must be used instead of unicast queue. +`fhss_tx_handle` | Set destination channel and write synchronization info. +`fhss_check_tx_conditions` | Check TX permission. +`fhss_receive_frame` | Notification of received FHSS synch or synch request frame. +`fhss_data_tx_done` | Data TX done callback. +`fhss_data_tx_fail` | Data TX or CCA failed callback. +`fhss_synch_state_set` | Change synchronization state. +`fhss_read_timestamp` | Read timestamp. +`fhss_get_retry_period` | Get retransmission period. +`fhss_init_callbacks` | Initialize MAC functions. + + +Software MAC implements following callbacks to serve requests from FHSS: + +Member|Description +------|----------- +`mac_read_tx_queue_size` | Read MAC TX queue size. +`mac_read_mac_address` | Read MAC address. +`mac_read_datarate` | Read PHY datarate. +`mac_change_channel` | Change channel. +`mac_send_fhss_frame` | Send FHSS frame. +`mac_synch_lost_notification` | Send notification when FHSS synchronization is lost. +`mac_tx_poll` | Poll TX queue. +`mac_broadcast_notify` | Broadcast channel notification from FHSS. +`mac_read_coordinator_mac_address` | Read coordinator MAC address. + +To disable FHSS, instance can be deleted using `ns_fhss_delete` function. +``` +int ns_fhss_delete +( + fhss_api_t *fhss_api +) +``` ### Beacon protocol ID filter @@ -1897,7 +1865,7 @@ To set new parameters for a trickle multicast: void multicast_set_parameters ( uint8_t i_min, - uint8_t i_max, + uint8_t i_doublings, uint8_t k, uint8_t timer_expirations, uint8_t window_expiration @@ -1907,7 +1875,7 @@ void multicast_set_parameters Parameter|Description ---------|----------- `i_min`|The minimum trickle timer interval (50ms resolution), so: `Imin = i_min * 50ms`. -`i_max`|The maximum trickle timer interval as number if doubling of minimum interval. +`i_doublings`|The maximum trickle timer interval expressed as number of doublings of minimum interval. `k`|A redundancy constant. `timer_expirations`|Number if trickle timer expires before terminating the trickle process. `window_expiration`|Time window state is kept after the trickle process has ended in 50ms resolution. diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/15_API_debug.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/15_API_debug.md index 0b5cbd2560..4dd0f9186d 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/15_API_debug.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/15_API_debug.md @@ -69,89 +69,88 @@ Various types of network stats can be collected using the structure `typedef str Member|Description ------|----------- -`mac_tx_buffer_overflow`|Provides a count MAC TX queue overflow. -`mac_tx_queue_size`|Current MAC TX queue size. -`mac_tx_queue_peak`|MAC TX queue peak size. -`mac_rx_count`|Number of received MAC packets. -`mac_tx_count`|Number of transmitted MAC packets. -`mac_bc_tx_count`|>Number of transmitted MAC broadcast packets. -`mac_rx_drop`|Number of dropped MAC packets. +`mac_tx_buffer_overflow` | Provides a count MAC TX queue overflow. +`mac_tx_queue_size` | Current MAC TX queue size. +`mac_tx_queue_peak` | MAC TX queue peak size. +`mac_rx_count` | Number of received MAC packets. +`mac_tx_count` | Number of transmitted MAC packets. +`mac_bc_tx_count` | >Number of transmitted MAC broadcast packets. +`mac_rx_drop` | Number of dropped MAC packets. ### MAC payload flow Member|Description ------|----------- -`mac_tx_bytes`|Number of bytes transmitted. -`mac_rx_bytes`|Number of bytes received. -`mac_tx_failed`|Number of times a transmission failed. -`mac_tx_retry`|Number of times retries were made. -`mac_tx_cca_cnt`|Number of times clear channel assessment was made. -`mac_tx_failed_cca`|Number of failed CCA attempts. -`mac_security_drop`|Number of security packets dropped. +`mac_tx_bytes` | Number of bytes transmitted. +`mac_rx_bytes` | Number of bytes received. +`mac_tx_failed` | Number of times a transmission failed. +`mac_tx_retry` | Number of times retries were made. +`mac_tx_cca_cnt` | Number of times clear channel assessment was made. +`mac_tx_failed_cca` | Number of failed CCA attempts. +`mac_security_drop` | Number of security packets dropped. ### FHSS related statistics Member|Description ------|----------- -`fhss_drift_compensation`|FHSS synchronization drift compensation (us/channel). -`fhss_hop_count`|FHSS hop count. -`fhss_synch_parent_rssi`|FHSS synchronization parent RSSI. -`fhss_synch_interval`|FHSS synchronization interval (s). -`fhss_prev_avg_synch_fix`|Average of 5 preceding synchronization fixes (us). -`fhss_synch_lost`|FHSS synchronization lost counter. +`fhss_drift_compensation` | FHSS synchronization drift compensation (us/channel). +`fhss_hop_count` | FHSS hop count. +`fhss_synch_interval` | FHSS synchronization interval (s). +`fhss_prev_avg_synch_fix` | Average of 5 preceding synchronization fixes (us). +`fhss_synch_lost` | FHSS synchronization lost counter. ### 6LoWPAN related statistics Member|Description ------|----------- -`ip_rx_count`|Number of IP packets received. -`ip_tx_count`|Number of IP packets transmitted. -`ip_rx_drop`|Number of IP packets dropped. -`ip_cksum_error`|IP checksum error count. +`ip_rx_count` | Number of IP packets received. +`ip_tx_count` | Number of IP packets transmitted. +`ip_rx_drop` | Number of IP packets dropped. +`ip_cksum_error` | IP checksum error count. ### IP payload flow Member|Description ------|----------- -`ip_tx_bytes`|Number of bytes transmitted as IP packets. -`ip_rx_bytes`|Number of bytes received as IP packets. -`ip_routed_up`|Number of bytes routed as IP packets. -`ip_no_route`|Number of times an IP route was not found. +`ip_tx_bytes` | Number of bytes transmitted as IP packets. +`ip_rx_bytes` | Number of bytes received as IP packets. +`ip_routed_up` | Number of bytes routed as IP packets. +`ip_no_route` | Number of times an IP route was not found. ### Fragmentation statistics Member|Description ------|----------- -`frag_rx_errors`|Fragmentation errors in reception. -`frag_tx_errors`|Fragmentation errors in transmission. +`frag_rx_errors` | Fragmentation errors in reception. +`frag_tx_errors` | Fragmentation errors in transmission. ### RPL statistics Member|Description ------|----------- -`rpl_route_routecost_better_change`|Number of times an RPL parent was changed. -`ip_routeloop_detect`|Number of times an RPL IP loop creation was detected. -`rpl_memory_overflow`|Total of allocations failed due RPL memory overflow. -`rpl_parent_tx_fail`|Number of times transmission to a DODAG parent failed. -`rpl_unknown_instance`|Number of times a packet was received with an unknown RPL Instance ID. -`rpl_local_repair`|Number of times local repair was initiated. -`rpl_global_repair`|Number of times global repair was initiated. -`rpl_malformed_message`|Number of malformed RPL messages received. -`rpl_time_no_next_hop`|Number of seconds spent with no RPL next hop. -`rpl_total_memory`|Total memory currently allocated by RPL. +`rpl_route_routecost_better_change` | Number of times an RPL parent was changed. +`ip_routeloop_detect` | Number of times an RPL IP loop creation was detected. +`rpl_memory_overflow` | Total of allocations failed due RPL memory overflow. +`rpl_parent_tx_fail` | Number of times transmission to a DODAG parent failed. +`rpl_unknown_instance` | Number of times a packet was received with an unknown RPL Instance ID. +`rpl_local_repair` | Number of times local repair was initiated. +`rpl_global_repair` | Number of times global repair was initiated. +`rpl_malformed_message` | Number of malformed RPL messages received. +`rpl_time_no_next_hop` | Number of seconds spent with no RPL next hop. +`rpl_total_memory` | Total memory currently allocated by RPL. ### Various buffers Member|Description ------|----------- -`buf_alloc`|A count of buffer allocation. -`buf_headroom_realloc`|A buffer headroom allocation count. -`buf_headroom_shuffle`|A buffer headroom shuffling count. -`buf_headroom_fail`|A buffer headroom failure count. +`buf_alloc` | A count of buffer allocation. +`buf_headroom_realloc` | A buffer headroom allocation count. +`buf_headroom_shuffle` | A buffer headroom shuffling count. +`buf_headroom_fail` | A buffer headroom failure count. ### ETX statistics Member|Description ------|----------- -`etx_1st_parent`|Primary parent ETX. -`etx_2nd_parent`|Secondary parent ETX. +`etx_1st_parent` | Primary parent ETX. +`etx_2nd_parent` | Secondary parent ETX. diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/17_API_load_balancer.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/17_API_load_balancer.md new file mode 100644 index 0000000000..f6f3c053af --- /dev/null +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/17_API_load_balancer.md @@ -0,0 +1,279 @@ +The Load balancing API +================== + +This chapter describes the functions of the load balancing layer. It contains the following sections: + +- [_Load balancing API_](#load-balancing-api) +- [_Load balancing activity diagram_](#load-balancing-activity-diagram) + +## API header + +To use the Load balancing API, include the following header: + +``` +#include "net_load_balance_api.h" +``` + +## Load balancing API + +This section describes the functions of the load balancing layer where each function is presented with its valid parameters. + +**Table 1-1 The load balancing API features and related functions** + +Feature|API function +-------|------------ +Load balancer creation|`net_load_balance_create()` +Load balancer deletion|`net_load_balance_delete()` +Callback function type definition|`net_load_balance_network_switch_notify()` +Callback setting function|`net_load_balance_network_switch_cb_set()` +Load balancer thresholds setter function|`net_load_balance_threshold_set()` +Load balancer maximum probability setter function|`net_load_balance_set_max_probability()` +Load level automatic update enabling|`net_load_balance_load_level_update_enable()` +Load level automatic update disabling|`net_load_balance_load_level_update_disable()` + +### Create load balancer + +Periodic beacon interval can be used to speed up the load balancing feature. The suggested value is `True`. Beacon sending interval is (usually) very long to prevent flooding in network. + +To enable the load balancer feature, use the following function: + +``` +int8_t net_load_balance_create +( + int8_t interface_id, + bool enable_periodic_beacon_interval +) +``` + +Where: +
+
interface_id
+
The network interface ID.
+ +
enable_periodic_beacon_interval
+
Beacon interval is calculated from RPL config (Imax of the RPL DIO timer).
+
True: The load balancing device advertises the network by sending periodic beacons.
+
False: The load balancing is based on devices hearing beacons from other networks.
+ +
Return value
+
0 Creation OK.
+
-1 An unknown interface ID.
+
-2 Out of memory.
+
-3 Load balancing already active for this interface ID.
+
+ +### Delete load balancer + +To delete the load balancer, use the following function: + +``` +int8_t net_load_balance_delete +( + int8_t interface_id +) +``` + +Where: +
+
interface_id
+
The network interface ID.
+ +
Return value
+
0 Delete OK.
+
-1 An unknown interface ID.
+
+ +### Callback function + +To define a callback function for selecting whether a network switch is allowed or not, use the following `typedef`: + +``` +typedef bool net_load_balance_network_switch_notify +( +) +``` + +Where: +
+
Return value
+
True: Network change is allowed.
+
False: Network change is not allowed.
+
+ +An example of a callback: + +``` +bool my_decision(int8_t interface_id) +{ + if (is_ok_to_change) { + return true; + } + return false; +} +``` + +### Use the callback + +**Note:** If the callback is not set, the load balancer changes the network automatically and the application only gets `ARM_LIB_NWK_INTERFACE_EVENT` with `event_id` of either `ARM_NWK_BOOTSTRAP_READY` or some error. + +To use the callback, use the following function: + +``` +int8_t net_load_balance_network_switch_cb_set +( + int8_t interface_id, + net_load_balance_network_switch_notify *network_switch_notify +) +``` + +Where: +
+
interface_id
+
The network interface ID.
+ +
network_switch_notify
+
The callback function to be called when the load balancer is about to start the network change sequence.
+ +
Return value
+
0 Set OK.
+
-1 An unknown interface id.
+ +
+ +### Set the network threshold values + +Threshold is used to limit the network changes. The difference between networks is calculated using joining priorities from network data. If the difference is less than the minimum threshold, the network change is never allowed. However, if the difference is more than the maximum threshold, the device does not necessarily change the network. Instead, the maximum probability will be used. This is described in the subsequent function description. + +``` +if diff <= threshold_min: no change +else if diff >= threshold_max: probability = max_probability +else probability = (diff/(threshold_max-threshold_min))*max_probability +``` +**Note:** Suggested values are 32-64 for min and 64-96 for max. The border router must set both values to zero. + +To set the network threashold values, use the following function: + +``` +int8_t net_load_balance_threshold_set +( + int8_t interface_id, + uint8_t threshold_min, + uint8_t threshold_max +) +``` + +Where: +
+
interface_id
+
The network interface ID.
+ +
threshold_min
+
The minimum difference needed between networks to allow network change.
+ +
threshold_max
+
The minimum difference needed to reach max probability (see net_load_balance_set_max_probability).
+ +
Return value
+
0 Set OK.
+
-1 An unknown interface ID.
+
+ +### Set the network change max probability + +Maximum probability is used to prevent all devices from changing network when they hear a better one. There is a specific timeout before which the network statistics are changed to all nodes in the network (depending on the hop count of nodes). If all devices changed the network, that could cause some unwanted churn. The max probability value is very much dependent on the size of the actual networks. The suggested value is between 10 and 25. The lower the value, the slower the balancing of network loads. If the value was 99 it would cause the devices to switch the networks very agressively (depending on the threshold values). The default value 25 is suitable for two-hop networks. + +To set the maximum probability for a device to change the network, use the following function: + +``` +int8_t net_load_balance_set_max_probability +( + int8_t interface_id, + uint8_t max_p +) +``` + +Where: +
+
interface_id
+
The network interface ID.
+ +
max_p
+
The maximum probability for a device to change the network. The default value is 25(%).
+ +
Return value
+
0 Set OK.
+
-1 An unknown interface ID.
+
+ +### Set automatic calculation of DoDAG preference for the border router + +**Note:** This function should not do anything if the device is not a border router! + +To set automatic calculation of DoDAG preference for the border router, use the following function: + +``` +int8_t net_load_balance_load_level_update_enable +( + int8_t interface_id, + uint16_t expected_device_count +) +``` + +Where: +
+
interface_id
+
The network interface ID.
+ +
expected_device_count
+
Device count when DoDAG preference goes to worst possible.
+ +
Return value
+
0 Set OK.
+
-1 An unknown interface ID.
+
-2 Out of memory.
+
+ +### Disable automatic calculation of DoDAG preference for the border router + +**Note:** This function should not do anything if the device is not a border router! + +To disable automatic calculation of DoDAG preference for the border router, use the following function: + +``` +int8_t net_load_balance_load_level_update_disable +( + int8_t interface_id +) +``` + +Where: +
+
interface_id
+
The network interface ID.
+ +
Return value
+
0 Disable OK.
+
-1 An unknown interface ID.
+
+ +## Load balancing activity diagram + +Here is the activity diagram of the load balancer: + +![nw-arc](img/load_balancer_activity_diagram.png) + +Where: + +1. Idle state indicates that a device has joined a network having `PanID=1` and the device is doing "normal" operations. +2. `nwk_id` check is mandatory to prevent joining a wrong network. +3. The load balancer is handling incoming beacons and deciding whether the device should change the network. +4. If the load balancer is in block period, no beacons are handled. +5. The difference is calculated by comparing the priority values of the networks. +6. If the difference is less than the minimum threshold, the network change is not possible and the load balancer goes to block period state. +7. The possibility is calculated by counting a linear probability multiplier (0..1) between the minimum and maximum threshold. If the network difference is higher than the maximum, the multiplier is 1. The multiplier is then multiplied with the maximum probability to get the possibility for the network change. +8. A random value is generated and if it is higher than the probability, the load balancer goes to block state. Otherwise, the load balancer goes to waiting state. +9. `Waiting for better beacons` is the active state of the load balancer, when a device is given a chance to hear better beacons. After a timeout period, the load balancer continues to the next state. +10. In the `Query change from App` state, the application's callback function (if set) is called and if the returned value is false, the load balancer goes to block state. Otherwise, it continues to the change network state. +11. The load balancer has got a permission to change the network. The sequence for the change starts. + + diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/api_changes_to_v4_1_0.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/api_changes_to_v4_1_0.md new file mode 100755 index 0000000000..5621d23189 --- /dev/null +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/api_changes_to_v4_1_0.md @@ -0,0 +1,128 @@ +# About this document + +This document walks you through the API changes in the Nanostack version 4.1.x in detail and helps you to update your current applications to use the new and changed APIs. + +**New APIs:** + +- Load balancing +- Whiteboard API + +**Changed APIs:** + +- FHSS platform API +- eDTLS API +- dev_stat API + + +## [**Load balancing**](17_API_load_balancer.md) + +Load balancing (LB) is a new feature to allow devices to switch from a loaded network into a better one. Load balancing operates with given rules and developer(s) SHOULD NOT try to aim at evenly balanced networks (might cause churn). + +To enable this feature, use the build time flag `HAVE_6LOWPAN_ND`. + +The new LB functions are presented briefly here: + +- `typedef bool net_load_balance_network_switch_notify(int8_t interface_id);` + + Typedef of a callback function, that you can implement to control network switching. If you do not implement this, the network switch takes place automatically when applicable. + +- `void net_load_balance_network_switch_cb_set(net_load_balance_network_switch_notify *network_switch_notify);` + + A setter function to set (/unset with NULL) a callback function, which is called when the system has found a better network to join. + +- `int8_t net_load_balance_create(int8_t interface_id, bool enable_periodic_beacon_interval);` + + Creates and enables the load balancing feature. + +- `int8_t net_load_balance_delete(int8_t interface_id);` + + Deletes and disables the load balancing feature. + +- `int8_t net_load_balance_threshold_set(int8_t interface_id, uint8_t threshold_min, uint8_t threshold_max);` + + A setter for a threshold to control when a device can change the network. The difference (diff) of networks is counted. If the diff is smaller than the minimum treshold, nothing happens. If the diff is greater than or equal with the max threshold, the default or set probability value is used. Otherwise, min and max values affect the switch probability: + + - If the diff is close to min -> very poor chance to switch. + - If the diff is close to max --> almost the same probability as is set. + + See `net_load_balance_set_max_probability` below for more details. + +- `int8_t net_load_balance_set_max_probability(int8_t interface_id , uint8_t max_p);` + + A setter for maximum probability for a device will switch the network. The proposed value is between 10 and 25 to prevent all devices from switching network at the same time (the default value is 25). Also a block period is activated if the device fails to change the network (this is automatic). Threshold minimum and maximum will add more probability on top of this and therefore, this value can be thought only as a maximum probability for switching. + +- `int8_t net_load_balance_load_level_update_enable(int8_t interface_id, uint16_t expected_device_count);` + + This needs the build time flag `HAVE_RPL`. + + **Note:** Border router (BR) feature only! Enables automatic updates of the DODAG preference, which is used to measure the quality of a network. The expected device count is calculated by network designer to set the number of devices this BR should connect. This is not a hard limit, it just tells when the designed device count has been reached! + +- `int8_t net_load_balance_load_level_update_disable(int8_t interface_id);` + + This needs the build time flag `HAVE_RPL`. + + **Note:** Border router feature only! Disables automatic updates of DODAG preference. Also disables measurement of expected device count. + +## Whiteboard API + +Whiteboard API is used to limit the number of devices allowed to join to network. + +To enable this feature, use the build time flag `WHITEBOARD`. + +The limit is needed in situations where one BR goes down and the devices connected to it start to find another networks. This can cause other BRs to have out-of-memory (OOM) situations, if there are lots of connected devices. When the limit is reached, the BR will not accept any new connection(s). If set to 0, there is no limit. + +`void whiteboard_set_device_hard_limit(uint16_t limit);` + +## Frequency-hopping Spread Spectrum (FHSS) + +### FHSS platform API + +FHSS platform API was simplified in this version of Nanostack. The FHSS time measurement functions were removed and replaced with the timestamp callback. + +See the instructions below to fix any conflicts: + +Remove the time measure callbacks from the FHSS platform function structure and replace them with the timestamp read callback: + + static fhss_platform_functions_s fhss_functions = { + &fhss_timer_start, + &fhss_timer_stop, + &fhss_timer_get_remaining_slots, + + &fhss_timestamp_read, + - &fhss_time_measure_start, + - &fhss_time_measure_read, + - &fhss_time_measure_stop, + RESOLUTION_DIVIDER + }; + +Remove also corresponding time measure functions from the driver as they are not needed anymore. + +The new timestamp callback function must be implemented: + + uint32_t fhss_timestamp_read(void) + { + . + . + . + return timestamp; + } + +The timestamp function must return a 32-bit timestamp value with 1us resolution (if resolution divider is not used). The return value is time since the FHSS driver was started and a 32-bit counter is allowed to overflow. + +## eDTLS API update + +### eDTLS connection status update and sn_edtls_exec() call guidance + +The eDTLS library calls the connection status callback by `EDTLS_ECC_CALCULATING` when it starts the ECC calculation. When ECC is started, the application should call the `sn_edtls_exec()` function rapidly to trigger a new event until the connection status gives `EDTLS_ECC_CALCULATION_READY`. This status means that callbacks to `sn_edtls_exec()` can be stopped. + +The `sn_edtls_exec()` function should be called periodically using one second interval with the updated timer value, which triggers the re-transmission of the eDTLS library when needed. The `sn_edtls_exec()` should also be called when the eDTLS library has parsed the handshake message successfully (`sn_edtls_parse_data` returns 0). When the eDTLS callback has status `EDTLS_CONNECTION_OK`, `EDTLS_CONNECTION_CLOSED` or `EDTLS_CONNECTION_FAILED`, the periodical timer can be stopped until a new connection is started by the `sn_edtls_connect()` function. + +## dev_stats_api API update + +The `dev stats_api.h` file has been removed which means that the following functions are not available anymore: + +- `dev_stat_internal_init()` +- `dev_stat_get_longest_heap_sector()` +- `dev_stat_get_runtime_seconds()` + +The heap stats are still available when the `ns_dyn_mem_init()` call `info_pr` is defined. (`nsdynMEMLIB.h`) + diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/dev_stats.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/dev_stats.md deleted file mode 100644 index ed0ae50b99..0000000000 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/dev_stats.md +++ /dev/null @@ -1,57 +0,0 @@ -# Device statistics - -## dev_stat_internal_init - -To start collecting device statistics within the device statistics structure: - -``` -int8_t dev_stat_internal_init -( - dev_stat_t *info_ptr -) -``` - -Parameter|Description ----------|----------- -`info_ptr`|A pointer to the device statistics structure on application. - -
-
Return value
-
0 Success.
- -
-1 Fail.
-
- - -### dev_stat_get_longest_heap_sector - -The following function call returns the longest available free sector size in the 6LoWPAN stack dynamic memory: - -``` -int16_t dev_stat_get_longest_heap_sector -( - void -) -``` - -
-
Return value
-
The size of the longest free sector.
-
- - -### dev_stat_get_runtime_seconds - -The following function call returns the runtime since last reset: - -``` -uint32_t dev_stat_get_runtime_seconds -( - void -) -``` - -
-
Return value
-
The runtime since last reset.
-
diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/img/load_balancer_activity_diagram.png b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/img/load_balancer_activity_diagram.png new file mode 100755 index 0000000000..ccb8fe8982 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/img/load_balancer_activity_diagram.png differ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/img/thread_certified.png b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/img/thread_certified.png new file mode 100644 index 0000000000..c86ee53a7e Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/img/thread_certified.png differ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/thread_dev_typ.md b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/thread_dev_typ.md index 5d814507a3..bb5be93db6 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/thread_dev_typ.md +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/docs/thread_dev_typ.md @@ -1,45 +1,60 @@ Thread network device types and roles ============ -## Device types +There are different device types and roles in the Thread network. mbed OS offers own builds or configurations to different Thread device types and roles. -The different device types within a Thread network are described in the subsequent sections. +## End devices -### Border routers +Usually, end devices are the most constrained devices in the Thread network. They serve as a last hop in the mesh topology. Devices such as plain sensors, controls and switches can be implemented as end devices only. The different types of end devices are described in the following sections. -A border router is a specific type of a router that provides connectivity from the 802.15.4 network to adjacent networks on other physical layers (for example, WiFi and Ethernet). Border routers provide services for devices within the 802.15.4 network, including routing services for off-network operations. There may be one or more border routers in a Thread network. +### Full end device (FED) -### Routers +A Thread host device that communicates through the parent device, but has the least constraints to the parent. A FED makes address queries and listens to multicast messages. -Routers provide routing services to network devices. Routers also provide joining and security services for devices trying to join the network. They are not designed to sleep and they can downgrade their functionality and become Router-eligible End Devices (REED). +### Minimal end device (MED) -### Router-eligible end devices (REED) +A Thread host device type that registers its addresses to the parent leaving all routing and address queries to be done by the parent. -REEDs have the capability to become Routers but due to the network topology or conditions these devices are not acting as Routers. These devices do not generally forward messages or provide joining or security services for other devices in the Thread network. The Thread network manages REEDs becoming Routers if necessary without user interaction. +### Sleepy end device (SED) -### Sleepy end devices +A Thread host device that is similar to the minimal end device, but does not keep the radio on all the time. It uses the polling mechanism to receive packets from the parent. Requires parents to store the packets. -Sleepy end devices are host devices. They communicate only through their Parent Router and cannot forward messages for other devices. +## Routers + +Routers provide routing services to the network devices. Routers also provide joining and security services for devices trying to join the network. + +A router always attaches to the Thread network as a Router Eligible End Device (REED). REEDs do not forward messages or provide any joining or security services for other devices in the Thread network. The Thread network manages REEDs becoming routers (or vice versa) if necessary without user interaction. ## Roles -Devices participating in a Thread network can take up various roles depending upon their type and configuration of the Thread network join process. A Thread network join process is called as Thread Commissioning. The different roles Thread devices are described in the subsequent sections. +Devices participating in a Thread network can take up various roles depending upon their device type and the Thread network join process configuration. The Thread network join process is called Thread Commissioning. The different roles of Thread devices are described in the subsequent sections. + +### Border router + +A border router is a specific type of a router that provides connectivity from the Thread network to adjacent networks on other physical layers (for example, WiFi and Ethernet). Border routers provide services for devices within the 802.15.4 network, including routing services for off-network operations. There may be one or more border routers in a Thread network. ### Commissioner -The currently elected authentication server for new Thread devices and the authority for providing the network credentials required to join the network. A device capable of being elected as a commissioner is called a commissioner candidate. Devices without Thread interfaces may perform this role, but the ones with a Thread interface may combine this role with all other roles except the Joiner. For example, a Border Router can perform the role of commissioner. This device may be, for example, a cell phone or a server in the cloud, and typically provides the interface by which a human administrator manages the joining of a new device to the Thread network. +The currently elected authentication server for new Thread devices and the authority for providing the network credentials required to join the network. A device capable of being elected as a commissioner is called a commissioner candidate. Devices without Thread interfaces may perform this role, but the ones with a Thread interface may combine this role with all other roles except the Joiner. For example, a border router can perform the role of commissioner. This device may be, for example, a cell phone or a server in the cloud, and typically provides the interface by which a human administrator manages the joining of a new device to the Thread network. ### Joiner -Joiner is a device to be added by a human administrator or generally a device needed to be commissioned for the Thread network. This role requires a Thread interface and cannot be combined with any other role in a single device. A joiner does not have network credentials. +A joiner is a device to be added by a human administrator or generally a device needed to be commissioned for the Thread network. This role requires a Thread interface and cannot be combined with any other role in a single device. A joiner does not have network credentials. -### Joiner Router +### Joiner router -Joiner Router is an existing Thread Router or a REED on the secure Thread network that is one radio hop away from the joiner. A Joiner Router requires a Thread interface to operate, and may be combined in any device with other roles except the joiner role. +A joiner router is an existing Thread router or a REED on the secure Thread network that is one radio hop away from the joiner. A Joiner router requires a Thread interface to operate, and may be combined in any device with other roles except the joiner role. -### Thread Leader +### Thread leader -Thread Leader is a device responsible for managing router ID assignment. It is a single distinguished device in any Thread network that currently acts as a central arbiter for the network configuration. A Leader requires a Thread interface and may be combined in any device with other roles except the joiner. +A Thread leader is one of the routers that has formed the network and takes the following additional responsibilities on top of the router responsibilities. The first router on a network becomes a leader. + +* Managing router ID assignment. +* Thread network data registration and distribution. +* Commissioner petition. +* Accepting and distributing Thread configurations to the rest of the network. + +Thread leader is a single distinguished device in any Thread network, acting as a central arbiter for the network configuration. **Figure 2-2 General Thread Network** diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/mkdocs.yml b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/mkdocs.yml index c9de12fcf3..d4bf00b6bf 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/mkdocs.yml +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/mkdocs.yml @@ -25,6 +25,7 @@ pages: - ['08_API_events.md', 'API Reference Manual','Event-driven Scheduling Model & Eventing API'] - ['09_API_network_def.md','API Reference Manual', 'Network Definition APIs'] - ['12_API_network.md','API Reference Manual', 'Network Layer Control APIs'] +- ['17_API_load_balancer.md','API Reference Manual','Load balancing API'] - ['10_API_timer.md','API Reference Manual', 'Library Timer API'] - ['11_API_sockets.md','API Reference Manual', 'Socket API'] - ['13_API_memory.md','API Reference Manual', 'Dynamic Memory API'] @@ -32,3 +33,5 @@ pages: - ['15_API_debug.md','API Reference Manual', 'Network Debug Statistics API'] - ['thread_APIs.md','API Reference Manual', 'Thread Stack APIs'] - ['16_API_porting.md','Porting a new platform to ARM mbed Networking Stack', 'Porting to the Stack'] + +copyright: © ARM Ltd. Copyright 2016 – ARM mbed IoT Device Platform diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/cca_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/cca_api.h index 1f1cef5c0a..64564353f3 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/cca_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/cca_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ccmLIB.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ccmLIB.h index 6dbb0f54d9..82e0d45819 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ccmLIB.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ccmLIB.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/dev_stat_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/dev_stat_api.h deleted file mode 100644 index c66c86f113..0000000000 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/dev_stat_api.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. - * - * SPDX-License-Identifier: LicenseRef-PBL - * - * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.mbed.com/licenses/PBL-1.0 - * - * See the License for the specific language governing permissions and limitations under the License. - * - */ -/** - * \file dev_stat_api.h - * \brief 6LowPAN library device statistics API - * - * - dev_stat_internal_init(), Enable stats update. - * - dev_stat_get_longest_heap_sector(), Get longest free sector. - * - dev_stat_get_runtime_seconds(), Get system runtime in seconds. - * - */ -#ifndef _DEV_STAT_API_H -#define _DEV_STAT_API_H - -#include "ns_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * /struct dev_stat_t - * /brief Struct for device stats buffer structure. - */ -typedef struct dev_stat_t { - /*Heap stats*/ - int16_t heap_sector_size; /**< Heap total sector length. */ - int16_t heap_sector_alloc_cnt; /**< Reserved heap sector count. */ - int16_t heap_sector_allocated_bytes; /**< Reserved heap data in bytes. */ - int16_t heap_sector_allocated_bytes_max; /**< Reserved heap data in bytes max value. */ - uint32_t heap_alloc_total_bytes; /**< Total heap allocated bytes. */ - uint32_t heap_alloc_fail_cnt; /**< Counter for heap allocation fail. */ -} dev_stat_t; - -/** - * \brief Enable device stats collection. - * - * \param info_ptr Static pointer where the stack updates device stat. - * - * \return 0, Init OK. - * \return -1, Null pointer parameter detected. - * - */ -extern int8_t dev_stat_internal_init(dev_stat_t *info_ptr); -/** - * \brief Get current longest free sector. - * - * - * \return Signed 16-bit length for longest sector size. - * - */ -extern int16_t dev_stat_get_longest_heap_sector(void); -/** - * \brief Get system runtime in seconds. - * - * - * \return Signed 16-bit length for longest sector size. - * - */ -extern uint32_t dev_stat_get_runtime_seconds(void); -#ifdef __cplusplus -} -#endif -#endif diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/dhcp_service_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/dhcp_service_api.h index 72c7345486..3515a18f6c 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/dhcp_service_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/dhcp_service_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015 ARM Limited. All rights reserved. + * Copyright (c) 2013-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ethernet_mac_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ethernet_mac_api.h index bc5114f17a..d1dc2b64ec 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ethernet_mac_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ethernet_mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -26,35 +26,44 @@ extern "C" { #endif -#define ETHERTYPE_IPV4 0x0800 -#define ETHERTYPE_ARP 0x0806 -#define ETHERTYPE_802_1Q_TAG 0x8100 -#define ETHERTYPE_IPV6 0x86dd +#define ETHERTYPE_IPV4 0x0800 /**< ethernet type for IPv4 */ +#define ETHERTYPE_ARP 0x0806 /**< ethernet type for ARP */ +#define ETHERTYPE_802_1Q_TAG 0x8100 /**< ethernet type for 802_1Q */ +#define ETHERTYPE_IPV6 0x86dd /**< ethernet type for IPv6 */ typedef struct eth_mac_api_s eth_mac_api_t; +/** + * \brief Struct eth_data_conf_s defines arguments for data confirm message + */ typedef struct eth_data_conf_s { - uint8_t msduHandle; - uint8_t status; + uint8_t msduHandle; /**< Handle associated with MSDU */ + uint8_t status; /**< Status of the last transaction */ }eth_data_conf_t; +/** + * \brief Struct eth_data_req_s defines arguments for data request message + */ typedef struct eth_data_req_s { - uint16_t msduLength; - uint8_t *msdu; - uint8_t *srcAddress; - uint8_t *dstAddress; - uint16_t etehernet_type; - uint8_t msduHandle; + uint16_t msduLength; /**< Service data unit length */ + uint8_t *msdu; /**< Service data unit */ + uint8_t *srcAddress; /**< Source address */ + uint8_t *dstAddress; /**< Destination address */ + uint16_t etehernet_type; /**< Ethernet type */ + uint8_t msduHandle; /**< Handle associated with MSDU */ } eth_data_req_t; +/** + * \brief Struct eth_data_ind_s defines arguments for data indication message + */ typedef struct eth_data_ind_s { - uint16_t msduLength; - uint8_t *msdu; - uint8_t srcAddress[6]; - uint8_t dstAddress[6]; - uint16_t etehernet_type; - uint8_t link_quality; - int8_t dbm; + uint16_t msduLength; /**< Service data unit length */ + uint8_t *msdu; /**< Service data unit */ + uint8_t srcAddress[6]; /**< Source address */ + uint8_t dstAddress[6]; /**< Destination address */ + uint16_t etehernet_type; /**< Ethernet type */ + uint8_t link_quality; /**< Link quality */ + int8_t dbm; /**< measured dBm */ }eth_data_ind_t; /** @@ -122,18 +131,21 @@ typedef int8_t eth_mac_mac48_address_get(const eth_mac_api_t* api, uint8_t *mac4 typedef int8_t eth_mac_api_initialize(eth_mac_api_t *api, eth_mac_data_confirm *conf_cb, eth_mac_data_indication *ind_cb, uint8_t parent_id); +/** + * \brief Struct eth_mac_api_s defines functions for two-way communications between ethernet MAC and Upper layer. + */ struct eth_mac_api_s { - eth_mac_api_initialize *mac_initialize; + eth_mac_api_initialize *mac_initialize; /**< Callback function for MAC initialization */ - eth_mac_data_request *data_req; - eth_mac_data_confirm *data_conf_cb; - eth_mac_data_indication *data_ind_cb; + eth_mac_data_request *data_req; /**< Callback function for data request */ + eth_mac_data_confirm *data_conf_cb; /**< Callback function for data confirmation */ + eth_mac_data_indication *data_ind_cb; /**< Callback function for data indication */ - eth_mac_mac48_address_set *mac48_set; - eth_mac_mac48_address_get *mac48_get; + eth_mac_mac48_address_set *mac48_set; /**< Setter for MAC address */ + eth_mac_mac48_address_get *mac48_get; /**< Getter for MAC address */ - uint8_t parent_id; - bool address_resolution_needed; //Normal ethernet should set this true and tunnel or slip false + uint8_t parent_id; /**< Upper layer ID */ + bool address_resolution_needed; /**< Normal ethernet should set this true for tunnel or false for slip */ }; #ifdef __cplusplus diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/fhss_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/fhss_api.h new file mode 100644 index 0000000000..5c00aac859 --- /dev/null +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/fhss_api.h @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2016-2017 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: LicenseRef-PBL + * + * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.mbed.com/licenses/PBL-1.0 + * + * See the License for the specific language governing permissions and limitations under the License. + * + */ + +/** + * \file fhss_api.h + * \brief + */ + +#ifndef FHSS_API_H +#define FHSS_API_H + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct fhss_api fhss_api_t; +typedef struct fhss_callback fhss_callback_t; + +/** + * @brief FHSS frame types. + */ +#define FHSS_SYNCH_FRAME 0 /**< FHSS synchronization frame */ +#define FHSS_SYNCH_REQUEST_FRAME 1 /**< FHSS synchronization request frame */ +#define FHSS_DATA_FRAME 2 /**< FHSS data frame */ + +/** + * @brief FHSS synchronization info length. + */ +#define FHSS_SYNCH_INFO_LENGTH 21 + +/** + * @brief FHSS states. + */ +typedef enum +{ + FHSS_UNSYNCHRONIZED, + FHSS_SYNCHRONIZED, +} fhss_states; + +/** + * @brief FHSS is broadcast channel. Checks if current channel is broadcast channel. + * @param api FHSS instance. + * @return false if unicast channel, true if broadcast channel. + */ +typedef bool fhss_is_broadcast_channel(const fhss_api_t *api); + +/** + * @brief FHSS queue check. Checks if broadcast queue must be used instead of unicast queue. + * @param api FHSS instance. + * @param is_broadcast_addr Destination address type of packet (true if broadcast address). + * @param frame_type Frame type of packet (Frames types are defined by FHSS api). + * @return false if unicast queue, true if broadcast queue. + */ +typedef bool fhss_use_broadcast_queue(const fhss_api_t *api, bool is_broadcast_addr, int frame_type); + +/** + * @brief FHSS TX handle. Set destination channel and write synchronization info. + * @param api FHSS instance. + * @param is_broadcast_addr Destination address type of packet (true if broadcast address). + * @param destination_address Destination MAC address. + * @param frame_type Frame type of packet (Frames types are defined by FHSS api). + * @param synch_info Pointer to where FHSS synchronization info is written (if synch frame). + * @param frame_length MSDU length of the frame. + * @param phy_header_length PHY header length. + * @param phy_tail_length PHY tail length. + * @return 0 Success. + * @return -1 Transmission of the packet is currently not allowed, try again. + * @return -2 Invalid api. + * @return -3 Broadcast packet on Unicast channel (not allowed), push packet back to queue. + * @return -4 Synchronization info missing. + */ +typedef int fhss_tx_handle(const fhss_api_t *api, bool is_broadcast_addr, uint8_t *destination_address, int frame_type, uint8_t *synch_info, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length); + +/** + * @brief Check TX permission. + * @param api FHSS instance. + * @param is_broadcast_addr Destination address type of packet (true if broadcast address). + * @param handle Handle of the data request. + * @param frame_type Frame type of packet (Frames types are defined by FHSS api). + * @param frame_length MSDU length of the frame. + * @param phy_header_length PHY header length. + * @param phy_tail_length PHY tail length. + * @return false if transmission is denied, true if transmission is allowed. + */ +typedef bool fhss_check_tx_conditions(const fhss_api_t *api, bool is_broadcast_addr, uint8_t handle, int frame_type, uint16_t frame_length, uint8_t phy_header_length, uint8_t phy_tail_length); + +/** + * @brief Notification of received FHSS synch or synch request frame. + * @param api FHSS instance. + * @param pan_id Source PAN id of the received frame (FHSS_SYNCH_FRAME only). + * @param source_address Source address of the received frame (FHSS_SYNCH_FRAME only). + * @param timestamp Timestamp of reception (FHSS_SYNCH_FRAME only). + * @param synch_info Pointer to synchronization info (FHSS_SYNCH_FRAME only). + * @param frame_type Frame type of packet (Frames types are defined by FHSS api). + */ +typedef void fhss_receive_frame(const fhss_api_t *api, uint16_t pan_id, uint8_t *source_address, uint32_t timestamp, uint8_t *synch_info, int frame_type); + +/** + * @brief Data TX done callback. + * @param api FHSS instance. + * @param waiting_ack MAC is waiting Acknowledgement for this frame. + * @param tx_completed TX completed (Ack received or no more retries left (if unicast frame)). + * @param handle Handle of the data request. + */ +typedef void fhss_data_tx_done(const fhss_api_t *api, bool waiting_ack, bool tx_completed, uint8_t handle); + +/** + * @brief Data TX or CCA failed callback. + * @param api FHSS instance. + * @param handle Handle of the data request. + * @return true if frame has to be queued for retransmission, false otherwise. + */ +typedef bool fhss_data_tx_fail(const fhss_api_t *api, uint8_t handle); + +/** + * @brief Change synchronization state. + * @param api FHSS instance. + * @param fhss_state FHSS state (FHSS states are defined by FHSS api). + * @param pan_id PAN id of the network FHSS synchronizes with. + */ +typedef void fhss_synch_state_set(const fhss_api_t *api, fhss_states fhss_state, uint16_t pan_id); + +/** + * @brief Read timestamp. + * @param api FHSS instance. + * @return Timestamp to be written in received frame. + */ +typedef uint32_t fhss_read_timestamp(const fhss_api_t *api); + +/** + * @brief Get retransmission period. FHSS uses different retry periods for different destinations. + * @param api FHSS instance. + * @param destination_address Destination MAC address. + * @param phy_mtu PHY MTU size. + * @return Retransmission period. + */ +typedef uint16_t fhss_get_retry_period(const fhss_api_t *api, uint8_t *destination_address, uint16_t phy_mtu); + +/** + * @brief Initialize MAC functions. + * @param api FHSS instance. + * @param callbacks MAC functions to be called from FHSS. + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int fhss_init_callbacks(const fhss_api_t *api, fhss_callback_t *callbacks); + +/** + * \brief Struct fhss_api defines interface between software MAC and FHSS. + * Application creates fhss_api_s object by calling FHSS creator function. + * Then object is passed to software MAC which then initialises it's own callback functions. + */ +struct fhss_api { + fhss_is_broadcast_channel *is_broadcast_channel; /**< FHSS is broadcast channel. */ + fhss_use_broadcast_queue *use_broadcast_queue; /**< FHSS queue check. */ + fhss_tx_handle *tx_handle; /**< FHSS TX handle. */ + fhss_check_tx_conditions *check_tx_conditions; /**< Check TX permission. */ + fhss_receive_frame *receive_frame; /**< Notification of received FHSS synch or synch request frame. */ + fhss_data_tx_done *data_tx_done; /**< Data TX done callback. */ + fhss_data_tx_fail *data_tx_fail; /**< Data TX or CCA failed callback. */ + fhss_synch_state_set *synch_state_set; /**< Change synchronization state. */ + fhss_read_timestamp *read_timestamp; /**< Read timestamp. */ + fhss_get_retry_period *get_retry_period; /**< Get retransmission period. */ + fhss_init_callbacks *init_callbacks; /**< Initialize MAC functions. */ +}; + +/** + * @brief Read MAC TX queue size. + * @param fhss_api FHSS instance. + * @param broadcast_queue Queue type to be read (true if broadcast queue). + * @return Queue size (number of frames queued). + */ +typedef uint16_t mac_read_tx_queue_size(const fhss_api_t *fhss_api, bool broadcast_queue); + +/** + * @brief Read MAC address. + * @param fhss_api FHSS instance. + * @param mac_address MAC address pointer. + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int mac_read_mac_address(const fhss_api_t *fhss_api, uint8_t *mac_address); + +/** + * @brief Read PHY datarate. + * @param fhss_api FHSS instance. + * @return PHY datarate. + */ +typedef uint32_t mac_read_datarate(const fhss_api_t *fhss_api); + +/** + * @brief Change channel. + * @param fhss_api FHSS instance. + * @param channel_number Channel number. + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int mac_change_channel(const fhss_api_t *fhss_api, uint8_t channel_number); + +/** + * @brief Send FHSS frame. + * @param fhss_api FHSS instance. + * @param frame_type Frame type of packet (Frames types are defined by FHSS api). + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int mac_send_fhss_frame(const fhss_api_t *fhss_api, int frame_type); + +/** + * @brief Send notification when FHSS synchronization is lost. + * @param fhss_api FHSS instance. + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int mac_synch_lost_notification(const fhss_api_t *fhss_api); + +/** + * @brief Poll TX queue. + * @param fhss_api FHSS instance. + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int mac_tx_poll(const fhss_api_t *fhss_api); + +/** + * @brief Broadcast channel notification from FHSS. + * @param fhss_api FHSS instance. + * @param broadcast_time Remaining broadcast time. + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int mac_broadcast_notify(const fhss_api_t *fhss_api, uint32_t broadcast_time); + +/** + * @brief Read coordinator MAC address. + * @param fhss_api FHSS instance. + * @param mac_address MAC address pointer. + * @return 0 Success. + * @return -1 Invalid parameters. + */ +typedef int mac_read_coordinator_mac_address(const fhss_api_t *fhss_api, uint8_t *mac_address); + +/** + * \brief Struct fhss_callback defines functions that software MAC needs to implement. + * Function pointers are passed to FHSS using fhss_init_callbacks function. + */ +struct fhss_callback { + mac_read_tx_queue_size *read_tx_queue_size; /**< Read MAC TX queue size. */ + mac_read_mac_address *read_mac_address; /**< Read MAC address. */ + mac_read_datarate *read_datarate; /**< Read PHY datarate. */ + mac_change_channel *change_channel; /**< Change channel. */ + mac_send_fhss_frame *send_fhss_frame; /**< Send FHSS frame. */ + mac_synch_lost_notification *synch_lost_notification; /**< Send notification when FHSS synchronization is lost. */ + mac_tx_poll *tx_poll; /**< Poll TX queue. */ + mac_broadcast_notify *broadcast_notify; /**< Broadcast channel notification from FHSS. */ + mac_read_coordinator_mac_address *read_coord_mac_address; /**< Read coordinator MAC address. */ +}; + +#ifdef __cplusplus +} +#endif + +#endif // FHSS_API_H diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/fhss_config.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/fhss_config.h new file mode 100644 index 0000000000..e7b94115a2 --- /dev/null +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/fhss_config.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2015-2017 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: LicenseRef-PBL + * + * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.mbed.com/licenses/PBL-1.0 + * + * See the License for the specific language governing permissions and limitations under the License. + * + */ + +/** + * \file fhss_config.h + * \brief + */ + +#ifndef FHSS_CONFIG_H +#define FHSS_CONFIG_H + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Struct fhss_tuning_parameter defines FHSS tuning parameters. + * All delays are given in microseconds. + */ +typedef struct fhss_tuning_parameter +{ + /** Delay between data pushed to PHY TX function and TX started (Contains CSMA-CA maximum random period). */ + uint32_t tx_processing_delay; + + /** Delay between TX done (by transmitter) and received data pushed to MAC (by receiver). */ + uint32_t rx_processing_delay; + + /** Delay between TX done (by transmitter) and Ack transmission started (by receiver) */ + uint32_t ack_processing_delay; +} fhss_tuning_parameter_t; + +/** + * \brief Struct fhss_configuration defines basic configuration of FHSS. + */ +typedef struct fhss_configuration +{ + /** Tuning parameters can be used to enhance synchronization accuracy*/ + fhss_tuning_parameter_t fhss_tuning_parameters; + + /** Maximum used interval for requesting synchronization info from FHSS parent device (seconds). */ + uint16_t fhss_max_synch_interval; + + /** Number of channel retries. */ + uint8_t fhss_number_of_channel_retries; + + /** Channel mask */ + uint32_t channel_mask[8]; + +} fhss_configuration_t; + +/** + * \brief Struct fhss_timer defines interface between FHSS and FHSS platform timer. + * Application must implement FHSS timer driver which is then used by FHSS with this interface. + */ +typedef struct fhss_timer +{ + /** Start timeout (1us) */ + int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api); + + /** Stop timeout */ + int (*fhss_timer_stop)(const fhss_api_t *fhss_api); + + /** Get remaining time of started timeout*/ + uint32_t (*fhss_get_remaining_slots)(const fhss_api_t *fhss_api); + + /** Get timestamp since initialization of driver. Overflow of 32-bit counter is allowed (1us) */ + uint32_t (*fhss_get_timestamp)(const fhss_api_t *fhss_api); + + /** Divide 1 microsecond resolution. E.g. to use 64us resolution, use fhss_resolution_divider = 64*/ + uint8_t fhss_resolution_divider; +} fhss_timer_t; + +/** + * \brief Struct fhss_synch_configuration defines the synchronization time configurations. + * Border router application must define and set these configuration for FHSS network. + */ +typedef struct fhss_synch_configuration +{ + /** Number of broadcast channels. */ + uint8_t fhss_number_of_bc_channels; + + /** TX slots per channel. */ + uint8_t fhss_number_of_tx_slots; + + /** Length of superframe(microseconds) * Number of superframes defines the + channel dwell time. E.g. 50000us * 8 -> Channel dwell time 400ms */ + uint16_t fhss_superframe_length; + + /** Number of superframes. */ + uint8_t fhss_number_of_superframes; +} fhss_synch_configuration_t; + + +/** + * \brief Struct fhss_statistics defines the available FHSS statistics. + */ +typedef struct fhss_statistics +{ + /** FHSS synchronization drift compensation (us/channel). */ + int16_t fhss_drift_compensation; + + /** FHSS hop count. */ + uint8_t fhss_hop_count; + + /** FHSS synchronization interval (s). */ + uint16_t fhss_synch_interval; + + /** Average of 5 preceding synchronization fixes (us). Updated after every fifth synch fix. */ + int16_t fhss_prev_avg_synch_fix; + + /** FHSS synchronization lost counter. */ + uint32_t fhss_synch_lost; +} fhss_statistics_t; + +/** + * \brief Enumeration fhss_channel_mode_e defines the channel modes. + */ +typedef enum fhss_channel_mode_e { + SINGLE_CHANNEL, //< Single channel + FHSS, //< Frequency hopping mode +} fhss_channel_mode_e; + +#ifdef __cplusplus +} +#endif + +#endif // FHSS_CONFIG_H diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_api.h index a34cd985ae..8477c05405 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -50,6 +50,10 @@ typedef struct mac_api_s mac_api_t; * \return mac_api_t Ownership of newly created object */ +/*! + * \enum mlme_primitive + * \brief Enum for MLME primitive types. + */ typedef enum { MLME_ASSOCIATE, MLME_DISASSOCIATE, @@ -68,14 +72,21 @@ typedef enum { MLME_POLL } mlme_primitive; - +/** + * \struct mac_description_storage_size_t + * \brief Container for MAC storage sizes. + */ typedef struct mac_description_storage_size_s { - uint8_t device_decription_table_size; /** MAC Device description list size */ - uint8_t key_description_table_size; /** MAC Key description list size */ - uint8_t key_lookup_size; /** Key description key lookup list size */ - uint8_t key_usage_size; /** Key description key usage list size */ + uint8_t device_decription_table_size; /**< MAC Device description list size */ + uint8_t key_description_table_size; /**< MAC Key description list size */ + uint8_t key_lookup_size; /**< Key description key lookup list size */ + uint8_t key_usage_size; /**< Key description key usage list size */ } mac_description_storage_size_t; +/*! + * \enum mac_extended_address_type + * \brief Enum for MAC extended address types. + */ typedef enum mac_extended_address_type { MAC_EXTENDED_READ_ONLY, /** EUID64 which is unique */ MAC_EXTENDED_DYNAMIC /** Configured MAC 64-bit address to RAM and Radio */ @@ -194,24 +205,24 @@ typedef int8_t mac_api_initialize(mac_api_t *api, mcps_data_confirm *data_conf_c * Then MAC is operated by Upper layer by calling MLME or MCPS primitive functions. */ struct mac_api_s { - mac_api_initialize *mac_initialize; + mac_api_initialize *mac_initialize; /**< MAC initialize function to use */ //External MAC callbacks - mlme_request *mlme_req; - mcps_data_request *mcps_data_req; - mcps_purge_request *mcps_purge_req; + mlme_request *mlme_req; /**< MAC MLME request function to use */ + mcps_data_request *mcps_data_req; /**< MAC MCPS data request function to use */ + mcps_purge_request *mcps_purge_req; /**< MAC MCPS purge request function to use */ //Upper layer callbacksMLME_ASSOCIATE - mcps_data_confirm *data_conf_cb; - mcps_data_indication *data_ind_cb; - mcps_purge_confirm *purge_conf_cb; - mlme_confirm *mlme_conf_cb; - mlme_indication *mlme_ind_cb; - mac_ext_mac64_address_set *mac64_set; - mac_ext_mac64_address_get *mac64_get; - mac_storage_decription_sizes_get *mac_storage_sizes_get; + mcps_data_confirm *data_conf_cb; /**< MAC MCPS data confirm callback function */ + mcps_data_indication *data_ind_cb; /**< MAC MCPS data indication callback function */ + mcps_purge_confirm *purge_conf_cb; /**< MAC MCPS purge confirm callback function */ + mlme_confirm *mlme_conf_cb; /**< MAC MLME confirm callback function */ + mlme_indication *mlme_ind_cb; /**< MAC MLME indication callback function */ + mac_ext_mac64_address_set *mac64_set; /**< MAC extension function to set mac64 address */ + mac_ext_mac64_address_get *mac64_get; /**< MAC extension function to get mac64 address */ + mac_storage_decription_sizes_get *mac_storage_sizes_get; /**< Getter function to query data storage sizes from MAC */ - int8_t parent_id; - uint16_t phyMTU; + int8_t parent_id; /**< Upper layer id */ + uint16_t phyMTU; /**< Maximum Transmission Unit(MTU) used by MAC*/ }; #ifdef __cplusplus diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_common_defines.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_common_defines.h index 48d477c12a..1ba79ea12f 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_common_defines.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_common_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -21,31 +21,33 @@ #include "ns_types.h" -#define MAC_ADDR_MODE_NONE 0 -#define MAC_ADDR_MODE_16_BIT 2 -#define MAC_ADDR_MODE_64_BIT 3 +#define MAC_ADDR_MODE_NONE 0 /**< Address mode for no address defined */ +#define MAC_ADDR_MODE_16_BIT 2 /**< Address mode for 16-bit addresses */ +#define MAC_ADDR_MODE_64_BIT 3 /**< Address mode for 64-bit addresses */ -#define MAC_FRAME_VERSION_2003 0 // FCF - IEEE 802.15.4-2003 compatible -#define MAC_FRAME_VERSION_2006 1 // FCF - IEEE 802.15.4-2006 (big payload or new security) +#define MAC_FRAME_VERSION_2003 0 /**< FCF - IEEE 802.15.4-2003 compatible */ +#define MAC_FRAME_VERSION_2006 1 /**< FCF - IEEE 802.15.4-2006 (big payload or new security) */ - -#define MAC_KEY_ID_MODE_IMPLICIT 0 -#define MAC_KEY_ID_MODE_IDX 1 -#define MAC_KEY_ID_MODE_SRC4_IDX 2 -#define MAC_KEY_ID_MODE_SRC8_IDX 3 +//See IEEE standard 802.15.4-2006 (table 96) for more details about identifiers +#define MAC_KEY_ID_MODE_IMPLICIT 0 /**< Key identifier mode implicit */ +#define MAC_KEY_ID_MODE_IDX 1 /**< Key identifier mode for 1-octet key index */ +#define MAC_KEY_ID_MODE_SRC4_IDX 2 /**< Key identifier mode for combined 4-octet key source and 1-octet key index */ +#define MAC_KEY_ID_MODE_SRC8_IDX 3 /**< Key identifier mode for combined 8-octet key source and 1-octet key index */ /* IEEE 802.15.4 constants */ -#define MAC_IEEE_802_15_4_MAX_MPDU_UNSECURED_OVERHEAD 25 -#define MAC_IEEE_802_15_4_MIN_MPDU_OVERHEAD 9 -#define MAC_IEEE_802_15_4_MAX_BEACON_OVERHEAD 75 -#define MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE 127 +#define MAC_IEEE_802_15_4_MAX_MPDU_UNSECURED_OVERHEAD 25 /**< Maximum for MAC protocol data unit unsecured overhead */ +#define MAC_IEEE_802_15_4_MIN_MPDU_OVERHEAD 9 /**< Minimum overhead added by MAC to MPDU */ +#define MAC_IEEE_802_15_4_MAX_BEACON_OVERHEAD 75 /**< Maximum overhead which is added by the MAC for beacon */ +#define MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE 127 /**< Maximum number of octets PHY layer is able to receive */ #define MAC_IEEE_802_15_4_MAX_BEACON_PAYLOAD_LENGTH \ - (MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE - MAC_IEEE_802_15_4_MAX_BEACON_OVERHEAD) + (MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE - MAC_IEEE_802_15_4_MAX_BEACON_OVERHEAD) /**< Maximum size of beacon payload */ + +/** Maximum number of bytes which can be transmitted in the MAC payload of an unsecured MAC frame */ #define MAC_IEEE_802_15_4_MAX_MAC_SAFE_PAYLOAD_SIZE \ (MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE - MAC_IEEE_802_15_4_MAX_MPDU_UNSECURED_OVERHEAD) -#define mac_unsecured_2003_compatibility false +#define mac_unsecured_2003_compatibility false /**< For IEEE 802.15.4-2003 MAC compatibility, force max size to never exceed MAC_IEEE_802_15_4_MAX_MAC_SAFE_PAYLOAD_SIZE */ /** * @brief struct mlme_security_t MLME/MCPS security structure @@ -55,10 +57,10 @@ * See IEEE standard 802.15.4-2006 (e.g end of table 41) for more details */ typedef struct mlme_security_s { - unsigned SecurityLevel:3; - unsigned KeyIdMode:2; /* 2-bit value which define key source and ID use case */ - uint8_t KeyIndex; /* Key index */ - uint8_t Keysource[8]; + unsigned SecurityLevel:3; /**< Security level */ + unsigned KeyIdMode:2; /**< 2-bit value which define key source and ID use case */ + uint8_t KeyIndex; /**< Key index */ + uint8_t Keysource[8]; /**< Key source */ } mlme_security_t; #endif /* MAC_COMMON_DEFINES_H_ */ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_filter_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_filter_api.h index ab30c990b2..90cd069c49 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_filter_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_filter_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_mcps.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_mcps.h index bbdda48218..c71a9a2943 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_mcps.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mac_mcps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -28,17 +28,17 @@ * See IEEE standard 802.15.4-2006 (table 41) for more details */ typedef struct mcps_data_req_s { - unsigned SrcAddrMode:2; - unsigned DstAddrMode:2; - uint16_t DstPANId; - uint8_t DstAddr[8]; - uint16_t msduLength; - uint8_t *msdu; - uint8_t msduHandle; - bool TxAckReq: 1; - bool InDirectTx:1; - bool PendingBit: 1; - mlme_security_t Key; + unsigned SrcAddrMode:2; /**< Source address mode */ + unsigned DstAddrMode:2; /**< Destination address mode */ + uint16_t DstPANId; /**< Destination PAN ID */ + uint8_t DstAddr[8]; /**< Destination address */ + uint16_t msduLength; /**< Service data unit length */ + uint8_t *msdu; /**< Service data unit */ + uint8_t msduHandle; /**< Handle associated with MSDU */ + bool TxAckReq: 1; /**< Specifies whether ACK is needed or not */ + bool InDirectTx:1; /**< Specifies whether indirect or direct transmission is used */ + bool PendingBit: 1; /**< Specifies whether more fragments are to be sent or not */ + mlme_security_t Key; /**< Security key */ } mcps_data_req_t; /** @@ -47,12 +47,12 @@ typedef struct mcps_data_req_s { * See IEEE standard 802.15.4-2006 (table 42) for more details */ typedef struct mcps_data_conf_s { - uint8_t msduHandle; - uint8_t status; - uint32_t timestamp; + uint8_t msduHandle; /**< Handle associated with MSDU */ + uint8_t status; /**< Status of the last MSDU transmission */ + uint32_t timestamp; /**< Time, in symbols, at which the data were transmitted */ //Non-standard extension - uint8_t cca_retries; - uint8_t tx_retries; //0 means no retry + uint8_t cca_retries; /**< Number of CCA retries used during sending */ + uint8_t tx_retries; /**< Number of retries done during sending, 0 means no retries */ } mcps_data_conf_t; /** @@ -61,19 +61,19 @@ typedef struct mcps_data_conf_s { * See IEEE standard 802.15.4-2006 (table 43) for more details */ typedef struct mcps_data_ind_s { - unsigned SrcAddrMode:2; /*0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */ - uint16_t SrcPANId; - uint8_t SrcAddr[8]; - unsigned DstAddrMode:2; - uint16_t DstPANId; - uint8_t DstAddr[8]; - uint8_t mpduLinkQuality; - int8_t signal_dbm; /* This extension for normal IEEE 802.15.4 Data indication */ - uint32_t timestamp; - uint8_t DSN; - mlme_security_t Key; - uint16_t msduLength; - uint8_t *msdu_ptr; + unsigned SrcAddrMode:2; /**< 0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */ + uint16_t SrcPANId; /**< Source PAN ID */ + uint8_t SrcAddr[8]; /**< Source address */ + unsigned DstAddrMode:2; /**< Destination address mode */ + uint16_t DstPANId; /**< Destination PAN ID */ + uint8_t DstAddr[8]; /**< Destination address */ + uint8_t mpduLinkQuality; /**< LQI value measured during reception of the MPDU */ + int8_t signal_dbm; /**< This extension for normal IEEE 802.15.4 Data indication */ + uint32_t timestamp; /**< The time, in symbols, at which the data were received */ + uint8_t DSN; /**< Data sequence number */ + mlme_security_t Key; /**< Security key */ + uint16_t msduLength; /**< Data unit length */ + uint8_t *msdu_ptr; /**< Data unit */ } mcps_data_ind_t; /** @@ -82,7 +82,7 @@ typedef struct mcps_data_ind_s { * See IEEE standard 802.15.4-2006 (table 44) for more details */ typedef struct mcps_purge_s { - uint8_t msduHandle; + uint8_t msduHandle; /**< Handle associated with MSDU */ } mcps_purge_t; /** @@ -91,8 +91,8 @@ typedef struct mcps_purge_s { * See IEEE standard 802.15.4-2006 (table 45) for more details */ typedef struct mcps_purge_conf_s { - uint8_t msduHandle; - uint8_t status; + uint8_t msduHandle; /**< Handle associated with MSDU */ + uint8_t status; /**< Status of the purge performed */ } mcps_purge_conf_t; diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mlme.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mlme.h index 8433f9d1e8..fe19753707 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mlme.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/mlme.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 ARM Limited. All rights reserved. + * Copyright (c) 2013-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -29,17 +29,17 @@ * See IEEE standard 802.15.4-2006 (table 55) for more details */ typedef struct mlme_pan_descriptor_s { - unsigned CoordAddrMode:2; - uint16_t CoordPANId; - uint8_t CoordAddress[8]; - uint8_t LogicalChannel; - uint8_t ChannelPage; - uint8_t SuperframeSpec[2]; - bool GTSPermit:1; - uint8_t LinkQuality; - uint32_t Timestamp; - uint8_t SecurityFailure; - mlme_security_t Key; + unsigned CoordAddrMode:2; /**Current RF channel*/ - macAckWaitDuration = 0x40, /*>Integer, n. of symbols*/ - macAssociatedPANCoord = 0x56, /*>Boolean, associated to PAN coordinator*/ - macAssociationPermit = 0x41, /*>Boolean, if association is allowed (in coordinator)*/ - macAutoRequest = 0x42, /*>Boolean, if device automatically sends data request on beacon*/ - macBattLifeExt = 0x43, /*>Boolean, if BLE is enabled*/ - macBattLifeExtPeriods = 0x44, /*>Integer 6-41, BLE backoff periods */ - macBeaconPayload = 0x45, /*>Set of bytes, beacon payload*/ - macBeaconPayloadLength = 0x46, /*>Integer 0-MaxPayLoadLen*/ - macBeaconOrder = 0x47, /*>Integer 0–15, Beacon tx period, 15 = no periodic beacon*/ - macBeaconTxTime = 0x48, /*>Integer 0x000000–0xffffff, symbols, when last beacon was transmitted*/ - macBSN = 0x49, /*>Integer 0x00–0xff, Beacon sequence number*/ - macCoordExtendedAddress = 0x4a, /*>64-bit IEEE of coordinator*/ - macCoordShortAddress = 0x4b, /*>16-bit addr of coordinator*/ - macDSN = 0x4c, /*>Integer 0x00–0xff, Data frame sequence number*/ - macGTSPermit = 0x4d, /*>Boolean, GTS allowed?*/ - macMaxBE = 0x57, /*>Integer 3–8, max value of backoff exponent*/ - macMaxCSMABackoffs = 0x4e, /*>Integer 0–5*/ - macMaxFrameTotalWaitTime = 0x58,/*>Integer, max of CAP symbols while waiting for data requested by DREQ or PEND*/ - macMaxFrameRetries = 0x59, /*>Integer 0–7*/ - macMinBE = 0x4f, /*>Integer 0–macMaxBE*/ - macPANId = 0x50, /*>PAN ID, 16 bits*/ - macPromiscuousMode = 0x51, /*>Boolean*/ - macResponseWaitTime = 0x5a, /*>Integer 2–64 The maximum time in SuperFrameDurations to wait for responses*/ - macRxOnWhenIdle = 0x52, /*>Boolean*/ - macSecurityEnabled = 0x5d, /*>Boolean*/ - macShortAddress = 0x53, /*>Short address, 16 bits*/ - macSuperframeOrder = 0x54, /*>Integer 0–15, The length of the active portion of the outgoing superframe, 15 = none*/ - macSyncSymbolOffset = 0x5b, /*>Integer 0x000–0x100 (symbols) timestamp offset*/ - macTimestampSupported = 0x5c, /*>Boolean*/ - macTransactionPersistenceTime = 0x55, /*>Integer 0x0000–0xffff (unit periods)*/ - macKeyTable = 0x71, /*>A table of KeyDescriptor entries, each containing keys and related information required for secured communications.*/ - macKeyTableEntries = 0x72, /*>The number of entries in macKeyTable.*/ - macDeviceTable = 0x73, /*>List of Descriptor entries, each indicating a remote device*/ - macDeviceTableEntries = 0x74, /*>The number of entries in macDeviceTable.*/ - macSecurityLevelTable = 0x75, /*>A table of SecurityLevelDescriptor entries*/ - macSecurityLevelTableEntries = 0x76, /*>The number of entries in macSecurityLevelTable*/ - macFrameCounter = 0x77, /*>The outgoing frame counter*/ - macAutoRequestSecurityLevel = 0x78, /*>0x00–0x07 The security level used for automatic data requests.*/ - macAutoRequestKeyIdMode = 0x79, /*> The key identifier mode used for automatic data requests.*/ - macAutoRequestKeySource = 0x7a, /*>Key source for automatic data*/ - macAutoRequestKeyIndex = 0x7b, /*>The index of the key used for automatic data*/ - macDefaultKeySource = 0x7c, /*>Default key source*/ + phyCurrentChannel = 0x00, /* Trig Beacon from load balance module periodic */ - macLoadBalancingAcceptAnyBeacon = 0xfe, /*>Beacon accept state control from other network. Value size bool, data true=Enable, false=disable .*/ - macThreadForceLongAddressForBeacon = 0xff /*>Thread standard force beacon source address for extended 64-bit*/ + macLoadBalancingBeaconTx = 0xfd, /*< Trig Beacon from load balance module periodic */ + macLoadBalancingAcceptAnyBeacon = 0xfe, /* ED=0, active=1, passive=2, orphan=3*/ - channel_list_s ScanChannels; /*>bit field, low 27 bits used*/ - uint8_t ScanDuration; /*>0-14, scan duration/channel*/ - uint8_t ChannelPage; /*>0-31*/ - mlme_security_t Key; + mac_scan_type_t ScanType; /**< ED=0, active=1, passive=2, orphan=3*/ + channel_list_s ScanChannels; /**= min_scope. + * + * This functionality is disabled by setting min_scope to 0x10 or greater (so + * no packets can match). + * + * \param interface_id interface id + * \param min_scope minimum IPv6 scope value for forwarding (see RFC 4291) + * + * \return 0 for success, negative on failure + */ +int8_t multicast_fwd_full_for_scope(int8_t interface_id, uint_fast8_t min_scope); + +/** + * \brief Set upstream interface for MLD proxying + * + * This sets the upstream interface for MLD proxying. If set, the stack will + * report group membership on that interface according to the forwarding lists + * of the other interfaces (ie it will send MLD reports or equivalent on that + * upstream interface). + * + * \param interface_id interface id, or -1 to disable + * + * \return 0 for success, negative on failure + */ +int8_t multicast_fwd_set_proxy_upstream(int8_t interface_id); + #ifdef __cplusplus } #endif diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_address_extension.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_address_extension.h index e59f838fcd..6e9b81e1bb 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_address_extension.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_address_extension.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2013-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_fhss.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_fhss.h index 1d3e406254..b48ac8711b 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_fhss.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_fhss.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -20,111 +20,39 @@ #ifndef NET_FHSS_H_ #define NET_FHSS_H_ - #include "ns_types.h" -#ifndef RPL_SYNCHRONIZATION_INSTANCE_ID -#define RPL_SYNCHRONIZATION_INSTANCE_ID 1 +#ifdef __cplusplus +extern "C" { #endif -/** FHSS configuration structure */ -typedef struct fhss_configuration_s -{ - /** Number of broadcast channels. */ - uint8_t fhss_number_of_bc_channels; - - /** TX slots per channel. */ - uint8_t fhss_number_of_tx_slots; - - /** Length of superframe, in microseconds. */ - uint16_t fhss_superframe_length; - - /** Number of superframes, after which the counter will start from zero. */ - uint8_t fhss_number_of_superframes; - - /** - * Interval of beacon sending, in milliseconds. - * Note1: Value 0 disables them. - * Note2: This will likely be removed when beacons are sent only when needed. - */ - uint32_t fhss_beacon_send_interval; -} fhss_configuration_s; - -/** FHSS Platform callbacks */ -typedef struct -{ - int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(int8_t, uint16_t), int8_t); - int (*fhss_timer_stop)(void); - uint32_t (*fhss_get_remaining_slots)(void); - uint32_t (*fhss_get_timestamp)(void); - int (*fhss_time_measure_start)(void); - uint32_t (*fhss_time_measure_read)(void); - int (*fhss_time_measure_stop)(void); - uint8_t fhss_resolution_divider; -} fhss_platform_functions_s; - -/** FHSS tuning parameters */ -typedef struct -{ - /** Processing delay between synch info written and TX start. */ - uint32_t synch_tx_processing_time; - /** Processing delay between TX done and synch info read. */ - uint32_t synch_rx_processing_time; - /** Processing delay between data pushed to driver and transmission started. */ - uint32_t data_tx_processing_time; - /** Processing delay between TX done and Ack TX start. */ - uint32_t data_rx_processing_time; -} fhss_platform_tuning_params_s; - -/** FHSS Channel mode */ -typedef enum fhss_channel_mode_e { - SINGLE_CHANNEL, //< Single channel - FHSS, //< Frequency hopping mode -} fhss_channel_mode_e; - -#if 0 /** - * \brief Enable FHSS mode. Note: arm_nwk_interface_configure_6lowpan_bootstrap_set() must be called before enabling FHSS. - * - * \param interface_id Network interface ID. - * \param fhss_platform_functions Platform functions. - * \param fhss_configuration Given configuration. - * \return 0 on success. - * \return -1 in case of invalid input parameters. - * \return -2 if no channels are available in channel list. - * \return -3 if the broadcast channels or TX slots are 0 in the bootstrap mode Border Router/RF access point. - * \return -4 if the number of super frames does not work with TX slots in bootstrap mode Border Router/RF access point. - * \return -5 if FHSS tasklet creation fails. - * \return -6 if PHY driver mode cannot be changed. - * \return -7 if the used bootstrap mode is not supported. - * \return -8 if FHSS is already enabled. - * \return -9 if memory allocation failed. + * @brief Creates FHSS API instance which will be registered to software MAC. + * @param fhss_configuration Basic FHSS configuration. + * @param fhss_timer FHSS platform timer interface and configuration. + * @param fhss_statistics FHSS statistics storage. + * @return New FHSS instance if successful, NULL otherwise. */ -extern int8_t arm_fhss_enable(int8_t interface_id, fhss_platform_functions_s *fhss_platform_functions, - const fhss_configuration_s *fhss_configuration); +extern fhss_api_t *ns_fhss_create(const fhss_configuration_t *fhss_configuration, const fhss_timer_t *fhss_timer, fhss_statistics_t *fhss_statistics); /** - * \brief Disable FHSS mode. - * - * \param interface_id Network interface ID. - * \return 0 on success, -1 on fail. + * @brief Set synchronization time configuration for FHSS network. Should be only called from Border router. + * @param fhss_api FHSS instance. + * @param fhss_synch_configuration FHSS synchronization time configuration. + * @return 0 on success, -1 on fail. */ -extern int8_t arm_fhss_disable(int8_t interface_id); +extern int ns_fhss_configuration_set(fhss_api_t *fhss_api, const fhss_synch_configuration_t *fhss_synch_configuration); /** - * \brief Set platform tuning parameters. - * - * \param interface_id Network interface ID. - * \param fhss_tuning_params Tuning parameters. - * \return 0 on success, -1 on fail. + * @brief Deletes a FHSS API instance and removes it from software MAC. + * @param fhss_api FHSS instance. + * @return 0 on success, -1 on fail. */ -extern int8_t arm_fhss_set_tuning_params(int8_t interface_id, const fhss_platform_tuning_params_s *fhss_tuning_params); +extern int ns_fhss_delete(fhss_api_t *fhss_api); -#else -NS_DUMMY_DEFINITIONS_OK -#define arm_fhss_enable(interface_id, fhss_platform_functions,fhss_configuration) (-1) -#define arm_fhss_disable(interface_id) (-1) -#define arm_fhss_set_tuning_params(interface_id, fhss_tuning_params) (-1) + +#ifdef __cplusplus +} #endif #endif /* NET_FHSS_H_ */ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_interface.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_interface.h index 3a8b3eb19a..3cd4ef6fe8 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_interface.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -30,10 +30,6 @@ struct eth_mac_api_s; * \brief Network API */ -/*! - * \enum arm_nwk_interface_status_type_e - * \brief Interface status type definition. - */ /** Network Interface Status */ typedef enum arm_nwk_interface_status_type_e { ARM_NWK_BOOTSTRAP_READY = 0, /**< Interface configured Bootstrap is ready.*/ @@ -49,10 +45,6 @@ typedef enum arm_nwk_interface_status_type_e { ARM_NWK_PHY_CONNECTION_DOWN, /**< Interface PHY cable off or serial port interface not responding anymore. */ } arm_nwk_interface_status_type_e; -/*! - * \enum arm_library_event_type_e - * \brief Event library type definition. - */ /** Event library type. */ typedef enum arm_library_event_type_e { ARM_LIB_TASKLET_INIT_EVENT = 0, /**< Tasklet init occurs always when generating a tasklet. */ @@ -62,7 +54,7 @@ typedef enum arm_library_event_type_e { } arm_library_event_type_e; -/** +/* * Socket event description: * * 8-bit variable where four MSB bits describes the event type and @@ -75,7 +67,9 @@ typedef enum arm_library_event_type_e { */ -/** Socket type exceptions. */ +/** \name Socket type exceptions. + * @{ + */ /** Socket event mask. */ #define SOCKET_EVENT_MASK 0xF0 /** Data received. */ @@ -103,16 +97,12 @@ typedef enum arm_library_event_type_e { /** TCP connection problem indication (RFC 1122 R1) */ #define SOCKET_CONNECTION_PROBLEM (11 << 4) -/* Backwards compatibility */ -#define SOCKET_BIND_DONE SOCKET_CONNECT_DONE -#define SOCKET_BIND_FAIL SOCKET_CONNECT_FAIL -#define SOCKET_BIND_AUTH_FAIL SOCKET_CONNECT_AUTH_FAIL +#define SOCKET_BIND_DONE SOCKET_CONNECT_DONE /**< Backward compatibility */ +#define SOCKET_BIND_FAIL SOCKET_CONNECT_FAIL /**< Backward compatibility */ +#define SOCKET_BIND_AUTH_FAIL SOCKET_CONNECT_AUTH_FAIL /**< Backward compatibility */ +/* @} */ -/*! - * \enum net_security_t - * Network security levels. - */ -/** Network level security type. */ +/** Network security levels. */ typedef enum net_security_t { NW_NO_SECURITY = 0, /**< No Security. */ NW_SECURITY_LEVEL_MIC32 = 1, /**< 32-bit MIC verify, no encoding. */ @@ -124,10 +114,6 @@ typedef enum net_security_t { NW_SECURITY_LEVEL_ENC_MIC128 = 7 /**< 128-bit MIC verify with encoding. */ } net_security_t; -/*! - * \enum net_address_t - * \brief Addresses for arm_net_address_get(). - */ /** Ipv6 address type.*/ typedef enum net_address_t { ADDR_IPV6_GP, /**< Node default global address. */ @@ -135,20 +121,12 @@ typedef enum net_address_t { ADDR_IPV6_LL /**< Node default link local address. */ } net_address_t; -/*! - * \enum net_mac_address_t - * \brief MAC addresses of nodes. - */ /** MAC address type. */ typedef enum net_mac_address_t { ADDR_MAC_SHORT16, /**< Nodes 16-bit short address. */ ADDR_MAC_LONG64, /**< IP layer EUID64 based on MAC layer 64-bit long address after U/I -bit conversion. */ } net_mac_address_t; -/*! - * \enum net_tls_cipher_e - * \brief TLS cipher mode enumeration types. - */ /** TLS cipher type */ typedef enum { NET_TLS_PSK_CIPHER, /**< Network authentication support, only PSK. */ @@ -156,21 +134,13 @@ typedef enum { NET_TLS_PSK_AND_ECC_CIPHER, /**< Network authentication support, PSK & ECC. */ } net_tls_cipher_e; -/*! - * \enum net_pana_session_mode_e - * \brief PANA session cache support. - */ /** PANA session type. */ typedef enum { NET_PANA_SINGLE_SESSION, /**< Client tracks only one PANA session data, default use case. */ NET_PANA_MULTI_SESSION, /**< Client supports many Start network coordinator session data */ } net_pana_session_mode_e; -/*! - * \enum net_6lowpan_link_layer_sec_mode_e - * \brief 6LoWPAN network security & authentication modes. - */ -/** 6lowpan security mode. */ +/** 6LoWPAN network security & authentication modes. */ typedef enum { NET_SEC_MODE_NO_LINK_SECURITY, /**< Security disabled at link layer, DEFAULT. */ NET_SEC_MODE_PSK_LINK_SECURITY, /**< Link security by PSK key. */ @@ -178,11 +148,7 @@ typedef enum { } net_6lowpan_link_layer_sec_mode_e; -/*! - * \enum net_6lowpan_mode_e - * \brief 6LoWPAN bootstrap modes. - */ -/** Bootstrap mode types. */ +/** Bootstrap modes */ typedef enum { NET_6LOWPAN_BORDER_ROUTER, /**< Root device for 6LoWPAN ND. */ NET_6LOWPAN_ROUTER, /**< Router device. */ @@ -192,35 +158,25 @@ typedef enum { NET_6LOWPAN_SNIFFER /**< Sniffer device, no bootstrap. */ } net_6lowpan_mode_e; -/*! - * \enum net_6lowpan_mode_extension_e - * \brief 6LoWPAN Extension modes. - */ -/** Bootstrap extension mode types.. */ +/** 6LoWPAN Extension modes. */ typedef enum { - NET_6LOWPAN_ND_WITHOUT_MLE, /**< 6LoWPAN ND without MLE. */ + NET_6LOWPAN_ND_WITHOUT_MLE, /**< **UNSUPPORTED** */ NET_6LOWPAN_ND_WITH_MLE, /**< 6LoWPAN ND with MLE. */ NET_6LOWPAN_THREAD, /**< 6LoWPAN Thread with MLE attached. */ - NET_6LOWPAN_ZIGBEE_IP /**< 6LoWPAN ZigBeeIP setup. */ + NET_6LOWPAN_ZIGBEE_IP /**< **UNSUPPORTED** */ } net_6lowpan_mode_extension_e; -/*! - * \enum net_ipv6_mode_e - * \brief IPv6 bootstrap modes. - */ -/** IPv6 bootstrap mode type. */ +/** IPv6 bootstrap modes */ typedef enum { NET_IPV6_BOOTSTRAP_STATIC, /**< Application defines the IPv6 prefix. */ NET_IPV6_BOOTSTRAP_AUTONOMOUS /**< Interface gets IPv6 address automatically from network using ICMP and DHCP. */ } net_ipv6_mode_e; -/*! - * \struct link_layer_setups_s - * \brief Network coordinator parameter list. +/** Network coordinator parameter list. + * Structure is used to read network parameter for warm start. */ -/** Structure is used to read network parameter for warm start. */ typedef struct link_layer_setups_s { uint16_t PANId; /**< Network PAN-ID. */ uint8_t LogicalChannel; /**< Network logical channel. */ @@ -229,11 +185,7 @@ typedef struct link_layer_setups_s { uint8_t sf; /**< Network superframe setup. */ } link_layer_setups_s; -/*! - * \struct link_layer_address_s - * \brief Network MAC address info. - */ -/**Structure is used to read link layer address. */ +/** Network MAC address info. */ typedef struct link_layer_address_s { uint16_t PANId; /**< Network PAN-ID. */ uint16_t mac_short; /**< MAC short address, if <0xfffe then is valid. */ @@ -241,54 +193,32 @@ typedef struct link_layer_address_s { uint8_t iid_eui64[8]; /**< IPv6 interface identifier based on EUI-64. */ } link_layer_address_s; -/*! - * \struct network_layer_address_s - * \brief Network layer parent address info. - */ -/**Structure is used to read network layer address of the parent node. */ +/** Network layer parent address info. */ typedef struct network_layer_address_s { uint8_t border_router[16]; /**< ND Border Router Address. */ uint8_t prefix[8]; /**< Long 64-bit network ID. */ } network_layer_address_s; -/*! - * \enum net_6lowpan_gp_address_mode_e - * \brief 6LoWPAN stack address modes. - */ -/**Different addressing modes for a network interface. */ +/** Different addressing modes for a network interface. */ typedef enum { NET_6LOWPAN_GP64_ADDRESS, /**< Interface registers only GP64 address. */ NET_6LOWPAN_GP16_ADDRESS, /**< Interface registers only GP16 address. */ NET_6LOWPAN_MULTI_GP_ADDRESS, /**< Interface registers GP16 & GP64 addresses. */ } net_6lowpan_gp_address_mode_e; - -/*! - * \struct net_tls_psk_info_s - * \brief TLS PSK info structure. - */ -/**Structure is used to set TLS PSK key. */ +/** TLS PSK info */ typedef struct net_tls_psk_info_s { uint32_t key_id; /**< PSK Key ID can be 0x01-0xffff, storage size is intentionally 32 bits. */ uint8_t key[16]; /**< 128-bit PSK Key. */ } net_tls_psk_info_s; -/*! - * \struct net_link_layer_psk_security_info_s - * \brief NETWORK PSK link key structure. - */ -/**Structure is used to set link level PSK key. */ +/** NETWORK PSK link key structure. */ typedef struct { uint8_t key_id; /**< Link layer PSK Key ID, can be 0x01-0xff. */ uint8_t security_key[16]; /**< Link layer 128-bit PSK Key. */ } net_link_layer_psk_security_info_s; - -/*! - * \struct arm_certificate_chain_entry_s - * \brief Certificate chain structure. - */ -/**Structure is used to define a certificate chain. */ +/** Certificate chain structure. */ typedef struct { uint8_t chain_length; /**< Certificate chain length, indicates the chain length. */ const uint8_t *cert_chain[4]; /**< Certificate chain pointer list. */ @@ -296,11 +226,7 @@ typedef struct { const uint8_t *key_chain[4]; /**< Certificate private key. */ } arm_certificate_chain_entry_s; -/*! -* \struct ns_keys_t -* \brief Structure for the network keys used by net_network_key_get -*/ -/**Structure is used to hold currently active and previously used network keys. */ +/** Structure for the network keys used by net_network_key_get */ typedef struct ns_keys_t { @@ -310,11 +236,7 @@ typedef struct ns_keys_t uint8_t current_active_key_index; /**< The index associated to the current_active_network_key. */ } ns_keys_t; -/*! - * \struct border_router_setup_s - * \brief 6LoWPAN border router information structure. - */ -/**Structure is used to set up a border router device. */ +/** 6LoWPAN border router information structure. */ typedef struct { uint16_t mac_panid; /**< Link layer PAN-ID, accepts only < 0xfffe. */ uint16_t mac_short_adr; /**< Defines 802.15.4 short address. If the value is <0xfffe it indicates that GP16 is activated. */ @@ -325,18 +247,14 @@ typedef struct { uint32_t abro_version_num; /**< ND ABRO version number (0 when starting a new ND setup). */ } border_router_setup_s; - +/** Channel list */ typedef struct channel_list_s { - channel_page_e channel_page; - uint32_t channel_mask[8]; + channel_page_e channel_page; /**< Channel page */ + uint32_t channel_mask[8]; /**< Channel mask. Each bit defining one channel */ } channel_list_s; -/*! - * \struct network_driver_setup_s - * \brief 6LoWPAN radio interface setup. - */ -/**Structure is used to setup a network interface driver. */ +/** 6LoWPAN radio interface setup. */ typedef struct { uint16_t mac_panid; /**< Link layer PAN-ID, accepts only < 0xfffe. */ uint16_t mac_short_adr; /**< Defines 802.15.4 short address. If the value is <0xfffe it indicates that GP16 is activated. */ @@ -347,7 +265,7 @@ typedef struct { } network_driver_setup_s; /** - * \brief Init 6LoWPAN library + * Init 6LoWPAN library * * \return 0, Init OK. */ @@ -510,7 +428,7 @@ extern uint16_t arm_net_get_nwk_pan_id_filter(int8_t interface_id); * \brief Enable/Disable network ID filter. * * \param interface_id Network interface ID. - * \param nwk_id A pointer to a new network ID filter, NULL disable filter. + * \param nwk_id_filter A pointer to a new network ID filter, NULL disable filter. * * \return 0 On success. * \return -1 Unknown network ID. @@ -679,7 +597,8 @@ extern int8_t arm_pana_activate_new_key(int8_t interface_id); * * previous_active_network_key Only valid when current_active_key_index is bigger than 1. * - *\param key Pointer for key material information store. + * \param interface_id Interface + * \param key Pointer for key material information store. * * \return 0 Key read OK. * \return -1 PANA server key material not available. @@ -771,6 +690,13 @@ extern int8_t arm_nwk_6lowpan_border_router_context_remove_by_id(int8_t interfac */ extern int8_t arm_nwk_6lowpan_border_router_configure_push(int8_t interface_id); +/** + * Set timeout for default prefix on cache. + * Requires arm_nwk_6lowpan_border_router_configure_push() be called to settings be taken into use. + * \param interface_id mesh interface. + * \param time seconds + * \return 0 on success, negative value on failure. + */ extern int8_t arm_nwk_6lowpan_border_route_nd_default_prefix_timeout_set(int8_t interface_id, uint32_t time); /** @@ -816,9 +742,8 @@ extern int8_t arm_net_address_get(int8_t interface_id, net_address_t addr_id, ui /** * \brief A function to read networking addresses one by one. * \param interface_id Network interface ID. - * \param addr_id The address information type to be read. - * \param integer A pointer that is incremented every call. Start looping with n=0. - * \param address_buffer[16] A pointer to buffer where address is copied. + * \param n A pointer that is incremented every call. Start looping with n=0. + * \param address_buffer A pointer to buffer where address is copied. * \return 0 On success. * \return -1 No more addresses available. */ @@ -920,13 +845,18 @@ extern int8_t arm_net_route_delete(const uint8_t *prefix, uint8_t prefix_len, co * * * \param interface_id Network Interface ID - * \param context_data A pointer to properly built 20 bytes update array. + * \param contex_data A pointer to properly built 20 bytes update array. * * \return 0 Context reload OK. * \return <0 Load fail. */ extern int8_t arm_nwk_6lowpan_border_router_nd_context_load(int8_t interface_id, uint8_t *contex_data); //NVM +/** + * Set certificate chain for PANA + * \param chain_info Certificate chain. + * \return 0 on success, negative on failure. + */ extern int8_t arm_network_certificate_chain_set(const arm_certificate_chain_entry_s *chain_info); /** @@ -946,7 +876,7 @@ extern int8_t arm_tls_add_psk_key(const uint8_t *key_ptr, uint16_t key_id); * \param key_id PSK key ID. * * \return 0 = success - * \retun -1 = failure + * \return -1 = failure */ extern int8_t arm_tls_remove_psk_key(uint16_t key_id); @@ -956,7 +886,7 @@ extern int8_t arm_tls_remove_psk_key(uint16_t key_id); * \param key_id PSK key ID * * \return 0 = success - * \retun -1 = failure + * \return -1 = failure */ extern int8_t arm_tls_check_key(uint16_t key_id); diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_load_balance_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_load_balance_api.h index 274fd8c37f..b27df71bf3 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_load_balance_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_load_balance_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -14,8 +14,8 @@ /** * \file net_load_balance_api.h - * \brief 6Lowpan network load balance control API. - */ + * \brief 6LoWPAN network load balance control API. + */ #ifndef NET_LOAD_BALANCE_API_H_ #define NET_LOAD_BALANCE_API_H_ @@ -23,83 +23,93 @@ #include "ns_types.h" /** - * \brief load_balance_network_switch_notify this function will be called by load balance when it have detected better network to switch - * \param interface id + * \brief load_balance_network_switch_notify This function is called by the load balancer when it has detected a better network to switch to. * - * \return true Network switching can be performed immediately - * \return false means that load balance will ask at a later time for network switching, if a better network is still available at that time + * \return true The network can be switched immediately. + * \return false The load balancer will ask later a time for network switching if a better network is still available at that time. */ -typedef bool net_load_balance_network_switch_notify(int8_t interface_id); +typedef bool net_load_balance_network_switch_notify(void); /** - * \brief Set user callback for accept network switch. - * \param network_switch_notify user callback + * \brief Set user callback for accepting the network switch. + * \param interface_id Interface ID. + * \param network_switch_notify User callback. + * + * \return 0 Set OK. + * \return -1 unknown Interface. */ -void net_load_balance_network_switch_cb_set(net_load_balance_network_switch_notify *network_switch_notify); +int8_t net_load_balance_network_switch_cb_set(int8_t interface_id, net_load_balance_network_switch_notify *network_switch_notify); /** - * \brief Create and enable load balance to selected interface. - * \param interface_id interface id - * \param enable_periodic_beacon_interval Set True when want activate load balance periodic beacon, false will work only properly with fhss system + * \brief Create and enable load balance to the selected interface. + * \param interface_id Interface ID. + * \param enable_periodic_beacon_interval Set True when you want to activate load balance periodic beacon; false will work only properly with the FHSS system. * - * \return 0 Enable ok - * \return -1 unknown Interface or parameter error - * \return -2 Out of memory - * \return -3 Load balance already configured to this interface + * \return 0 Enable OK. + * \return -1 unknown Interface or parameter error. + * \return -2 Out of memory. + * \return -3 Load balance already configured to this interface. */ int8_t net_load_balance_create(int8_t interface_id, bool enable_periodic_beacon_interval); /** - * \brief Disable and delete load balansing from interface - * \param interface_id interface id + * \brief Disable and delete load balancing from the interface. + * \param interface_id Interface ID. * - * \return 0 Process ok - * \return -1 unknown Interface + * \return 0 Process OK. + * \return -1 Unknown interface. */ int8_t net_load_balance_delete(int8_t interface_id); /** - * \brief Set Load balance threshold min and max + * \brief Set load balance threshold min and max. * - * Nework switch will work next diff_priority >= randLIB_get_random_in_range(threshold_min, threshold_max) --> switch network if true - * For border router Disable Network compare set threshold_min and threshold_max to 0. - * \param threshold_min min value define random minimal value for compare - * \param threshold_max max value for define random max value for compare + * Network switch: diff_priority >= randLIB_get_random_in_range(threshold_min, threshold_max) --> switch network if true. + * For border router: Disable network compare by setting threshold_min and threshold_max to 0. * - * \return 0 process ok -1 Unknown interface id + * \param interface_id Interface ID. + * \param threshold_min Min value defines a random minimum value for compare (must be bigger than 0). + * \param threshold_max Max value defines a random maximum value for compare (must be bigger than 0). + * + * \return 0 Process OK, -1 Unknown interface ID. */ int8_t net_load_balance_threshold_set(int8_t interface_id, uint8_t threshold_min, uint8_t threshold_max); + /** - * \brief Set Load balance expected device count and enable automatic network load level update + * \brief Set the network probability percent when the new network is better than threshold max. + * + * \param interface_id Interface ID. + * \param max_p Probability percent to switch the network. Default is 25%. Accepted values are [1,100], recommend values are 10-25. + * + * \return 0 Process OK, -1 Unknown interface ID or parameter fail. + */ +int8_t net_load_balance_set_max_probability(int8_t interface_id , uint8_t max_p); + +/** + * \brief Set load balance expected device count and enable automatic network load level update. * * This feature is just for RPL DoDAG root device! * - * \param interface_id interface id - * \param expected_device_count Device count which will set max load level. If count is not expected_device_count % 8 it not zero function update number up to reach that.It is not hard limit it define max DoDAG preference + * \param interface_id Interface ID. + * \param expected_device_count Device count that sets the max load level. + * - If the count is not divisible by 8, the function rounds the number up to reach that. + * - It is not hard limit it define max DoDAG preference. + * - For hard limit, check whiteboard_api.h. * - * \return 0 process ok -1 Unknown interface id -2 Out of memory + * \return 0 Process OK, -1 Unknown interface ID, -2 Out of memory. */ int8_t net_load_balance_load_level_update_enable(int8_t interface_id, uint16_t expected_device_count); /** - * \brief Disable automatic network load level update + * \brief Disable the automatic network load level update. * - * \param interface_id interface id + * \param interface_id Interface ID. * - * \return 0 process ok -1 Unknown interface id + * \return 0 Process OK, -1 Unknown interface ID. */ int8_t net_load_balance_load_level_update_disable(int8_t interface_id); -/** - * \brief Set network probability percent when new network is better than threshold max - * - * \param interface_id interface id - * \param max_p is percent probability to switch network. Default is 40%. Accepted values are [1,100] recommend values are 15-50. - * - * \return 0 process ok -1 Unknown interface id or parameter fail - */ -int8_t net_load_balance_set_max_probability(int8_t interface_id , uint8_t max_p); #endif /* NET_LOAD_BALANCE_API_H_ */ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nvm_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nvm_api.h index 0441f038b9..0de0064738 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nvm_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nvm_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2013-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -17,21 +17,15 @@ * * \section server-api Server NVM API * - * PANA server security material is crypted always and if you change the border router RF module - * decrypt does not work properly. - * * - pana_server_nvm_callback_set(), Initialize PANA server NVM functionality. - * - pana_server_restore_from_nvm(), Load crypted PANA server base and security material from NVM. - * - pana_server_nvm_client_session_load(), Load crypted client session from NVM. + * - pana_server_restore_from_nvm(), Load PANA server base and security material from NVM. + * - pana_server_nvm_client_session_load(), Load client session from NVM. * * \section client-api Client NVM API * * nw_nvm.c use already this API and the application can just use net_nvm_api.h. * * - pana_client_nvm_callback_set(), Initialize PANA session NVM. - * - net_read_persistent_data(), Read NWK ID & MAC 16-bit address. - * - net_nvm_data_load(), Load PANA session, NWK-ID and short address to stack for re-use. - * - net_pana_client_session_nvm_data_load(), Load saved PANA session with specific address or not. * */ #ifndef PANA_NVM_API_H_ @@ -43,16 +37,34 @@ extern "C" { #endif + +/** + * \brief Pana client and common data structure for get / Update callback's + * + * Client: [session address 16-bytes] + [session data 70-bytes] , Total 86 bytes + * + * Server: [offset 2-bytes] + [session address 16-bytes] + [session port 2-bytes] + [session id 4-bytes] + [session data 92-bytes], Total 116 bytes + */ + +/** + * Size of Pana client session data without session address + */ #define PANA_CLIENT_NVM_SESSION_BUF_SIZE 70 +/** + * Size of Pana client session data with session address + */ #define PANA_CLIENT_NVM_SESSION_BUF_SIZE_WITH_ADDRESS 86 -#define NET_NVM_SESSION_BUF_SIZE_WITH_NET_PARAMS_AND_PANA 88 - -#define PANA_SERVER_CLIENT_NVM_SESSION_UNCRYPTED_DATA_SIZE 20 -#define PANA_SERVER_CLIENT_NVM_SESSION_FULL_ENCRYPTED_DATA_SIZE 96 -#define PANA_SERVER_CLIENT_NVM_SESSION_SEQUENCY_STATE_ENCRYPTED_DATA_SIZE 33 -#define PANA_SERVER_CLIENT_NVM_SESSION_BUF_SIZE (PANA_SERVER_CLIENT_NVM_SESSION_UNCRYPTED_DATA_SIZE + PANA_SERVER_CLIENT_NVM_SESSION_FULL_ENCRYPTED_DATA_SIZE) +/** + * Size of data for Server client Uodate and get callback + * + */ +#define PANA_SERVER_CLIENT_NVM_SESSION_BUF_SIZE 116 +/** + * Size of data for Server material update and restore operation + * + */ #define PANA_SERVER_MATERIAL_BUF_SIZE 90 /*! * \enum pana_nvm_update_process_t @@ -61,7 +73,6 @@ extern "C" { typedef enum pana_nvm_update_process_t { PANA_SERVER_MATERIAL_UPDATE, /**< PANA server security material update. */ PANA_SERVER_CLIENT_SESSION_UPDATE, /**< PANA client session update. */ - PANA_SERVER_CLIENT_SESSION_SEQ_UPDATE, /**< PANA client session sequence number update. */ PANA_SERVER_CLIENT_SESSION_REMOVE_UPDATE, /**< PANA client session remove. */ } pana_nvm_update_process_t; @@ -70,30 +81,104 @@ typedef enum pana_nvm_update_process_t { * \brief PANA client NVM update states. */ typedef enum pana_client_nvm_update_process_t { - PANA_CLIENT_SESSION_UPDATE, /**< PANA session information fully update. */ - PANA_CLIENT_SESSION_SEQ_UPDATE, /**< PANA key pull or push operation update REQ and RES sequence number. */ + PANA_CLIENT_SESSION_UPDATE, /**< PANA client session update. */ + PANA_CLIENT_SESSION_REMOVE, /**< PANA client session remove. */ } pana_client_nvm_update_process_t; +/*! + * \struct wpan_nvm_params_t + * \brief Network nvm parameters. + */ +typedef struct wpan_nvm_params { + uint16_t pan_id; /**< WPAN Pan-id. */ + uint32_t mac_security_frame_counter; /**< Mac security counter. */ + uint32_t mle_securit_counter; /**< MLE security counter. */ +} wpan_nvm_params_t; + +/** + * \brief NVM memory user callback for updated parameters + * + * \param parameters Updated wpan parameters + */ +typedef void wpan_params_updated(wpan_nvm_params_t *parameters); + +/** + * \brief NVM memory user for get parameter->pan_id network setup + * + * \param parameters Pointer for request parameters parameter->pan_id is configured for proper setup + * + * \return true when configure is loaded to buffer + * \return false when there is no proper data for current wpan + */ +typedef bool wpan_params_get(wpan_nvm_params_t *parameters); + +/** + * \brief Pana client session update callback + * + * \param pan_id define which pan session is + * \param process PANA_CLIENT_SESSION_UPDATE or PANA_CLIENT_SESSION_REMOVE + */ +typedef void pana_client_session_update_cb(uint16_t pan_id, pana_client_nvm_update_process_t process); + +/** + * \brief Pana client discover session from NVM user based on pan id + * + * \param pan_id define which pan session is + * + * \return true When Session is stored to behind given session buffer + * \return false NVM can't detect session for given pan id + */ +typedef bool pana_client_session_get_cb(uint16_t pan_id); + +/** + * \brief Pana server call this when it create /Update / delete client session or update Server material + * + * \param operation Pana server NVM update + * + * \return session offset . Requirement for operation PANA_SERVER_CLIENT_SESSION_UPDATE + */ +typedef uint16_t pana_server_update_cb(pana_nvm_update_process_t operation); + +/** + * \brief Pana server call this when discover client session from NVM for given address + * + * \param linklocal_address Link local address for sesion + * + * \return true When Session is stored to behind given session buffer + * \return false NVM can't detect session for given address + */ +typedef bool pana_server_session_get_cb(uint8_t *linklocal_address); + +/** + * \brief Pana server call this when discover client session from NVM for pana session + * + * \param session_id Pana session Id + * + * \return true When Session is stored to behind given session buffer + * \return false NVM can't detect session for given session id + */ +typedef bool pana_server_session_get_by_id_cb(uint32_t session_id); + /* NVM API PART */ /** * \brief PANA server NVM functionality initialization. * - * \param passed_fptr A function pointer to NVM update process. - * \param nvm_static_buffer A pointer to application allocated static memory, minimum size 115 bytes. + * \param update_cb A function pointer to NVM update process. + * \param nvm_get A function pointer for discover session data from NVM by link local address + * \param nvm_session_get A function pointer for discover session data from NVM by pana session id + * \param nvm_static_buffer A pointer to application allocated static memory, minimum size PANA_SERVER_CLIENT_NVM_SESSION_BUF_SIZE (116 bytes). * * - * Reference callback function structure using EEPROM: - * - nvm_static_buffer Application is allocated a static buffer. - * * \return 0, Init OK. * \return -1, Null parameter detect. * */ -extern int8_t pana_server_nvm_callback_set(uint16_t (*passed_fptr)(pana_nvm_update_process_t), uint8_t *nvm_static_buffer); +extern int8_t pana_server_nvm_callback_set(pana_server_update_cb *update_cb, pana_server_session_get_cb *nvm_get, pana_server_session_get_by_id_cb *nvm_session_get, uint8_t *nvm_static_buffer); /** * \brief PANA server base restore from NVM. * - * \param nvm_data A pointer to encrypted PANA server base data. + * \param nvm_data A pointer to PANA server base data. + * \param interface_id Interface ID. * * \return 0, Restore OK. * \return -1, Memory allocation fail. @@ -103,7 +188,7 @@ extern int8_t pana_server_restore_from_nvm(uint8_t *nvm_data, int8_t interface_i /** * \brief PANA client session load from NVM API. * - * \param nvm_data A pointer to encrypted PANA client session. + * \param nvm_pointer A pointer PANA client session. * * \return 0, Restore OK. * \return -1, Memory allocation fail. @@ -114,59 +199,17 @@ extern int8_t pana_server_nvm_client_session_load(uint8_t *nvm_pointer); /** * \brief PANA client NVM functionality init. * - * \param passed_fptr A function pointer to NVM update process. - * \param nvm_static_buffer A pointer to application allocated static memory, minimum size 88 bytes. + * \param nvm_update A function pointer to NVM update process. + * \param nvm_get A function pointer for discover session from NVM for given Pan-id + * \param nvm_static_buffer A pointer to application allocated static memory, minimum size for session 86 bytes + 16-bit pan-id. * - * Reference callback function structure using EEPROM: - * - nvm_static_buffer Application allocated static buffer. * * \return 0, Init OK. * \return -1, Null parameter detect. * */ -extern int8_t pana_client_nvm_callback_set(void (*passed_fptr)(pana_client_nvm_update_process_t), uint8_t *nvm_static_buffer); -/** - * \brief Read network persistent data. - * - * \param data_buffer A pointer to location where the stack saves 18 bytes [NWK-ID 16bytes, Short Address 2bytes]. - * - * - * \return 0, Read OK. - * \return -1, Null parameter detected. - * \return -2 Bootstrap not ready yet. - * - * This function should call when network bootstrap is ready. - * - */ -extern int8_t net_read_persistent_data(uint8_t *data_buffer, int8_t interface_id); -/** - * \brief Load ZigBeeIP node persistent data to stack for re-use. - * - * \param data_buffer A pointer to data with 88 bytes [NWK-ID 16bytes, Short Address 2bytes, Pana 70 bytes]. - * - * - * \return 0, Read OK. - * \return -1, Null parameter detected. - * \return -2, Stack is active. - * \return <-2 Memory allocation fail. - * - */ -extern int8_t net_nvm_data_load(uint8_t *data_buffer, int8_t interface_id); +extern int8_t pana_client_nvm_callback_set(pana_client_session_update_cb *nvm_update, pana_client_session_get_cb *nvm_get,uint8_t *nvm_static_buffer); -/** - * \brief Load PANA client session data to the stack for re-use. - * - * \param data_buffer A pointer to data with encrypted PANA session 70 bytes. - * \param session_address A pointer to a session-specific address. Give the address if you want to re-use the session with specific parent, otherwise give NULL. - * - * - * \return 0, Read OK. - * \return -1, Null parameter detected. - * \return -2, Stack is active. - * \return <-2 Memory allocation fail. - * - */ -extern int8_t net_pana_client_session_nvm_data_load(uint8_t *data_buffer, uint8_t *session_address, int8_t interface_id); /** * \brief Clean node persistent data and all PANA client sessions from the stack. * @@ -178,6 +221,51 @@ extern int8_t net_pana_client_session_nvm_data_load(uint8_t *data_buffer, uint8_ * */ extern int8_t net_nvm_data_clean(int8_t interface_id); + +/** + * \brief Enable and init network NVM parameter automatic update. + * + * This function enables MAC and MLE protocol critical components update process to NVM memory user. + * + * \param interface_id Interface ID. + * \param nvm_update_cb Function pointer for update NVM + * \param nvm_get_cb Function for stack to request setup from NVM. + * + * + * \return 0, Init OK. + * \return -1, Unknown Interface. + * \return -2, Memory allocation fail. + * + */ +extern int8_t net_nvm_wpan_params_storage_enable(int8_t interface_id, wpan_params_updated *nvm_update_cb, wpan_params_get *nvm_get_cb); + +/** + * \brief Reset stored WPAN parameter's at interface . + * + * This function clean state at WPAN params at stack. Force Request from NVM + * + *\param interface_id Interface ID. + * + * \return 0, reset OK. + * \return -1, Unknown Interface. + * + */ +extern int8_t net_nvm_wpan_params_storage_reset(int8_t interface_id); + + +/** + * \brief Disable stored WPAN parameter's to interface . + * + * + *\param interface_id Interface ID. + * + * \return 0, Disable OK. + * \return -1, Unknown Interface. + * + */ +extern int8_t net_nvm_wpan_params_storage_disable(int8_t interface_id); + + #ifdef __cplusplus } #endif diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nwk_scan.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nwk_scan.h index 1c44151340..2290af9220 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nwk_scan.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_nwk_scan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2013-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_pana_parameters_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_pana_parameters_api.h index 8a9aa801a7..df6e253a59 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_pana_parameters_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_pana_parameters_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_polling_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_polling_api.h index 5f724e2290..a16b516552 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_polling_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_polling_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2013-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_rpl.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_rpl.h index 909090a013..53af21b311 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_rpl.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_rpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2013-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -26,6 +26,7 @@ extern "C" { * * This API is primarily used with a border router. You can also use it with a basic router. * + * - arm_nwk_6lowpan_rpl_memory_limit_set(), Set RPL global memory limit sizes. Call this only at boot ones. * - arm_nwk_6lowpan_rpl_dodag_init(), Allocate and init RPL DODAG root. * - arm_nwk_6lowpan_rpl_dodag_remove(), Remove DDAG root, specifically. * - arm_nwk_6lowpan_rpl_dodag_start(), Activate RPL DODAG instance. @@ -48,54 +49,68 @@ extern "C" { * */ -/* DoDag Root setups */ -/* DODAGPreference (Prf): A 3-bit unsigned integer that defines how +/** \name DoDag Root setups + * DODAGPreference (Prf): A 3-bit unsigned integer that defines how preferable the root of this DODAG is compared to other DODAG roots within the instance. DAGPreference ranges from 0x00 (least preferred) to 0x07 (most preferred). The default is 0 - (least preferred). */ -#define RPL_DODAG_PREF_MASK 0x07 -#define RPL_DODAG_PREF(n) ((n) & RPL_DODAG_PREF_MASK) + (least preferred). + * + * @{ + */ +#define RPL_DODAG_PREF_MASK 0x07 /**< Preference mask */ +#define RPL_DODAG_PREF(n) ((n) & RPL_DODAG_PREF_MASK) /**< DODAG preference */ +/** @} */ -/* Mode of Operation (MOP): The Mode of Operation (MOP) field identifies + +/** \name Mode of Operation (MOP) + * The Mode of Operation (MOP) field identifies the mode of operation of the RPL instance as administratively provisioned at and distributed by the DODAG root. All nodes joining the DODAG must be able to honor the MOP to fully participate as a router. Otherwise, they must only join as a leaf. -*/ -#define RPL_MODE_MASK 0x38 -#define RPL_MODE_SHIFT 3 -#define RPL_MODE_NO_DOWNWARD 0x00 -#define RPL_MODE_NON_STORING 0x08 -#define RPL_MODE_STORING 0x10 -#define RPL_MODE_STORING_MULTICAST 0x18 -#define RPL_MODE_P2P_DISCOVERY 0x20 /* RFC 6997 */ + * @{ + */ +#define RPL_MODE_MASK 0x38 /**< MOP mask */ +#define RPL_MODE_SHIFT 3 /**< shift count */ +#define RPL_MODE_NO_DOWNWARD 0x00 /**< No Downward routes maintained by RPL */ +#define RPL_MODE_NON_STORING 0x08 /**< Non-Storing Mode of Operation */ +#define RPL_MODE_STORING 0x10 /**< Storing Mode of Operation with no multicast support */ +#define RPL_MODE_STORING_MULTICAST 0x18 /**< Storing Mode of Operation with multicast support */ +#define RPL_MODE_P2P_DISCOVERY 0x20 /**< RFC 6997 */ +/** @} */ -/* Grounded (G): The Grounded 'G' flag indicates whether the DODAG +/** Grounded (G): The Grounded 'G' flag indicates whether the DODAG advertised can satisfy the application-defined goal. If the flag is set, the DODAG is grounded. If the flag is cleared, the DODAG is floating. */ #define RPL_GROUNDED 0x80 -/** FOR BACKWARDS COMPATIBILITY **/ -#define BR_DODAG_PREF_0 RPL_DODAG_PREF(0) -#define BR_DODAG_PREF_1 RPL_DODAG_PREF(1) -#define BR_DODAG_PREF_2 RPL_DODAG_PREF(2) -#define BR_DODAG_PREF_3 RPL_DODAG_PREF(3) -#define BR_DODAG_PREF_4 RPL_DODAG_PREF(4) -#define BR_DODAG_PREF_5 RPL_DODAG_PREF(5) -#define BR_DODAG_PREF_6 RPL_DODAG_PREF(6) -#define BR_DODAG_PREF_7 RPL_DODAG_PREF(7) -#define BR_DODAG_MOP_NON_STORING RPL_MODE_NON_STORING -#define BR_DODAG_MOP_STORING RPL_MODE_STORING -#define BR_DODAG_FLOATING 0 -#define BR_DODAG_GROUNDED RPL_GROUNDED +/** \name FOR BACKWARDS COMPATIBILITY + * @{ + */ +#define BR_DODAG_PREF_0 RPL_DODAG_PREF(0) /**< backward compatibility */ +#define BR_DODAG_PREF_1 RPL_DODAG_PREF(1) /**< backward compatibility */ +#define BR_DODAG_PREF_2 RPL_DODAG_PREF(2) /**< backward compatibility */ +#define BR_DODAG_PREF_3 RPL_DODAG_PREF(3) /**< backward compatibility */ +#define BR_DODAG_PREF_4 RPL_DODAG_PREF(4) /**< backward compatibility */ +#define BR_DODAG_PREF_5 RPL_DODAG_PREF(5) /**< backward compatibility */ +#define BR_DODAG_PREF_6 RPL_DODAG_PREF(6) /**< backward compatibility */ +#define BR_DODAG_PREF_7 RPL_DODAG_PREF(7) /**< backward compatibility */ +#define BR_DODAG_MOP_NON_STORING RPL_MODE_NON_STORING /**< backward compatibility */ +#define BR_DODAG_MOP_STORING RPL_MODE_STORING /**< backward compatibility */ +#define BR_DODAG_FLOATING 0 /**< backward compatibility */ +#define BR_DODAG_GROUNDED RPL_GROUNDED /**< backward compatibility */ +/** @} */ -/* Compatibility for even older misspellings */ -#define BR_DODAG_MOP_NON_STRORING BR_DODAG_MOP_NON_STORING -#define BR_DODAG_MOP_STRORING BR_DODAG_MOP_STORING -#define BR_DODAG_FLOATIN BR_DODAG_FLOATING +/** \name Compatibility for even older misspellings + * @{ + */ +#define BR_DODAG_MOP_NON_STRORING BR_DODAG_MOP_NON_STORING /**< backward compatibility */ +#define BR_DODAG_MOP_STRORING BR_DODAG_MOP_STORING /**< backward compatibility */ +#define BR_DODAG_FLOATIN BR_DODAG_FLOATING /**< backward compatibility */ +/** @} */ /** RPL ROOT parent flag */ #define RPL_ROOT_PARENT 0 @@ -151,6 +166,7 @@ typedef struct dodag_config_t { /** * \brief RPL DODAG root base allocate. * + * \param interface_id Interface ID * \param dodag_id A pointer to unique DODAGID. This must be the node's GP address in the ZigBeeIP network. * \param config A pointer to the DODAG configure structure. * \param instace_id Instance ID for RPL DODAG. @@ -162,10 +178,23 @@ typedef struct dodag_config_t { * */ extern int8_t arm_nwk_6lowpan_rpl_dodag_init(int8_t interface_id, const uint8_t *dodag_id, const dodag_config_t *config, uint8_t instace_id, uint8_t flags); + /** - * \brief RPL DODAG remove by given instance ID. + * \brief RPL Global memory size limits. * - * \param instace_id Instance ID for removed DODAG. + * Calling this function you can update default memory limits. Soft default is 1024 and hard limit is 2048. + * \param soft_limit When RPL reach this state at total allocation it start cleaning unused data. + * \param hard_limit Total allocation limit. 0 means no limit and > 0 define hard limit. When hard limit > 0 soft_limit must be smaller than hard. + * + * \return 0, Set OK. + * \return -1, Unsupported parameter + * + */ +extern int8_t arm_nwk_6lowpan_rpl_memory_limit_set(size_t soft_limit, size_t hard_limit); +/** + * \brief RPL DODAG remove by given interface ID. + * + * \param interface_id Interface ID for removed DODAG. * * \return 0, Remove OK. * \return -1, Remove fail. diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_sleep.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_sleep.h index b4ba138513..a33f2b1911 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_sleep.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_sleep.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_thread_test.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_thread_test.h index a49cafb655..62e2b43b9a 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_thread_test.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_thread_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -11,6 +11,14 @@ * See the License for the specific language governing permissions and limitations under the License. * */ + +#ifndef NET_THREAD_TEST_H_ +#define NET_THREAD_TEST_H_ + +/* Prevent this file being inserted in public Doxygen generated file + * this is not part of our external API. */ +#ifndef DOXYGEN + /** * \file net_thread_test.h * \brief Thread Library Test API. @@ -21,8 +29,6 @@ * */ -#ifndef NET_THREAD_TEST_H_ -#define NET_THREAD_TEST_H_ #ifdef __cplusplus extern "C" { @@ -345,6 +351,19 @@ int thread_test_partition_info_get(int8_t interface_id, uint32_t *partition_id, */ int thread_test_partition_info_set(int8_t interface_id, uint32_t partition_id); +/** + * \brief Get thread information. + * + * \param interface_id Network Interface + * \param short_addr own short address + * \param router_count amount of active routers in network + * \param network_stable stable network achieved no upgrade or downgrade pending + * + * \return 0, Set OK + * \return <0 Set Fail + */ +int8_t thread_test_thread_information_get(int8_t interface_id, uint16_t *short_addr, uint8_t *router_count, bool *network_stable); + /** * \brief Get child count * @@ -446,4 +465,5 @@ int8_t thread_test_joiner_router_joiner_port_set(uint16_t port); } #endif +#endif /* DOXYGEN */ #endif /* NET_THREAD_TEST_H_ */ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ns_address.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ns_address.h index 5ab483fb6c..3689d42894 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ns_address.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ns_address.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2010-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ns_mdns_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ns_mdns_api.h new file mode 100644 index 0000000000..775afa60f7 --- /dev/null +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/ns_mdns_api.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2017 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: LicenseRef-PBL + * + * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.mbed.com/licenses/PBL-1.0 + * + * See the License for the specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _NS_MDNS_API_H_ +#define _NS_MDNS_API_H_ + +typedef struct ns_mdns_service *ns_mdns_service_t; +typedef struct ns_mdns *ns_mdns_t; + +/*! + * \struct ns_mdns_service_param_t + * \brief Structure for mDNS service parameters + */ +typedef struct ns_mdns_service_param +{ + const char *service_type; /**< Null-terminated string owned by the caller */ + uint16_t service_port; /**< Service Port number */ + const uint8_t *(*service_get_txt)(void); /**< Call-back function, which returns a pointer to the service TXT record (null-terminated). + If the service does not provide any TXT record, this parameter must be set to NULL. */ +} ns_mdns_service_param_t; + +/** + * \brief Start mDNS server + * + * \param server_name NULL terminated string, max length 63 characters + * + * \param ttl time-to-live value in seconds, if set to 0 default value is used + * + * \param ttl_ip time-to-live in hop count, if set to 0 default value is used + * + * \param interface_id ID of the network interface where mDNS will operate + * + * \return mDNS server instace or NULL in case of failure.. + */ +ns_mdns_t ns_mdns_server_start(const char *server_name, uint32_t ttl, uint32_t ttl_ip, int8_t interface_id); + +/** + * \brief Stop mDNS server + * + * \param ns_mdns Server instance received from ns_mdns_server_start + * + */ +void ns_mdns_server_stop(ns_mdns_t ns_mdns); + +/** + * \brief Register service to mDNS server + * + * \param ns_mdns Server instance received from ns_mdns_server_start + * + * \param service Parameters for service + * + * \return mDNS Service descriptor or NULL in case of failure. + * + */ +ns_mdns_service_t ns_mdns_service_register(ns_mdns_t ns_mdns, ns_mdns_service_param_t *service); + +/** + * \brief Unregister service from mDNS server + * + * \param service_desc mDNS Service descriptor received from call to ns_mdns_service_register. + */ + +void ns_mdns_service_unregister(ns_mdns_service_t service_desc); + +/** + * \brief Send mDNS announcement. Application should call this method once application + * advertised parameters has changed. + * + * \param ns_mdns Server instance received from ns_mdns_server_start + */ + +void ns_mdns_announcement_send(ns_mdns_t ns_mdns); + +#endif /* _NS_MDNS_API_H_ */ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/nwk_stats_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/nwk_stats_api.h index 5a5f33d11c..9e40d84977 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/nwk_stats_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/nwk_stats_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2013-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -51,13 +51,6 @@ typedef struct nwk_stats_t { uint32_t mac_tx_cca_cnt; /**< MAC TX CCA count. */ uint32_t mac_tx_failed_cca; /**< MAC failed CCA count. */ uint32_t mac_security_drop; /**< MAC security packet drops count. */ - /* FHSS stats */ - int16_t fhss_drift_compensation; /**< FHSS synchronization drift compensation (us/channel). */ - uint8_t fhss_hop_count; /**< FHSS hop count. */ - int8_t fhss_synch_parent_rssi; /**< FHSS synchronization parent RSSI. */ - uint16_t fhss_synch_interval; /**< FHSS synchronization interval (s). */ - int16_t fhss_prev_avg_synch_fix; /**< Average of 5 preceding synchronization fixes (us). Updated after every fifth synch fix.*/ - uint32_t fhss_synch_lost; /**< FHSS synchronization lost counter. */ /* 6Lowpan */ uint32_t ip_rx_count; /**< IP RX packet count. */ uint32_t ip_tx_count; /**< IP TX packet count. */ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h index f426b99fa7..c57544080b 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_aes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h index 34432a5ba4..439194d945 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/arm_hal_phy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -150,10 +150,10 @@ typedef struct phy_device_channel_page_s /** Virtual data request */ typedef struct virtual_data_req_s { - uint16_t parameter_length; - uint8_t *parameters; - uint16_t msduLength; - const uint8_t *msdu; + uint16_t parameter_length; /**< Length of user specified header. Can be zero. */ + uint8_t *parameters; /**< Pointer to user specified header. Optional */ + uint16_t msduLength; /**< MSDU Length */ + const uint8_t *msdu; /**< MSDU */ } virtual_data_req_t; /** @@ -195,6 +195,33 @@ typedef int8_t arm_net_virtual_rx_fn(const uint8_t *data_ptr, uint16_t data_len, */ typedef int8_t arm_net_virtual_tx_fn(const virtual_data_req_t *data_req,int8_t driver_id); +/** + * @brief arm_net_virtual_config Configuration receive callback set by upper layer. Used to receive internal configuration parameters. + * @param driver_id Id of the driver to be used. + * @param data Pointer to received configuration data. + * @param length Length of the configuration data. + * @return 0 if success, error otherwise + */ +typedef int8_t arm_net_virtual_config_rx_fn(int8_t driver_id, const uint8_t *data, uint16_t length); + +/** + * @brief arm_net_virtual_config Configuration send callback set by upper layer. Used to send internal configuration parameters. + * @param driver_id Id of the driver to be used. + * @param data Pointer to sent configuration data. + * @param length Length of the configuration data. + * @return 0 if success, error otherwise + */ +typedef int8_t arm_net_virtual_config_tx_fn(int8_t driver_id, const uint8_t *data, uint16_t length); + +/** + * @brief arm_net_virtual_confirmation Confirmation receive callback set by upper layer. Used to receive MLME confirmation data. + * @param driver_id Id of the driver to be used. + * @param data Pointer to received confirmation data. + * @param length Length of the confirmation data. + * @return 0 if success, error otherwise + */ +typedef int8_t arm_net_virtual_confirmation_rx_fn(int8_t driver_id, const uint8_t *data, uint16_t length); + /** Device driver structure */ typedef struct phy_device_driver_s { @@ -217,6 +244,9 @@ typedef struct phy_device_driver_s //Virtual upper data rx arm_net_virtual_rx_fn *arm_net_virtual_rx_cb; /**< Virtual RX callback. Initialized by \ref arm_net_phy_register(). */ arm_net_virtual_tx_fn *arm_net_virtual_tx_cb; /**< Virtual TX callback. Initialized by \ref arm_net_phy_register(). */ + arm_net_virtual_config_rx_fn *virtual_config_rx_cb; /**< Virtual config receive callback. Initialized by \ref arm_net_phy_register(). */ + arm_net_virtual_config_tx_fn *virtual_config_tx_cb; /**< Virtual config send callback. Initialized by \ref arm_net_phy_register(). */ + arm_net_virtual_confirmation_rx_fn *virtual_confirmation_rx_cb; /**< Virtual confirmation receive callback. Initialized by \ref arm_net_phy_register(). */ uint16_t tunnel_type; /**< Tun driver type. */ } phy_device_driver_s; diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/os_whiteboard.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/os_whiteboard.h index ab849e7fb1..1322bba27b 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/os_whiteboard.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/os_whiteboard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/topo_trace.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/topo_trace.h index 9014bea37b..a506fa11fd 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/topo_trace.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/platform/topo_trace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/serial_mac_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/serial_mac_api.h index 4c6adda17e..0630287581 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/serial_mac_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/serial_mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2016-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -29,6 +29,12 @@ struct virtual_data_req_s; typedef struct serial_mac_api_s serial_mac_api_t; +/** + * Create serial MAC + * @param serial_driver_id PHY driver ID. + * @return Serial MAC callback structure on success. + * @return NULL on failure. + */ extern serial_mac_api_t *serial_mac_create(int8_t serial_driver_id); /** @@ -64,11 +70,14 @@ typedef int8_t serial_mac_api_initialize(serial_mac_api_t *api, data_indication */ typedef int8_t serial_mac_virtual_initialize(const serial_mac_api_t *api, int8_t driver_id); +/** + * Serial MAC callback structure. + */ struct serial_mac_api_s { - serial_mac_api_initialize *mac_initialize; //Inititilize data callback - serial_mac_virtual_initialize * virtual_initilize; //Enable bridge to virtual driver - data_request *data_request_cb; - data_indication *data_ind_cb; + serial_mac_api_initialize *mac_initialize; /**< Inititilize data callback */ + serial_mac_virtual_initialize * virtual_initilize; /**< Enable bridge to virtual driver */ + data_request *data_request_cb; /**< Data request callback */ + data_indication *data_ind_cb; /**< Data indication callback */ }; #ifdef __cplusplus diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/socket_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/socket_api.h index 8023d52a6b..82d3f85190 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/socket_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/socket_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2010-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -248,7 +248,7 @@ typedef struct ns_in6_pktinfo { } ns_in6_pktinfo_t; -/** \privatesection Alignment macros for control message headers +/** \name Alignment macros for control message headers * \anchor CMSG_ALIGN_FLAGS */ ///@{ @@ -262,7 +262,7 @@ typedef struct ns_in6_pktinfo { ((length + (aligment_base -1 )) & ~(aligment_base -1)) #endif ///@} -/// \publicsection + /** * \brief Parse first control message header from message ancillary data. * @@ -319,7 +319,6 @@ ns_cmsghdr_t *NS_CMSG_NXTHDR(const ns_msghdr_t *msgh, const ns_cmsghdr_t *cmsg); #define NS_CMSG_LEN(length) \ (NS_ALIGN_SIZE(sizeof(ns_cmsghdr_t), CMSG_DATA_ALIGN) + length) - /** IPv6 wildcard address IN_ANY */ extern const uint8_t ns_in6addr_any[16]; @@ -687,9 +686,35 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad #define SOCKET_SO_SNDLOWAT 4 ///@} -/** \name Option names for protocol level SOCKET_IPPROTO_IPV6. +/** \name IPv6 socket options * \anchor OPTNAMES_IPV6 + * + * IPv6 socket options summary + * + * | opt_name / cmsg_type | Data type | set/getsockopt | sendmsg | recvmsg | + * | :--------------------------: | :--------------: | :-------------: | :-----: | :-------------------------------: | + * | SOCKET_IPV6_TCLASS | int16_t | Yes | Yes | If enabled with RECVTCLASS | + * | SOCKET_IPV6_UNICAST_HOPS | int16_t | Yes | No | No | + * | SOCKET_IPV6_MULTICAST_HOPS | int16_t | Yes | No | No | + * | SOCKET_IPV6_ADDR_PREFERENCES | int | Yes | No | No | + * | SOCKET_IPV6_USE_MIN_MTU | int8_t | Yes | Yes | No | + * | SOCKET_IPV6_DONTFRAG | int8_t | Yes | Yes | No | + * | SOCKET_IPV6_FLOW_LABEL | int32_t | Yes | No | No | + * | SOCKET_IPV6_HOPLIMIT | int16_t | No | Yes | If enabled with RECVHOPLIMIT | + * | SOCKET_IPV6_PKTINFO | ns_in6_pktinfo_t | No | Yes | If enabled with RECVPKTINFO | + * | SOCKET_IPV6_RECVPKTINFO | bool | Yes | No | No | + * | SOCKET_IPV6_RECVHOPLIMIT | bool | Yes | No | No | + * | SOCKET_IPV6_RECVTCLASS | bool | Yes | No | No | + * | SOCKET_IPV6_MULTICAST_IF | int8_t | Yes | No | No | + * | SOCKET_IPV6_MULTICAST_LOOP | bool | Yes | Yes | No | + * | SOCKET_IPV6_JOIN_GROUP | ns_ipv6_mreq_t | Set only | No | No | + * | SOCKET_IPV6_LEAVE_GROUP | ns_ipv6_mreq_t | Set only | No | No | + * | SOCKET_BROADCAST_PAN | int8_t | Yes | No | No | + * | SOCKET_LINK_LAYER_SECURITY | int8_t | Yes | No | No | + * | SOCKET_INTERFACE_SELECT | int8_t | Yes | No | No | + * */ + ///@{ /** Specify traffic class for outgoing packets, as int16_t (RFC 3542 S6.5 says int); valid values 0-255, or -1 for system default. */ #define SOCKET_IPV6_TCLASS 1 @@ -713,39 +738,29 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad /** Specify socket_recvmsg() ancillary data request state for Packet info (destination address and interface id), as bool; valid values true write enabled, false write disabled */ #define SOCKET_IPV6_RECVPKTINFO 10 /** Specify socket_recvmsg() ancillary data request state for receive messages hop-limit, as bool; valid values true write enabled, false information write disabled */ -#define SOCKET_IPV6_RECVHOPLIMIT 11 +#define SOCKET_IPV6_RECVHOPLIMIT 11 /** Specify socket_recvmsg() ancillary data request state for receive messages traffic class, as bool; valid values true write enabled, false information write disabled */ -#define SOCKET_IPV6_RECVTCLASS 12 +#define SOCKET_IPV6_RECVTCLASS 12 + +/** Set the interface to use for outgoing multicast packets, as int8_t (RFC3493 S5.2 says unsigned int); 0 means unspecified (use routing table) */ +#define SOCKET_IPV6_MULTICAST_IF 13 +/** Specify whether outgoing multicast packets are looped back, as bool (RFC3493 S5.2 says unsigned int) */ +#define SOCKET_IPV6_MULTICAST_LOOP 14 +/** Join a multicast group, using ns_ipv6_mreq_t */ +#define SOCKET_IPV6_JOIN_GROUP 15 +/** Leave a multicast group, using ns_ipv6_mreq_t */ +#define SOCKET_IPV6_LEAVE_GROUP 16 #define SOCKET_BROADCAST_PAN 0xfc /**< Internal use - transmit with IEEE 802.15.4 broadcast PAN ID */ #define SOCKET_LINK_LAYER_SECURITY 0xfd /**< Not standard enable or disable socket security at link layer (For 802.15.4). */ #define SOCKET_INTERFACE_SELECT 0xfe /**< Not standard socket interface ID. */ #define SOCKET_IPV6_ADDRESS_SELECT 0xff /**< Deprecated - use SOCKET_IPV6_ADDR_PREFERENCES instead. */ -/** IPv6 socket options summary - * - * | opt_name / cmsg_type | Data type | set/getsockopt | sendmsg | recvmsg | - * | :--------------------------: | :--------------: | :-------------: | :-----: | :-------------------------------: | - * | SOCKET_IPV6_TCLASS | int16_t | Yes | Yes | If enabled with RECVTCLASS | - * | SOCKET_IPV6_UNICAST_HOPS | int16_t | Yes | No | No | - * | SOCKET_IPV6_MULTICAST_HOPS | int16_t | Yes | No | No | - * | SOCKET_IPV6_ADDR_PREFERENCES | int | Yes | No | No | - * | SOCKET_IPV6_USE_MIN_MTU | int8_t | Yes | Yes | No | - * | SOCKET_IPV6_DONTFRAG | int8_t | Yes | Yes | No | - * | SOCKET_IPV6_FLOW_LABEL | int32_t | Yes | No | No | - * | SOCKET_IPV6_HOPLIMIT | int16_t | No | Yes | If enabled with RECVHOPLIMIT | - * | SOCKET_IPV6_PKTINFO | ns_in6_pktinfo_t | No | Yes | If enabled with RECVPKTINFO | - * | SOCKET_IPV6_RECVPKTINFO | bool | Yes | No | No | - * | SOCKET_IPV6_RECVHOPLIMIT | bool | Yes | No | No | - * | SOCKET_IPV6_RECVTCLASS | bool | Yes | No | No | - * | SOCKET_BROADCAST_PAN | int8_t | Yes | No | No | - * | SOCKET_LINK_LAYER_SECURITY | int8_t | Yes | No | No | - * | SOCKET_INTERFACE_SELECT | int8_t | Yes | No | No | - * - * - */ - -///@} +/** Multicast group request used for setsockopt() */ +typedef struct ns_ipv6_mreq { + uint8_t ipv6mr_multiaddr[16]; /**< IPv6 multicast address */ + int8_t ipv6mr_interface; /**< interface id */ +} ns_ipv6_mreq_t; /** * \brief Set an option for a socket @@ -767,6 +782,8 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad */ int8_t socket_setsockopt(int8_t socket, uint8_t level, uint8_t opt_name, const void *opt_value, uint16_t opt_len); +///@} + /** * \brief Get an option for a socket. * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/sw_mac.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/sw_mac.h index c10c3f6cbc..f40396666e 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/sw_mac.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/sw_mac.h @@ -28,6 +28,7 @@ extern "C" { struct protocol_interface_rf_mac_setup; struct mac_api_s; struct mac_description_storage_size_s; +struct fhss_api; /** * @brief Creates 802.15.4 MAC API instance which will use RF driver given @@ -53,6 +54,14 @@ extern int8_t ns_sw_mac_virtual_client_register(struct mac_api_s *api, int8_t vi */ extern int8_t ns_sw_mac_virtual_client_unregister(struct mac_api_s *api); +/** + * @brief Registers created FHSS API instance to given software MAC instance. + * @param mac_api MAC instance. + * @param fhss_api FHSS instance. + * @return 0 on success, -1 on fail. + */ +extern int ns_sw_mac_fhss_register(struct mac_api_s *mac_api, struct fhss_api *fhss_api); + #ifdef __cplusplus } diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_border_router_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_border_router_api.h index d468b93dc7..72739b5ea0 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_border_router_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_border_router_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 ARM Limited. All rights reserved. + * Copyright (c) 2014-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -31,15 +31,15 @@ * \brief Border router network data structure. */ typedef struct thread_border_router_info_t { - unsigned Prf: 2; /**!< Prefix preference, 01 = High, 00 = Default, 11 = Low, 10 = Reserved. */ - bool P_preferred: 1; /**!< Address is considered preferred address. */ - bool P_slaac: 1; /**!< Allowed to configure a new address */ - bool P_dhcp: 1; /**!< DHCPv6 server is available in the network. */ - bool P_configure: 1; /**!< DHCPv6 agent provides other configuration. */ - bool P_default_route: 1; /**!< This device provides the default route. */ - bool P_on_mesh: 1; /**!< This prefix is considered to be on-mesh */ - bool P_nd_dns: 1; /**!< this border router is able to provide DNS information */ - bool stableData: 1; /**!< This data is stable and expected to be available at least 48h. */ + unsigned Prf: 2; /**< Prefix preference, 01 = High, 00 = Default, 11 = Low, 10 = Reserved. */ + bool P_preferred: 1; /**< Address is considered preferred address. */ + bool P_slaac: 1; /**< Allowed to configure a new address */ + bool P_dhcp: 1; /**< DHCPv6 server is available in the network. */ + bool P_configure: 1; /**< DHCPv6 agent provides other configuration. */ + bool P_default_route: 1; /**< This device provides the default route. */ + bool P_on_mesh: 1; /**< This prefix is considered to be on-mesh */ + bool P_nd_dns: 1; /**< this border router is able to provide DNS information */ + bool stableData: 1; /**< This data is stable and expected to be available at least 48h. */ } thread_border_router_info_t; /** @@ -267,5 +267,43 @@ int thread_border_router_service_tlv_find(uint8_t* network_data_tlv, uint16_t ne */ int thread_border_router_server_tlv_find(uint8_t* service_tlv, uint16_t service_tlv_length, uint8_t** server_tlv, bool* stable); +/** + * Determine context ID from the Network Data TLV (under Prefix TLV) byte array. + * + * \param prefix_tlv [IN] Prefix TLV in byte array. + * \param prefix_tlv_length [IN] Length of the Prefix TLV byte array in bytes. + * + * \return The context ID value found + * \return -1 if error in input parameters. + * \return -2 if no context ID value found. + */ +int thread_border_router_prefix_context_id(uint8_t *prefix_tlv, uint16_t prefix_tlv_length); + +/** + * Start mDNS responder service. The responder will respond to DNS-SD queries and send announcement when + * Thread network data is updated. + * + * The mDNS responder can be closed by calling thread_border_router_mdns_responder_stop(). Closing the Thread + * network interface will stop the mDNS responder automatically. + * + * \param interface_id interface ID of the Thread network + * \param interface_id_mdns interface where mDNS messaging occurs + * \param service_name mDNS instance name + * + * \return 0 on success + * \return <0 in case of errors + * + */ +int thread_border_router_mdns_responder_start(int8_t interface_id, int8_t interface_id_mdns, const char *service_name); + +/** + * Stop mDNS responder service + * + * + * \return 0 on success + * \return <0 in case of errors + * + */ +int thread_border_router_mdns_responder_stop(void); #endif /* THREAD_BORDER_ROUTER_API_H_ */ diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_commissioning_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_commissioning_api.h index 96bfb04af4..6b6040509a 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_commissioning_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_commissioning_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h index 6411ac22e5..84278f5e43 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_dhcpv6_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_diagcop_lib.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_diagcop_lib.h index 80f59e8dd8..c012023740 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_diagcop_lib.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_diagcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_api.h index ffa783fa0c..24d6ce75b2 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_if.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_if.h index 6af84a979a..accb5abc99 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_if.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2014-2016 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_meshcop_lib.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_meshcop_lib.h index 73a1fcb4fe..23c86416b5 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_meshcop_lib.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_meshcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited. All rights reserved. + * Copyright (c) 2015-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * @@ -96,6 +96,8 @@ #define MESHCOP_TLV_DISCOVERY_REQUEST 128 #define MESHCOP_TLV_DISCOVERY_RESPONSE 129 +#define MESHCOP_TLV_TIMEOUT 58 + /** * Write array TLV. * diff --git a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/whiteboard_api.h b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/whiteboard_api.h index bb8c4e3a81..48ffc0665e 100644 --- a/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/whiteboard_api.h +++ b/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/whiteboard_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 ARM Limited. All rights reserved. + * Copyright (c) 2011-2017 ARM Limited. All rights reserved. * * SPDX-License-Identifier: LicenseRef-PBL * diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..3acec20f6e Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_nanostack_full.ar b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_nanostack_full.ar deleted file mode 100644 index 3d755949a7..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_nanostack_full.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..e70ffd3e92 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_nanostack_full.ar b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_nanostack_full.ar deleted file mode 100644 index 4516ff0665..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_nanostack_full.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..e70ffd3e92 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_nanostack_full.ar b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_nanostack_full.ar deleted file mode 100644 index 4516ff0665..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_nanostack_full.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..9274de5738 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_nanostack_full.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_nanostack_full.a deleted file mode 100644 index 09558f8036..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_nanostack_full.a and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..a2620f1633 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_nanostack_full.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_nanostack_full.a deleted file mode 100644 index c8f4433fa2..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_nanostack_full.a and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..a2620f1633 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_nanostack_full.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_nanostack_full.a deleted file mode 100644 index c8f4433fa2..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_nanostack_full.a and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..0c0be01e02 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_nanostack_full.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_nanostack_full.a deleted file mode 100644 index 75857b38bd..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_nanostack_full.a and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..dddfe2c866 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_nanostack_full.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_nanostack_full.a deleted file mode 100644 index 673c42beb8..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_nanostack_full.a and /dev/null differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..dddfe2c866 Binary files /dev/null and b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_nanostack_full.a b/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_nanostack_full.a deleted file mode 100644 index 673c42beb8..0000000000 Binary files a/features/nanostack/FEATURE_NANOSTACK_FULL/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_nanostack_full.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..28d7d8229d Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_border_router.ar b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_border_router.ar deleted file mode 100644 index f84486c908..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_border_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..14655e7ded Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_border_router.ar b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_border_router.ar deleted file mode 100644 index bbe5d82858..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_border_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..14655e7ded Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_border_router.ar b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_border_router.ar deleted file mode 100644 index bbe5d82858..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_border_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..3fbdcced2d Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_border_router.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_border_router.a deleted file mode 100644 index 9068bf10f8..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..c5efc73eac Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a deleted file mode 100644 index 537c417a17..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..c5efc73eac Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a deleted file mode 100644 index 537c417a17..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..fae173cca0 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_border_router.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_border_router.a deleted file mode 100644 index a75c831fbe..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..7b0975dba1 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_border_router.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_border_router.a deleted file mode 100644 index 4b9a76b3df..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..7b0975dba1 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_border_router.a b/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_border_router.a deleted file mode 100644 index 4b9a76b3df..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_BORDER_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_border_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..1406cef137 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_end_device.ar b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_end_device.ar deleted file mode 100644 index 8a3d6f2528..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_end_device.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..d742b1ffc9 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_end_device.ar b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_end_device.ar deleted file mode 100644 index 97240916d2..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_end_device.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..d742b1ffc9 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_end_device.ar b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_end_device.ar deleted file mode 100644 index 97240916d2..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_end_device.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..eff3075985 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_end_device.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_end_device.a deleted file mode 100644 index 45cb0bafa5..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_end_device.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..8dccc0febd Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_end_device.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_end_device.a deleted file mode 100644 index ca865e567b..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_end_device.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..8dccc0febd Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_end_device.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_end_device.a deleted file mode 100644 index ca865e567b..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_end_device.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..ee3ea7b5b9 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_end_device.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_end_device.a deleted file mode 100644 index aec8686a0a..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_end_device.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..544805f7bc Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_end_device.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_end_device.a deleted file mode 100644 index 27e6e6bef4..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_end_device.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..544805f7bc Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_end_device.a b/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_end_device.a deleted file mode 100644 index 27e6e6bef4..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_END_DEVICE/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_end_device.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar new file mode 100644 index 0000000000..f8a40009b5 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_router.ar b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_router.ar deleted file mode 100644 index adacf26040..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_LIKE_CORTEX_M0/libnanostack_armcc_Cortex-M0_thread_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar new file mode 100644 index 0000000000..273ec411c6 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_router.ar b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_router.ar deleted file mode 100644 index 9f7e72cfd1..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_M3/libnanostack_armcc_Cortex-M3_thread_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar new file mode 100644 index 0000000000..273ec411c6 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack.ar differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_router.ar b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_router.ar deleted file mode 100644 index 9f7e72cfd1..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_ARM/TARGET_RTOS_M4_M7/libnanostack_armcc_Cortex-M3_thread_router.ar and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..e3fa4f62e0 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_router.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_router.a deleted file mode 100644 index a4356eaf82..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_LIKE_CORTEX_M0/libnanostack_arm-none-eabi-gcc_Cortex-M0_thread_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..e2cb011975 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_router.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_router.a deleted file mode 100644 index 8c92b6b8c4..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_M3/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..e2cb011975 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_router.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_router.a deleted file mode 100644 index 8c92b6b8c4..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_GCC/TARGET_RTOS_M4_M7/libnanostack_arm-none-eabi-gcc_Cortex-M3_thread_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a new file mode 100644 index 0000000000..00bd5f9d1c Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_router.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_router.a deleted file mode 100644 index 5b0a43972f..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_LIKE_CORTEX_M0/libnanostack_iccarm_Cortex-M0_thread_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a new file mode 100644 index 0000000000..861aad0394 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_router.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_router.a deleted file mode 100644 index abe04acd4e..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_M3/libnanostack_iccarm_Cortex-M3_thread_router.a and /dev/null differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a new file mode 100644 index 0000000000..861aad0394 Binary files /dev/null and b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack.a differ diff --git a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_router.a b/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_router.a deleted file mode 100644 index abe04acd4e..0000000000 Binary files a/features/nanostack/FEATURE_THREAD_ROUTER/TOOLCHAIN_IAR/TARGET_RTOS_M4_M7/libnanostack_iccarm_Cortex-M3_thread_router.a and /dev/null differ