mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 02:39:52 +00:00
[utils-settings] add a header file for settings config definitions (#4458)
This commit adds a header file `settings.h` to include all the default configuration definitions related to `settings` platform utility. It also adds `OPENTHREAD_SETTINGS_RAM` to this file. This helps address the undefined macro warnings.
This commit is contained in:
committed by
Jonathan Hui
parent
812e108103
commit
da6c00bd29
@@ -45,6 +45,7 @@ libopenthread_platform_utils_a_SOURCES = \
|
||||
logging_rtt.h \
|
||||
mac_frame.cpp \
|
||||
mac_frame.h \
|
||||
settings.h \
|
||||
settings_ram.c \
|
||||
settings_flash.c \
|
||||
soft_source_match_table.c \
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2020, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file defines the configuration options for platform abstraction of non-volatile storage of settings.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UTILS_SETTINGS_H_
|
||||
#define UTILS_SETTINGS_H_
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
|
||||
/**
|
||||
* @def SETTINGS_CONFIG_BASE_ADDRESS
|
||||
*
|
||||
* The base address of settings.
|
||||
*
|
||||
*/
|
||||
#ifndef SETTINGS_CONFIG_BASE_ADDRESS
|
||||
#define SETTINGS_CONFIG_BASE_ADDRESS 0x39000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def SETTINGS_CONFIG_PAGE_SIZE
|
||||
*
|
||||
* The page size of settings.
|
||||
*
|
||||
*/
|
||||
#ifndef SETTINGS_CONFIG_PAGE_SIZE
|
||||
#define SETTINGS_CONFIG_PAGE_SIZE 0x800
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def SETTINGS_CONFIG_PAGE_NUM
|
||||
*
|
||||
* The page number of settings.
|
||||
*
|
||||
*/
|
||||
#ifndef SETTINGS_CONFIG_PAGE_NUM
|
||||
#define SETTINGS_CONFIG_PAGE_NUM 2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_SETTINGS_RAM
|
||||
*
|
||||
* Define as 1 to enable saving the settings in RAM instead of flash.
|
||||
*
|
||||
*/
|
||||
#ifndef OPENTHREAD_SETTINGS_RAM
|
||||
#define OPENTHREAD_SETTINGS_RAM 0
|
||||
#endif
|
||||
|
||||
#endif // UTILS_SETTINGS_H_
|
||||
@@ -32,12 +32,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
|
||||
#include <openthread/instance.h>
|
||||
#include <openthread/platform/settings.h>
|
||||
|
||||
@@ -67,36 +67,6 @@ struct settingsBlock
|
||||
uint16_t reserved;
|
||||
} OT_TOOL_PACKED_END;
|
||||
|
||||
/**
|
||||
* @def SETTINGS_CONFIG_BASE_ADDRESS
|
||||
*
|
||||
* The base address of settings.
|
||||
*
|
||||
*/
|
||||
#ifndef SETTINGS_CONFIG_BASE_ADDRESS
|
||||
#define SETTINGS_CONFIG_BASE_ADDRESS 0x39000
|
||||
#endif // SETTINGS_CONFIG_BASE_ADDRESS
|
||||
|
||||
/**
|
||||
* @def SETTINGS_CONFIG_PAGE_SIZE
|
||||
*
|
||||
* The page size of settings.
|
||||
*
|
||||
*/
|
||||
#ifndef SETTINGS_CONFIG_PAGE_SIZE
|
||||
#define SETTINGS_CONFIG_PAGE_SIZE 0x800
|
||||
#endif // SETTINGS_CONFIG_PAGE_SIZE
|
||||
|
||||
/**
|
||||
* @def SETTINGS_CONFIG_PAGE_NUM
|
||||
*
|
||||
* The page number of settings.
|
||||
*
|
||||
*/
|
||||
#ifndef SETTINGS_CONFIG_PAGE_NUM
|
||||
#define SETTINGS_CONFIG_PAGE_NUM 2
|
||||
#endif // SETTINGS_CONFIG_PAGE_NUM
|
||||
|
||||
#if (SETTINGS_CONFIG_PAGE_NUM <= 1)
|
||||
#error "Invalid value for `SETTINGS_CONFIG_PAGE_NUM` (should be >= 2)"
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <openthread-core-config.h>
|
||||
#include "settings.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
Reference in New Issue
Block a user