Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ns_conf.h Source File

ns_conf.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2019, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _NS_CONF_H_
00019 #define _NS_CONF_H_
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 /**
00026  * \file ns_conf.h
00027  * \brief Nanostack configuration API.
00028  */
00029 
00030 /**
00031  * \brief Set threshold for memory garbage collection.
00032  *
00033  *  Nanostack heap usage is monitored in regular intervals. If too much memory has been used then garbage collection (GC)
00034  *  is triggered. GC has two adjustable thresholds: HIGH and CRITICAL. HIGH threshold is lower one and once exceeded
00035  *  a GC will try to release memory that is used for caching. When CRITTICAL threshold is exceeded them GC will try to release
00036  *  memory more aggressiveliy.
00037  *
00038  *  Nanostack memory monitoring can only work if memory statistics are enabled in nsdynmemLIB.
00039 
00040  *
00041  * \param percentage_high       Percentage of total heap when garbage collection is first time triggered
00042  * \param percentage_critical   Percentage of total heap when critical garbage collection is triggered
00043  *
00044  * \return 0 in success, negative value in case of error.
00045  *
00046  */
00047 int ns_conf_gc_threshold_set(uint8_t percentage_high, uint8_t percentage_critical);
00048 
00049 /**
00050  * \brief Limit amount of incoming packets if system does not have enough free memory.
00051  * Memory statistics must been initialized in nsdynmemLIB to get this feature working.
00052  *
00053  * \param free_heap_percentage Percentage of free heap that must be available when packet arrives to MAC layer.
00054  * \return 0 in case of success, <0 otherwise.
00055  */
00056 int ns_conf_packet_ingress_rate_limit_by_mem(uint8_t free_heap_percentage);
00057 
00058 #ifdef __cplusplus
00059 }
00060 #endif
00061 
00062 #endif /* _NS_CONF_H_ */