From b3a061e0ab78ea408b9b27aec94252291583f7c7 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Wed, 17 Aug 2016 09:55:25 +0200 Subject: [PATCH] sys: remove config module --- boards/msb-430-common/board_config.c | 42 -------------- boards/msba2-common/board_common_init.c | 1 - boards/msba2-common/board_config.c | 43 -------------- boards/mulle/board_config.c | 36 ------------ boards/native/board_config.c | 49 ---------------- boards/wsn430-common/board_config.c | 27 --------- examples/default/Makefile | 1 - sys/auto_init/auto_init.c | 9 --- sys/config/Makefile | 1 - sys/config/config.c | 24 -------- sys/include/config.h | 76 ------------------------- sys/shell/commands/Makefile | 3 - sys/shell/commands/sc_id.c | 43 -------------- 13 files changed, 355 deletions(-) delete mode 100644 boards/msb-430-common/board_config.c delete mode 100644 boards/msba2-common/board_config.c delete mode 100644 boards/mulle/board_config.c delete mode 100644 boards/native/board_config.c delete mode 100644 boards/wsn430-common/board_config.c delete mode 100644 sys/config/Makefile delete mode 100644 sys/config/config.c delete mode 100644 sys/include/config.h delete mode 100644 sys/shell/commands/sc_id.c diff --git a/boards/msb-430-common/board_config.c b/boards/msb-430-common/board_config.c deleted file mode 100644 index 766b9dec3..000000000 --- a/boards/msb-430-common/board_config.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2014 INRIA - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup boards - * @{ - */ - -/** - * @file - * @brief msb-430 common config module functions - * - * @author Oliver Hahm - * - */ - -#include -#include -#include "board.h" -#include "config.h" -#include "flashrom.h" - -void config_load(void) -{ - if (*((uint16_t *) INFOMEM) == CONFIG_KEY) { - memcpy(&sysconfig, (char *)(INFOMEM + sizeof(CONFIG_KEY)), sizeof(sysconfig)); - } - else { - config_save(); - } -} - -uint8_t config_save(void) -{ - configmem_t mem = { CONFIG_KEY, sysconfig }; - return (flashrom_erase((uint8_t *) INFOMEM) && flashrom_write((uint8_t *) INFOMEM, (uint8_t *) &mem, sizeof(mem))); -} diff --git a/boards/msba2-common/board_common_init.c b/boards/msba2-common/board_common_init.c index c433245dd..a07644e11 100644 --- a/boards/msba2-common/board_common_init.c +++ b/boards/msba2-common/board_common_init.c @@ -26,7 +26,6 @@ #include "msba2_common.h" #include "lpc23xx.h" #include "cpu.h" -#include "config.h" #define CL_CPU_DIV 4 diff --git a/boards/msba2-common/board_config.c b/boards/msba2-common/board_config.c deleted file mode 100644 index c5ca3b0cb..000000000 --- a/boards/msba2-common/board_config.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2014 INRIA - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup boards - * @{ - */ - -/** - * @file - * @brief msba2 common config module functions - * - * @author Oliver Hahm - * @author Zakaria Kasmi - * - */ - -#include -#include -#include "config.h" -#include "flashrom.h" - -void config_load(void) { - extern char configmem[]; - /* cast it here for strict-aliasing */ - uint16_t* tmp = (uint16_t*) configmem; - if (*tmp == CONFIG_KEY) { - memcpy(&sysconfig, (configmem + sizeof(CONFIG_KEY)), sizeof(sysconfig)); - } - else { - config_save(); - } -} - -uint8_t config_save(void) { - configmem_t mem = { CONFIG_KEY, sysconfig }; - return (flashrom_erase((uint8_t*) &configmem) && flashrom_write((uint8_t*) &configmem, (uint8_t*) &mem, sizeof(mem))); -} diff --git a/boards/mulle/board_config.c b/boards/mulle/board_config.c deleted file mode 100644 index 9cd70bd23..000000000 --- a/boards/mulle/board_config.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2015 Eistec AB - * - * This file is subject to the terms and conditions of the GNU Lesser General - * Public License v2.1. See the file LICENSE in the top level directory for more - * details. - */ - -/** - * @ingroup board_mulle - * @{ - */ - -/** - * @file - * @brief Mulle config module implementation - * - * @author Joakim Nohlgård - * - * @note Waiting for PR #2353 (NVRAM API) before implementing this. - */ - -#include -#include -#include "config.h" - -void config_load(void) -{ - /* TODO: Implement */ -} - -uint8_t config_save(void) -{ - /* TODO: Implement */ - return 0; -} diff --git a/boards/native/board_config.c b/boards/native/board_config.c deleted file mode 100644 index 6f98d1971..000000000 --- a/boards/native/board_config.c +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Native Board config.h implementation - * - * No functionality implemented at the moment. - * - * Copyright (C) 2014 Ludwig Knüpfer - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - * - * @ingroup native_board - * @{ - * @file - * @author Ludwig Knüpfer - * @} - */ - -#include -#include -#include - -#include "config.h" - -#include "native_internal.h" - -#define ENABLE_DEBUG (0) -#include "debug.h" - -/** - * XXX: loading not implemented - */ -void config_load(void) -{ - DEBUG("config_load()\n"); - - sysconfig.id = _native_id; - - return; -} - -/** - * XXX: storing not implemented - */ -uint8_t config_save(void) -{ - printf("XXX: config_save(): not implemented - your config will vanish on process termination\n"); - return 1; -} diff --git a/boards/wsn430-common/board_config.c b/boards/wsn430-common/board_config.c deleted file mode 100644 index dcc1255a8..000000000 --- a/boards/wsn430-common/board_config.c +++ /dev/null @@ -1,27 +0,0 @@ -/** - * board-config.c. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -#include -#include -#include "board.h" -#include "config.h" -#include "flashrom.h" - -void config_load(void) { - if (*((uint16_t*) INFOMEM) == CONFIG_KEY) { - memcpy(&sysconfig, (char*) (INFOMEM + sizeof(CONFIG_KEY)), sizeof(sysconfig)); - } - else { - config_save(); - } -} - -uint8_t config_save(void) { - configmem_t mem = { CONFIG_KEY, sysconfig }; - return (flashrom_erase((uint8_t*) INFOMEM) && flashrom_write((uint8_t*) INFOMEM, (uint8_t*) &mem, sizeof(mem))); -} diff --git a/examples/default/Makefile b/examples/default/Makefile index deea21776..d7c6fa6fe 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -31,7 +31,6 @@ QUIET ?= 1 USEMODULE += shell USEMODULE += shell_commands USEMODULE += ps -USEMODULE += config # include and auto-initialize all available sensors USEMODULE += saul_reg USEMODULE += saul_default diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index 41a5f7812..2074f330a 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -20,10 +20,6 @@ #include "auto_init.h" -#ifdef MODULE_CONFIG -#include "config.h" -#endif - #ifdef MODULE_BMP180 #include "bmp180.h" #endif @@ -97,11 +93,6 @@ void auto_init(void) { -#ifdef MODULE_CONFIG - DEBUG("Auto init loading config\n"); - config_load(); -#endif - #ifdef MODULE_TINYMT32 random_init(0); #endif diff --git a/sys/config/Makefile b/sys/config/Makefile deleted file mode 100644 index 48422e909..000000000 --- a/sys/config/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTBASE)/Makefile.base diff --git a/sys/config/config.c b/sys/config/config.c deleted file mode 100644 index 9764ed862..000000000 --- a/sys/config/config.c +++ /dev/null @@ -1,24 +0,0 @@ -/** - * System wide configuration struct. - * - * Copyright (C) 2013 INRIA. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - * - * @ingroup config - * @{ - * @file - * @brief Provides system configuration struct with default values. - * @author Oliver Hahm - * @} - */ - -#include -#include - -config_t sysconfig = { - 0, /**< default ID */ - "foobar", /**< default name */ -}; diff --git a/sys/include/config.h b/sys/include/config.h deleted file mode 100644 index fc73e8bcf..000000000 --- a/sys/include/config.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2013 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @addtogroup core_internal - * @{ - * - * @file - * @brief Kernel configuration interface - * - * @author unknown - */ - -#ifndef CONFIG_H -#define CONFIG_H - -#include - -#ifdef __cplusplus - extern "C" { -#endif - -#define CONFIG_KEY (0x1701) /**< key to identify configuration */ -#define CONFIG_NAME_LEN (10) /**< length of name for configuration in bytes */ - -/** - * @brief Memory for configuration defined externally. - */ -extern char configmem[]; - -/** - * @brief Stores configuration data of the node. - */ -typedef struct { - uint16_t id; /**< unique node identifier */ - char name[CONFIG_NAME_LEN]; /**< name of the node */ -} config_t; - -/** - * @brief Element to store in flashrom. - */ -typedef struct { - uint16_t magic_key; /**< validity check */ - config_t config; /**< the node's configuration */ -} configmem_t; - -/** - * @brief Variable sysconfig defined externally - */ -extern config_t sysconfig; - -/** - * @brief Write configuration back to flashrom. - * - * @return 1 on success, 0 otherwise - */ -uint8_t config_save(void); - -/** - * @brief Read configuration from flashrom and stores it to sysconfig - * - * @note If no configuration is present within flashrom a new configuration will be created - */ -void config_load(void); - -#ifdef __cplusplus -} -#endif - -#endif /* CONFIG_H */ -/** @} */ diff --git a/sys/shell/commands/Makefile b/sys/shell/commands/Makefile index 26dc3391d..b0c4baa2b 100644 --- a/sys/shell/commands/Makefile +++ b/sys/shell/commands/Makefile @@ -2,9 +2,6 @@ MODULE = shell_commands SRC = shell_commands.c sc_sys.c -ifneq (,$(filter config,$(USEMODULE))) - SRC += sc_id.c -endif ifneq (,$(filter mci,$(USEMODULE))) SRC += sc_disk.c endif diff --git a/sys/shell/commands/sc_id.c b/sys/shell/commands/sc_id.c deleted file mode 100644 index 50f5ced89..000000000 --- a/sys/shell/commands/sc_id.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2014 INRIA. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @ingroup sys_shell_commands - * @{ - * - * @file - * @brief Provides shell commands to configure node id - * - * @author Oliver Hahm - * - * @} - */ - -#include -#include -#include -#include "config.h" - -int _id_handler(int argc, char **argv) -{ - if (argc < 2) { - printf("Current id: %u\n", sysconfig.id); - } - else { - long newid = atoi(argv[1]); - printf("Setting new id %ld\n", newid); - sysconfig.id = newid; - - if (!config_save()) { - puts("ERROR setting new id"); - return 1; - } - } - - return 0; -}